<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pak Jiddat Website]]></title><description><![CDATA[Pak Jiddat Website]]></description><link>http://github.com/dylang/node-rss</link><generator>GatsbyJS</generator><lastBuildDate>Tue, 20 May 2025 07:40:11 GMT</lastBuildDate><item><title><![CDATA[Software Development - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Software Development:]]></description><link>https://pakjiddat.netlify.app//posts/software-development---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/software-development---quick-tips</guid><pubDate>Thu, 28 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Software Development:&lt;/p&gt;
&lt;h4 id=&quot;removing-flickering-of-controls-in-c-windows-forms&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#removing-flickering-of-controls-in-c-windows-forms&quot; aria-label=&quot;removing flickering of controls in c windows forms permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Removing flickering of controls in C# windows forms&lt;/h4&gt;
&lt;p&gt;In windows forms, when form controls are dynamically resized, they may flicker. The following script can be used to remove flickering of form controls:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;c#&quot;&gt;&lt;pre class=&quot;language-c#&quot;&gt;&lt;code class=&quot;language-c#&quot;&gt;SetDoubleBuffered(formControlVariable);

public static void SetDoubleBuffered(System.Windows.Forms.Control c)
{
    if (System.Windows.Forms.SystemInformation.TerminalServerSession)
        return;
    System.Reflection.PropertyInfo aProp = typeof(System.Windows.Forms.Control).GetProperty(&amp;quot;DoubleBuffered&amp;quot;, System.Reflection.BindingFlags.NonPublic
        | System.Reflection.BindingFlags.Instance);
    aProp.SetValue(c, true, null);
}

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.ExStyle |= 0x02000000;
        return cp;
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Programmatic navigation of user interface elements in Unity]]></title><description><![CDATA[Tab Navigation is a Unity project that demonstrates how to move focus on user interface elements programmatically]]></description><link>https://pakjiddat.netlify.app//posts/programmatic-navigation-of-user-interface-elements-in-unity</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/programmatic-navigation-of-user-interface-elements-in-unity</guid><pubDate>Tue, 26 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/0a9aac6c0aeaf5606ae867e34047fd12/fd84e/tab-navigation.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 62.5%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAA7DAAAOwwHHb6hkAAACjklEQVR42o3O61MSURgG8P0fMydxWdgVuSwhynLZFRXEwQu6DojrKmCiclMMAUPNS5iKKHjBTEtNZfCGgGRWflPborHsUzO/OXPe8z7PzAGEWkd5bX+Zug+p7oVVVo7SAsm7QYxmy2lQRoEYVSqjSrEuZoQUNEfZA+NWGLfx6xwsKQnIyJDUEKxoHhU3jqANwyKdR6IfkjYOofWuCr1HrHOJdU6J3i3QOPgah0DrEuncaINH2hJA8G6gzrKgpsMENaMyTymMExgZMjnne33Lest0f3ClfSDc4XxrD6woyICkyVdl8MvaAhgZJDqnxfV2gPRuGTyJZtd6k3NNPxBrsEcpb9zqX211LNn8ayZ31OyJ2vxxrTVcQ8/W9YQ1ljmNJazvX5a3DgODC2n73NmLNye90ynL6yQ9ceiZOxpdTPZN7fsjScfMvmt2zzd/YB591+7dML5MmHyMDTr0UWcdB2KZ++X0ffT8LnJ2t3hyO398G0t9Xzv+tnh0s3l6Ezn8Gvl0tZr8MrmdD25mxxKZsUQ6sH46uZO3haLA0fX1weer/cv8Xu5yN5vbTl98yGR3c/mdTC5xkt66uHyfySdOs7HkWfz4PJ5Kx1PMeb6VuwouxYAatZogcJVSoZTLlXJMgorMHabQq7Eht6uWwH0j3onxEE11SiViJYapFHImWk3gWq2msqoSEHDZD4QIxGOXaNV4T5fZ2NZSifJNbYZuqqO+hiiHWAL4IQmKEAgsLgJQHochKiuAGAIY5LGftbc0ugbtlJFk7nxuaWH1O8bjSPgwh1UMiBD2P9Cyn56Xc5kEA2U6jwNChC3mcaCSp4Uy8w1Q+Bifyyr4+/Eh+atcBPzZwf8HAQUIiPIgqOTJDxIwsW0rafu+AAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/0a9aac6c0aeaf5606ae867e34047fd12/8ac56/tab-navigation.webp 240w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/d3be9/tab-navigation.webp 480w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/e46b2/tab-navigation.webp 960w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/663aa/tab-navigation.webp 1056w&quot;
              sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/0a9aac6c0aeaf5606ae867e34047fd12/8ff5a/tab-navigation.png 240w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/e85cb/tab-navigation.png 480w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/d9199/tab-navigation.png 960w,
/static/0a9aac6c0aeaf5606ae867e34047fd12/fd84e/tab-navigation.png 1056w&quot;
            sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/0a9aac6c0aeaf5606ae867e34047fd12/d9199/tab-navigation.png&quot;
            alt=&quot;Tab Navigation&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Tab Navigation is a Unity project that demonstrates how to move focus on user interface elements programamtically. Currently text boxes and drop downs are supported. The project is based on the &lt;a href=&quot;https://github.com/dav-sea/EasyTab&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;EasyTab&lt;/a&gt; project. The project contains two Unity scenes, which demonstrate the project.&lt;/p&gt;
&lt;h3 id=&quot;benefits&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#benefits&quot; aria-label=&quot;benefits permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Benefits&lt;/h3&gt;
&lt;p&gt;Unity does not have a built in solution for moving focus on user interface elements programmatically. For example if we need to move focus from one text box or drop down to the next by pressing a button, Unity does not provide support for this. It is possible to implement programmatic navigation of user interface elements in Unity but it requires some effort. Programmatic navigation of drop downs requires further effort.&lt;/p&gt;
&lt;p&gt;The Tab Navigation package allows programmatic navigation of text boxes as well as drop downs. It would be useful in applications that do not support keyboard and which require changing focus on the click of a button. See the above screenshot.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The Tab Navigation project has not been tested with Unity 6.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The Tab Navigation project provides scripts that allow forward navigation, reverse navigation and navigating over the elements of a drop down box.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Go to &lt;a href=&quot;https://github.com/dav-sea/EasyTab/releases&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;EasyTab Unity package release page&lt;/a&gt;. Download the Unity Package file. e.g EasyTab-1.3.1.unitypackage&lt;/li&gt;
&lt;li&gt;Create a new Unity project&lt;/li&gt;
&lt;li&gt;Import the Unity Package file. (right click Assets. import package -&gt; custom package)&lt;/li&gt;
&lt;li&gt;Clone the &lt;a href=&quot;https://github.com/pakjiddat/Tab-Navigation.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Tab Navigation source code repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Create Scripts folder inside your project and import the files: CustomDropdown, DownArrow, Enter, ForwardNavigation, ReverseNavigation and UpArrow from the Assets -&gt; Scripts folder of the repository&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Set input field that should have focus at the start. This can be done by clicking on EventSystem and then dragging the input field over the “First Selected” property&lt;/li&gt;
&lt;li&gt;Create the user interface for your scene. It should consist of text boxes, drop downs and navigation buttons. See the above sceenshot&lt;/li&gt;
&lt;li&gt;Attach EasyTab script to all navigation buttons. Set “Selectable Recognition” property to “As not selectable” from the script properties&lt;/li&gt;
&lt;li&gt;Attach the imported scripts to the navigation buttons. i.e DownArrow.cs, Enter.cs, ForwardNavigation.cs, ReverseNavigation.cs and UpArrow.cs&lt;/li&gt;
&lt;li&gt;Attach CustomDropdown.cs script to all the drop downs in the scene&lt;/li&gt;
&lt;li&gt;Set the selectable color of each text box and drop down from the properties inspector. This step is optional&lt;/li&gt;
&lt;li&gt;The next and previous Selectable can be configured for each text box and drop down. To configure the next and previous Selectable, Attach EasyTab script to the drop down or text box. Set the Jumping Policy to “Use only jumping” and then drag the drop down or text box to the Next Jump and Reverse Jump fields&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;licence&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#licence&quot; aria-label=&quot;licence permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Licence&lt;/h3&gt;
&lt;p&gt;The Tab Navigation project is available under the &lt;strong&gt;MIT licence&lt;/strong&gt;. You may use the application source code in your own projects.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Production and Cost]]></title><description><![CDATA[Variable costs are costs that change in proportion with how much a company produces. Fixed costs do not change with quantity produced. In this article I will describe fixed costs and variable costs using examples and some related questions.]]></description><link>https://pakjiddat.netlify.app//posts/production-and-cost</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/production-and-cost</guid><pubDate>Wed, 24 Nov 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 283px; &quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 81.25%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAA3XAAAN1wFCKJt4AAACFUlEQVR42q2TTUhUURiG39OkUNLPtAj6MaNVEEQQSFAg/SxGEnHTrp3VJhcVaYUzFpobzQwhWrWodm105UKkVSUtgmgjyZgEJURqicLU/Hh7zpk7M9e5M9Wic3n47nfuOc/5zr3nSlINbFe+Gf2H9jehCfSbdflzReSF5/xJGKkiFqJItQprKwgL8SCchiPuvk6HFNUJSjjsnj7WAY1pt7+A+ZcK62CvNmkPmijXNvItalOjXpkRLZsMorPlFe+EaEWhXbWAbc+0SzOmXytmQZ7x8ihWLjzqS0tCTxtgY1F0W/s0ZQa1aL77ojXlTNoXNpcLS1vOf7WSaFT1VDSk1aIoBxkX10y2WoW12qod67Z2D9FLKnprlrTEpAUE04hmiV/J5+ETwh/EVFhYw6vOV/hI+/XeDDDwm1vdCl4jmiZOkb+Dz67f0xuEc8TFsDCiUxyDF4i+UJEV/UKwgihFTLvcK8aUT9rf8mr4HUqdGtdTuh4qw3YzGlZOI+SWBzDsxwL3YUhZxttnzcX3HxBO8CU9deunepBdgYtwwY8dcAna4TLEIaG0et2cWFh4Q5Ma5GEfq/YTe+AmXIUuSEAnXIdbcNeR1YCbU0F4TU+YNM/KHyDJfRLpLFV/dDFOvKMZctufdGO6yePMSajJOc4FhS3arDN86xgHyNLK73WMoxTVcXpPkrWogRNwnl8xOM7eN3FuA+03x3bwNH7MK/cAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/dc265122caeee983ede23086cb6072f3/8ac56/fixed-and-variable-costs.webp 240w,
/static/dc265122caeee983ede23086cb6072f3/30314/fixed-and-variable-costs.webp 283w&quot;
              sizes=&quot;(max-width: 283px) 100vw, 283px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/dc265122caeee983ede23086cb6072f3/8ff5a/fixed-and-variable-costs.png 240w,
/static/dc265122caeee983ede23086cb6072f3/bde6a/fixed-and-variable-costs.png 283w&quot;
            sizes=&quot;(max-width: 283px) 100vw, 283px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/dc265122caeee983ede23086cb6072f3/bde6a/fixed-and-variable-costs.png&quot;
            alt=&quot;Fixed costs and variable costs&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;
By Nils R. Barth - Self-made in Inkscape.This W3C-unspecified vector image was created with Inkscape ., Public Domain, &lt;a href=&quot;https://commons.wikimedia.org/w/index.php?curid=3497302&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://commons.wikimedia.org/w/index.php?curid=3497302&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/microeconomics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Microeconomics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it useful. As part of the course, we were given some practice questions related to fixed costs and variable costs. In this article I will describe fixed costs and variable costs.&lt;/p&gt;
&lt;p&gt;According to Investopedia &lt;a href=&quot;https://www.investopedia.com/terms/v/variablecost.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Variable Costs&lt;/a&gt; are costs that change in proportion to how much a company produces or sells. In contrast, &lt;a href=&quot;https://www.investopedia.com/terms/f/fixedcost.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fixed Costs&lt;/a&gt; do not change with an increase or decrease in the volume of items produced or sold. Fixed costs have to be payed by the company irrespective of any business activity.&lt;/p&gt;
&lt;h3 id=&quot;what-are-fixed-inputs-and-variable-inputs-for-different-industries&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-are-fixed-inputs-and-variable-inputs-for-different-industries&quot; aria-label=&quot;what are fixed inputs and variable inputs for different industries permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What are fixed inputs and variable inputs for different industries&lt;/h3&gt;
&lt;h4 id=&quot;background&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background&quot; aria-label=&quot;background permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;The relative size of the fixed costs to variable costs varies considerably for different industries. It is important for a manager (or owner) to understand the differences between these cost categories. This discussion topic is designed to allow you to get better at understanding this difference.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question&quot; aria-label=&quot;discussion question permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Consider 3 types of businesses/industries: 1) computer manufacturing, 2) computer software; and 3) pizzerias. What is the relationship between fixed costs and variable costs for each of these industries? Which 1 of these 3 industries has the largest share of fixed costs as a percentage of all costs?&lt;/p&gt;
&lt;h4 id=&quot;answer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer&quot; aria-label=&quot;answer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Computer Manufacturing&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For the Computer Manufacturing industry fixed costs are those costs which do not change with the number of computer parts that are produced or sold. Variable costs are costs which change with the volume of computer parts that are produced or sold.&lt;/p&gt;
&lt;p&gt;Fixed costs may include rent, mortgage and lease payments for the production plant, salaries of staff that do not change with production such as manager salaries. Insurance and property taxes may also be regarded as fixed costs.&lt;/p&gt;
&lt;p&gt;Variable costs include cost of labor, commission on sales of the computer parts, cost of raw materials used in production and utility payments such as electricity bills. Cost of packaging and depreciation of plant equipment are also variable costs.&lt;/p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Computer Software&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For the software industry, fixed costs are those that do not change with the volume of software that is produced or sold. Variable costs include costs that change with the volume of software that is produced. The volume of software that is produced by software businesses depends on the number of software developers and measures taken to improve developer productivity.&lt;/p&gt;
&lt;p&gt;Fixed costs would include license cost of operating systems, utility costs such as electricity bills, salary of managers. If the software is being developed in house, then payment of property taxes, office rent, office lease, insurance costs of computer equipment are also examples of fixed costs.&lt;/p&gt;
&lt;p&gt;Variable costs would include the salary of software developers, cost of computer equipment, software licenses and cost of software and online services that increase developer productivity.&lt;/p&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Pizzerias&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Pizzerias are businesses that make pizzas. The fixed cost for Pizzerias are costs that do not change with the volume of pizzas that are produced. It would include rent, mortgage and lease payments for the kitchen where pizzas are made. The loans taken for payment of kitchen equipment. Salaries of managers. Payment of utility bills is also fixed because it does not change with the number of pizzas that are produced.&lt;/p&gt;
&lt;p&gt;Variable costs for Pizzerias are costs that change with the volume of pizzas that are produced. Variable costs include salaries of cooks, cost of raw materials used to produce pizzas such as bread, cheese, cooking oil, vegetables, meat etc.&lt;/p&gt;
&lt;p&gt;I think the computer manufacturing industry has the largest share of fixed costs as a percentage of all costs. Computer manufacturers in most cases can easily increase the number of units produced. This would not be possible if variable costs were high.&lt;/p&gt;
&lt;h3 id=&quot;what-are-the-fixed-costs-and-variable-costs-of-moocs&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-are-the-fixed-costs-and-variable-costs-of-moocs&quot; aria-label=&quot;what are the fixed costs and variable costs of moocs permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What are the fixed costs and variable costs of MOOCs&lt;/h3&gt;
&lt;h4 id=&quot;background-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-1&quot; aria-label=&quot;background 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Companies like Coursera are dramatically changing higher education by offering good quality courses to the masses for a very low cost. But a more interesting question is why did it take so long? Perhaps the answer lies in the way technology has changed the fixed and variable costs of offering education in the last 10 years.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-1&quot; aria-label=&quot;discussion question 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;What are the fixed and variable costs of offering a Coursera course? In what way have these costs changed during the last 10-15 years? How do these fixed and variable costs compare to the costs of offering a traditional face to face course for a typical 4-year college?&lt;/p&gt;
&lt;h4 id=&quot;answer-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-1&quot; aria-label=&quot;answer 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;Massive Online Open Courses (MOOCs) is basically a video streaming provider. It may also offer software as a service, such as online software labs or applications. MOOCs provide a virtual learning environment at a very low cost.&lt;/p&gt;
&lt;p&gt;Over the last 10-15 years there has been major improvements in computer technology. Computer parts such as Hard Drives and Processors cost much less and have much better performance. This has decreased the variable costs of providing online courses.&lt;/p&gt;
&lt;p&gt;A MOOC that sells hundreds of courses online can sell thousands of courses without incurring a large variable cost. The same computer equipment can be used to serve many more courses.&lt;/p&gt;
&lt;p&gt;This would mean that the cost of computer equipment and electricity is a fixed cost since it does not change with the increase or decrease in the number of courses that are offered. So I think over the last 10-15 years the fixed costs of offering a Coursera course has increased while the variable costs have decreased.&lt;/p&gt;
&lt;p&gt;Typical colleges provide a physical learning environment at a high cost. Both MOOCs and colleges provide courses to students but at very different rates. Businesses that provide MOOCs and colleges have different types of fixed and variable costs.&lt;/p&gt;
&lt;p&gt;For MOOCs and colleges, fixed costs are costs that do not change with the number of courses that are offered. Variable costs are costs that change with the number of courses that are offered.&lt;/p&gt;
&lt;p&gt;For MOOCs fixed cost includes rent, mortgage and lease payments for the office buildings and manager salaries. Cost of video streaming equipment, cost of servers that provide software as a service and the license cost for software are also fixed costs.&lt;/p&gt;
&lt;p&gt;For colleges the fixed costs would include rent, mortgage and lease payments for the college buildings and salaries of certain staff such as the college management.&lt;/p&gt;
&lt;p&gt;For MOOCs, variable costs includes staff salary and payment to colleges that provide the online course material. The MOOC business may have its own data center. It may also use a cloud computing provider such as Google Cloud Platform or Amazon Web Services.&lt;/p&gt;
&lt;p&gt;If the business has its own data center, then its variable cost may include the cost of running the data center. This would include utility costs, depreciation cost of data center equipment, license costs for the software and equipment. If the business uses a cloud computing provider, then its variable costs will include the subscription fees paid to the cloud computing provider.&lt;/p&gt;
&lt;p&gt;For colleges variable costs are costs that change with the number of courses that are offered. This includes teacher salaries, cost of providing class rooms, utility costs, recreational services and facilities offered to students.&lt;/p&gt;
&lt;h3 id=&quot;how-long-is-the-long-run&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-long-is-the-long-run&quot; aria-label=&quot;how long is the long run permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How long is the long run&lt;/h3&gt;
&lt;h4 id=&quot;background-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-2&quot; aria-label=&quot;background 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;How long the long run is will vary from industry to industry.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-2&quot; aria-label=&quot;discussion question 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;How long would you estimate the long run is in the following industries&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The market for soda sold from street carts in the Chicago Downtown district.&lt;/li&gt;
&lt;li&gt;The market for meals at newly trendy Sushi restaurants.&lt;/li&gt;
&lt;li&gt;The market for electrical engineers.&lt;/li&gt;
&lt;li&gt;After 1999, the market for movies that are suspiciously similar to The Matrix?&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;answer-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-2&quot; aria-label=&quot;answer 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The market for soda sold from street carts would exist for many years. Changes in the climate or customer preferences may cause the market to shutdown.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The market for meals at new trendy Sushi restaurants may exist for many years. Increase in fish prices or competition from other types of restaurants may cause Sushi restaurants to shutdown.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The market for electrical engineers is likely to remain for a very long time. Currently society depends a lot on electricity and there is a large market for electrical engineers.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The market for movies that are similar to Matrix would likely remain for a few years after the release of the Matrix movie. After that the theme of the movie may become outdated and the market may shutdown.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;what-are-different-production-functions-for-different-firms&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-are-different-production-functions-for-different-firms&quot; aria-label=&quot;what are different production functions for different firms permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What are different production functions for different firms&lt;/h3&gt;
&lt;h4 id=&quot;background-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-3&quot; aria-label=&quot;background 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Different firms have different production functions.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-3&quot; aria-label=&quot;discussion question 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Provide a brief description of the production function for each of the following firms. What is the firm’s output? What input does it use? Can you think of any special features of the way production takes place in a firm?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;An Iowa wheat farm&lt;/li&gt;
&lt;li&gt;An Arizona vegetable farm&lt;/li&gt;
&lt;li&gt;A local arc-welding farm&lt;/li&gt;
&lt;li&gt;Apple Computers&lt;/li&gt;
&lt;li&gt;Macy’s&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;answer-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-3&quot; aria-label=&quot;answer 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Its input would include cost of farming machinery, Land where the wheat is produced, Labor that is used in production, Fertilizer, seeds, insecticides, and water that is used to grow wheat. Storage facilities used to store the harvested wheat.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The output would be harvested wheat. This output goes through different industries that add value such as industries that produce baked items like bread, cake, biscuits etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Its input would include cost of farming machinery, Land where the vegetables are produced, Labor that is used in production, Fertilizer, seeds, insecticides, and water that is used to grow the vegetables. Storage facilities used to store the harvested vegetables.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The input for Apple Computers would be the raw materials that are used to produce the computers. Such as plastic, silicon, metals. Manufacturing equipment that produces computer parts from the raw material. Electricity for the manufacturing equipment. Laborers that check for defective items. The output is the Apple Computer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Macy’s is an American retail departmental store that offers several categories of products. The input for Macy’s would be the products that are provided by whole-sellers. The buildings used as retail shops, employees and utilities used by the shops such as electricity are also inputs. Order processing systems that include point of sales equipment, human resource management systems, customer management systems, business process management systems are also inputs. The output is the final packaged products that are sold to customers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;why-didnt-the-introduction-of-computers-have-an-effect-on-labor-productivity-between-1973-and-1995&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-didnt-the-introduction-of-computers-have-an-effect-on-labor-productivity-between-1973-and-1995&quot; aria-label=&quot;why didnt the introduction of computers have an effect on labor productivity between 1973 and 1995 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why didn’t the introduction of computers have an effect on labor productivity between 1973 and 1995&lt;/h3&gt;
&lt;h4 id=&quot;background-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-4&quot; aria-label=&quot;background 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Economists have intensively studied productivity trends during the past 50 years in an effort to identify factors that may have contributed to improvements. One of the major puzzles in this research is that productivity growth seems to have slowed down just as computers were coming into more widespread usage in the U.S. economy. From 1959 to 1973, average labor productivity increased at an annual rate of nearly 3 percent per year and total factor productivity growth was more than 1 percent per year. During the following 2 decades, however, both rates of productivity increase slowed dramatically. What is odd about this finding is that these 2 decades were characterized by the rapid introduction of computers into practically all areas of the economy. Presumably these actions should have increased productivity.&lt;/p&gt;
&lt;p&gt;After 1995, productivity performance in the U.S. economy improved dramatically, and this is when the effect of computers began to appear.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-4&quot; aria-label=&quot;discussion question 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Why do you think the introduction of computers did not have an effect on labor productivity in the U.S. between 1973 and 1995? Please explain. Exactly how does computer technology increase productivity?. Who experiences the gains in productivity spawned by computers?&lt;/p&gt;
&lt;h4 id=&quot;answer-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-4&quot; aria-label=&quot;answer 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;I think computer technology improves productivity by improving the information flow. Workers have access to more information and can make better decisions based on facts. Also computer technology has improved the quality of products that are produced. Furthermore computer technology has increased automation in production. I think all these factors have led to an increase in worker productivity.&lt;/p&gt;
&lt;p&gt;I think the main benefit of increase in productivity is experienced by the company managers and owners who make more money. Products can now be produced at a much lower cost than before.&lt;/p&gt;
&lt;p&gt;I think between 1973 and 1995 computer technology was not very advanced. Computers could not perform many tasks and their practical use was not well understood. It was a new technology at that time and society was not used to it. Communication and collaboration tools did not exist. Computer hardware did not have good performance and so the software that was based on it could not do much. Also computer algorithms were newly developed and their practical applications were not well understood.&lt;/p&gt;
&lt;p&gt;By 1995 computers hardware had improved a lot in terms of performance. Also computer software became more complex with more features.&lt;/p&gt;
&lt;p&gt;Strange as it may seem, I think society is still not quite used to computers. Computers have created many opportunities and markets, but also I think the use of computers is sometimes unnecessary.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Elasticity of demand]]></title><description><![CDATA[Elasticity of demand refers to the change in quantity demanded with a change in some metric such as price or income. In this article I will describe what is meant by price elasticity of demand, income elasticity of demand and cross price elasticity of demand. I will describe these terms along with examples and some related questions.]]></description><link>https://pakjiddat.netlify.app//posts/elasticity-of-demand</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/elasticity-of-demand</guid><pubDate>Mon, 16 Aug 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 274px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/d7e01541d06fa805fdb7d3229f4f340e/d3fa7/income-elasticity-of-demand-inferior-goods.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 67.08333333333334%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAr0lEQVR42q2Taw6CMBCEW6q8gmBFojH8M/Ea3v9WzCZDXJvGtEiTL5Rtd5mdFmM+4wEqs8OwfL5Ax3mxR8EhUGj/LXhmwZNSuqlwTKHMr6DcolCSjqAHtYpLbAQeuBy1crpvcFOKdGILplwbJOkeadGqU0+2QXvYqFhIzIbYnq+CdaLvFT3/qXBk2z2v0MpA1nfPPZ7I2gU8Q28dv1wqHH2TxEOwppHO5tRb0Ob84wtu0wRx6HBC5wAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/d7e01541d06fa805fdb7d3229f4f340e/8ac56/income-elasticity-of-demand-inferior-goods.webp 240w,
/static/d7e01541d06fa805fdb7d3229f4f340e/c6d10/income-elasticity-of-demand-inferior-goods.webp 274w&quot;
              sizes=&quot;(max-width: 274px) 100vw, 274px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/d7e01541d06fa805fdb7d3229f4f340e/8ff5a/income-elasticity-of-demand-inferior-goods.png 240w,
/static/d7e01541d06fa805fdb7d3229f4f340e/d3fa7/income-elasticity-of-demand-inferior-goods.png 274w&quot;
            sizes=&quot;(max-width: 274px) 100vw, 274px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/d7e01541d06fa805fdb7d3229f4f340e/d3fa7/income-elasticity-of-demand-inferior-goods.png&quot;
            alt=&quot;Income elasticity of demand for inferior goods&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;
Income elasticity of demand for inferior goods. Wykis, Public domain, via Wikimedia Commons&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/microeconomics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Microeconomics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it useful. As part of the course, we were given some practice questions related to elasticity of demand. In this article, I have listed these practice questions and my answers to the questions.&lt;/p&gt;
&lt;p&gt;The concept of elasticity of demand is a measure of how responsive the quantity demanded of an item is to a change in some metric such as price or income. The concept of elasticity has many applications in Economics. For example calculation of total revenue, effect of taxes of buyers and sellers etc.&lt;/p&gt;
&lt;h3 id=&quot;price-elasticity-of-demand&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#price-elasticity-of-demand&quot; aria-label=&quot;price elasticity of demand permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Price elasticity of demand&lt;/h3&gt;
&lt;p&gt;According to Wikipedia, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Price_elasticity_of_demand&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Price elasticity of demand&lt;/a&gt; is defined as: “A good’s price elasticity of demand (PED) is a measure of how sensitive the quantity demanded of it is to its price. When the price rises, quantity demanded falls for almost any good, but it falls more for some than for others. The price elasticity gives the percentage change in quantity demanded when there is a one percent increase in price, holding everything else constant. If the elasticity is -2, that means a one percent price rise leads to a two percent decline in quantity demanded. Other elasticities measure how the quantity demanded changes with other variables (e.g. the income elasticity of demand for consumer income changes)“.&lt;/p&gt;
&lt;h3 id=&quot;income-elasticity-of-demand&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#income-elasticity-of-demand&quot; aria-label=&quot;income elasticity of demand permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Income elasticity of demand&lt;/h3&gt;
&lt;p&gt;According to Wikipedia, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Income_elasticity_of_demand&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Income elasticity of demand&lt;/a&gt; is defined as: “In economics, the income elasticity of demand is the responsivenesses of the quantity demanded for a good to a change in consumer income. It is measured as the ratio of the percentage change in quantity demanded to the percentage change in income. If a 10% increase in Mr. Ruskin Smith’s income causes him to buy 20% more bacon, Smith’s income elasticity of demand for bacon is 20%/10% = 2”.&lt;/p&gt;
&lt;h3 id=&quot;cross-elasticity-of-demand&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#cross-elasticity-of-demand&quot; aria-label=&quot;cross elasticity of demand permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Cross elasticity of demand&lt;/h3&gt;
&lt;p&gt;According to Wikipedia, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross_elasticity_of_demand&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cross elasticity of demand&lt;/a&gt; is defined as: “In economics, the cross elasticity of demand or cross-price elasticity of demand measures the percentage change of the quantity demanded for a good to the percentage change in the price of another good, ceteris paribus.[1] In real life, the quantity demanded of good is dependent on not only its own price (Price elasticity of demand) but also the price of other “related” products”.&lt;/p&gt;
&lt;h3 id=&quot;should-the-us-federal-government-decriminalize-the-use-of-marijuana-for-recreational-purposes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#should-the-us-federal-government-decriminalize-the-use-of-marijuana-for-recreational-purposes&quot; aria-label=&quot;should the us federal government decriminalize the use of marijuana for recreational purposes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Should the U.S. federal government decriminalize the use of marijuana for recreational purposes&lt;/h3&gt;
&lt;h4 id=&quot;background&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background&quot; aria-label=&quot;background permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;In the U.S. one of the most contested issues of the past 30 years has been how to deal with the issue of drug-related problems in this country. In fact, we introduced this problem in Module 2. Most of the efforts to deal with the problem so far have been by reducing the supply (mostly through enforcement) and the so-called “war on drugs”. But this war on drugs has resulted in very large expenditures in the criminal justice system. And many argue this policy has had very limited, if any, effect on reducing the use of illegal drugs.&lt;/p&gt;
&lt;p&gt;At the center of the debate has been the use of marijuana, a product derived from the cannabis sativa plant. While some continue to argue for maintaining the same policy, a strong movement has been calling for a different approach. Alternatives include dealing with the issue as a public health issue, not an enforcement issue. This approach basically would target demand instead of supply. Nevertheless, many have argued for the complete decriminalization of marijuana.&lt;/p&gt;
&lt;p&gt;This debate has taken the front pages in the last few years as many states have passed legislation legalizing the use of marijuana for both medical and recreational purposes.&lt;/p&gt;
&lt;p&gt;Here is some useful background material.&lt;/p&gt;
&lt;p&gt;In favor of legalization:&lt;/p&gt;
&lt;p&gt;Gary S. Becker, “The Failure of the War on Drugs”
James Ostrowski, “Thinking About Drug Legalization”
Against legalization:&lt;/p&gt;
&lt;p&gt;Robert L. Maginnis, “Legalization of Drugs: The Myths and the Facts”
Drug Enforcement Administration, “Response to JAMA Article Titled ‘Marihuana as Medicine’”
No opinion but useful:&lt;/p&gt;
&lt;p&gt;Jenny Williams, Rosalie Liccardo Pacula, Frank J. Chaloupka, and Henry Wechsler, “Alcohol and Marijuana Use Among College Students: Economic Complements or Substitutes”&lt;/p&gt;
&lt;h4 id=&quot;discussion-question&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question&quot; aria-label=&quot;discussion question permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Should the US federal government decriminalize the use of marijuana for recreational purposes?. You must limit your response to concepts of the price elasticity of demand for marijuana and, for purposes of this discussion, completely refrain from any moral or ethical arguments.&lt;/p&gt;
&lt;h4 id=&quot;answer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer&quot; aria-label=&quot;answer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;I think decriminalizing the use of marijuana for recreational purposes will make the use of marijuana in society common. I think this will improve public knowledge about the negative affects of marijuana and will lead to an eventual decrease in the consumption of the drug.&lt;/p&gt;
&lt;p&gt;From the point of view of economics, decriminalizing the use of marijuana for recreational purposes will increase the supply of the drug in the market. This will cause a downward shift of the supply curve, which will decrease the equilibrium or market price of marijuana. A decrease in the price will reduce the incentive for sellers to sell marijuana. A decrease in price should not affect the quantity consumed by much, since the demand for marijuana is inelastic. A decrease in the market price of marijuana does not affect buyers much. It should decrease the burden on the criminal justice system.&lt;/p&gt;
&lt;h3 id=&quot;what-are-the-policy-implications-of-the-price-elasticity-of-demand-for-abortions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-are-the-policy-implications-of-the-price-elasticity-of-demand-for-abortions&quot; aria-label=&quot;what are the policy implications of the price elasticity of demand for abortions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What are the policy implications of the price elasticity of demand for abortions&lt;/h3&gt;
&lt;h4 id=&quot;background-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-1&quot; aria-label=&quot;background 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Using econometric techniques, Marshall Medoff estimated the price elasticity and the income elasticity of demand for abortions in the U.S. to be -1.07 and 1.24 respectively (see source below).  To calculate these elasticities he used state data pooled over the census years 1982, 1992, and 2000.&lt;/p&gt;
&lt;p&gt;Source: Medoff, Marshall H., “Price, Restrictions and Abortion Demand,” Journal of Family and Economic Issues, 28(4), December 2007:583–599.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-1&quot; aria-label=&quot;discussion question 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use the elasticities found by Medoff to answer the following 2 questions. Again, you must limit your response to concepts of elasticity of demand for abortions and, for purposes of this discussion, completely refrain from any moral or ethical arguments.&lt;/p&gt;
&lt;p&gt;What are the economic and policy implications of the price elasticity of demand for abortions to further state and/or federal restrictions on abortions?
What are the implications of the income elasticity of demand for abortions when one considers the accessibility of abortions between low- and high-income women?&lt;/p&gt;
&lt;h4 id=&quot;answer-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-1&quot; aria-label=&quot;answer 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;The data collected by Marshall Medoff shows that the absolute values for the price and income elasticities for having abortions is more than 1, which means elastic. So a small change in cost for abortions or the income of users involved in abortions will lead to a large change in number of abortions.&lt;/p&gt;
&lt;p&gt;States that want to place restrictions on abortions may want to increase the cost of having abortions. A small increase in cost of abortions should not affect hight income users. To decrease abortions fairly among all income classes, restrictions on abortions may involve increase in the cost of abortions in proportion to the income of the users.&lt;/p&gt;
&lt;p&gt;Low income women are less able to afford abortions and are more affected by changes in price of abortions. The income elasticity of demand for abortions is most likely higher for low income women as compared to high income women.&lt;/p&gt;
&lt;h3 id=&quot;which-items-are-best-to-highlight-on-storefronts&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#which-items-are-best-to-highlight-on-storefronts&quot; aria-label=&quot;which items are best to highlight on storefronts permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Which items are best to highlight on storefronts&lt;/h3&gt;
&lt;h4 id=&quot;background-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-2&quot; aria-label=&quot;background 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Have you ever wondered how stores decide which discounted items to highlight on their marquee?. A drug store may choose to highlight a discount on milk, while a gas station may choose to highlight a discount on diet soda. But each of these stores sells thousands of different items; why did they highlight these 2 items?&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-2&quot; aria-label=&quot;discussion question 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;How could the use of the concept of elasticity answer this question of which items are best to highlight on storefronts?. Please give specific examples in answering the question.&lt;/p&gt;
&lt;h4 id=&quot;answer-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-2&quot; aria-label=&quot;answer 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;Stores will want to highlighted discounted items with high elasticities of demand. This is because for items with a high elasticity of demand, a small decrease in price causes a large increase in quantity demanded. Consumers of elastic items will be more interested to know about a discount in the price of these items. Hence it makes sense to highlight discounted items with high price elasticities of demand.&lt;/p&gt;
&lt;p&gt;Items that are non essential and have substitutes usually have a higher elasticity of demand. For a drug store, medicines are essential items, while milk is a non essential item with substitutes such as soft drinks or bottled water.Drug stores would want to highlight discounted items that have a high price elasticity of demand. This will increase the sales of that item as compared with items that have a lower price elasticity of demand.&lt;/p&gt;
&lt;p&gt;A gas station’s main purpose is to sell gas. People who visit gas stations mainly want to buy gas. A gas station would not benefit much from highlighting discounts in prices of essential items, because consumers of essential items will most likely buy items, even in the case of price changes.&lt;/p&gt;
&lt;p&gt;A Gas station would benefit more by highlighting non essential items that have a high price elasticity of demand such as diet soda.&lt;/p&gt;
&lt;h3 id=&quot;if-you-want-to-pay-the-lowest-rent-possible-should-you-hope-that-demand-for-apartments-is-elastic-or-inelastic&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#if-you-want-to-pay-the-lowest-rent-possible-should-you-hope-that-demand-for-apartments-is-elastic-or-inelastic&quot; aria-label=&quot;if you want to pay the lowest rent possible should you hope that demand for apartments is elastic or inelastic permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;If you want to pay the lowest rent possible, should you hope that demand for apartments is elastic or inelastic&lt;/h3&gt;
&lt;h4 id=&quot;background-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-3&quot; aria-label=&quot;background 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;The price elasticity of demand determines which side of the market—buyers or sellers—have more leverage when negotiating the rent of apartments. This is an important issue to understand for any college student choosing to live outside of college dorms during his/her time in college.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-3&quot; aria-label=&quot;discussion question 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Suppose that in your college town real estate developers are building thousands of new student-friendly apartments close to campus. If you want to pay the lowest rent possible, should you hope that demand for apartments is elastic or inelastic?. Please explain and use a specific example.&lt;/p&gt;
&lt;h4 id=&quot;answer-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-3&quot; aria-label=&quot;answer 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;If the demand for apartments is elastic, then a small change in price results in a large change in quantity demanded. When this happens landlords are less likely to increase prices because people are more likely to move to other apartments in case of price increase. Hence people who want to rent apartments have leverage.&lt;/p&gt;
&lt;p&gt;If the demand for apartments in inelastic, then a change in price does not result in a large change in quantity demanded. This usually happens when apartments are in great demand and students have no choice but to rent specific apartments. When this happens students who want to rent apartments have less leverage.&lt;/p&gt;
&lt;p&gt;So students who want to rent apartments will want to hope that the demand for apartments in inelastic.&lt;/p&gt;
&lt;h3 id=&quot;price-elasticity-of-demand-and-the-market-for-tablets&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#price-elasticity-of-demand-and-the-market-for-tablets&quot; aria-label=&quot;price elasticity of demand and the market for tablets permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Price elasticity of demand and the market for tablets.&lt;/h3&gt;
&lt;h4 id=&quot;background-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-4&quot; aria-label=&quot;background 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Say you were advising Tim Cook (CEO of Apple), who was considering decreasing the price of the iPad by 30% (in order to compete with Amazon’s new Kindle). Further, assume you knew the price elasticity for iPads was -1.3.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-4&quot; aria-label=&quot;discussion question 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;What would be the % change in the quantity of iPads sold as a result of the reduction in price?. What would be your advice to Tim Cook?. If you did not know the price elasticity of iPads and would have to guess, would you guess the demand for iPads was price elastic or inelastic?. Please explain your answer using a specific example.&lt;/p&gt;
&lt;h4 id=&quot;answer-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-4&quot; aria-label=&quot;answer 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;I think the demand for iPads is elastic because consumers have many options to choose from. Decreasing the price of iPads should increase the quantity sold by -1.3*-30 = 39%.&lt;/p&gt;
&lt;p&gt;When the price of an item increases, the total revenue increases if the price elasticity of demand of the item is inelastic. This is because an increase in price results in a smaller decrease in quantity demanded. Since price increases more than quantity demanded, the total revenue increase.&lt;/p&gt;
&lt;p&gt;But if the price elasticity of demand in elastic, then the total revenue decreases as a result of an increase in price.&lt;/p&gt;
&lt;p&gt;Since the demand for iPads is elastic, decreasing the price increases the quantity demanded by an amount that is larger than the increase in price. Since quantity demanded increases more than the price decreases, the total revenue increases.&lt;/p&gt;
&lt;h3 id=&quot;what-would-be-the-effect-of-a-beer-ban-on-campus-during-certain-holidays&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-would-be-the-effect-of-a-beer-ban-on-campus-during-certain-holidays&quot; aria-label=&quot;what would be the effect of a beer ban on campus during certain holidays permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What would be the effect of a beer ban on campus during certain holidays&lt;/h3&gt;
&lt;h4 id=&quot;background-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-5&quot; aria-label=&quot;background 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Beer tends to be one of the most inelastic goods in the United States. An average of many studies suggests the price elasticity of demand for beer in the U.S. to be around -0.26.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-5&quot; aria-label=&quot;discussion question 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Suppose the city officials around a college town are considering banning the sale of beer during certain holidays in order to prevent student misconduct from intoxication. Given the price elasticity of demand for beer, what would be the effect of such a ban? Please explain using examples.&lt;/p&gt;
&lt;h4 id=&quot;answer-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-5&quot; aria-label=&quot;answer 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;If a product has an inelastic demand, it means that its quantity demanded does not change much, when the price changes. This is usually the case for products that are considered essential or addictive, such as beer.&lt;/p&gt;
&lt;p&gt;Cutting the supply of an item that is considered as essential, will result in an increase in the price of the item. Low income students will not be able to afford beer. This may result in an increase in the number of students with mental health related problems and also possibly an increase in the crime rate.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating Snaps for PyQt5 applications]]></title><description><![CDATA[Snap Apps or Snaps are applications for the Linux platform. They are managed using the Snappy package management system. Applications implemented using the Snap format can be installed across a wide range of Linux distributions.]]></description><link>https://pakjiddat.netlify.app//posts/creating-snaps-for-pyqt5-applications</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-snaps-for-pyqt5-applications</guid><pubDate>Tue, 10 Aug 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Snap Apps or Snaps are applications for the Linux platform. They are managed using the Snappy package management system. Applications implemented using the Snap format can be installed across a wide range of Linux distributions.&lt;/p&gt;
&lt;p&gt;Snaps are currently supported by Arch Linux, CentOS, Debian, Fedora, Solus, Manjaro Linux, Linux Mint, OpenEmbedded, Raspbian, OpenWrt and openSUSE.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/AppImage&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;AppImage&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Flatpak&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Flatpack&lt;/a&gt;, which are similar to Snaps also allow portable distribution of software.&lt;/p&gt;
&lt;p&gt;Snaps are not dependent on a specific apps store. They may be downloaded from any source. &lt;a href=&quot;https://snapcraft.io/store&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ubuntu Snap Store&lt;/a&gt; is the main source for snaps. Many popular Linux applications such as Octave, Skype, Stellerium, GIMP, LibreOffice, Blender etc can be downloaded as Snaps from the Ubuntu Snap Store.&lt;/p&gt;
&lt;p&gt;In this article I will describe how to package and distribute a PyQt5 application as a snap app. The PyQt5 application is first converted to executable format using the &lt;strong&gt;pyqtdeploy&lt;/strong&gt; tool. See the article: &lt;a href=&quot;/posts/creating-desktop-applications-with-python-using-pyqt5&quot;&gt;Creating desktop applications with Python using PyQt5&lt;/a&gt;, on how to create executable files for PyQt5 applications.&lt;/p&gt;
&lt;p&gt;It is possible to package a PyQt5 graphical application directly without converting to executable file format. However this requires knowledge of the package dependencies and desktop platforms. A self contained executable file that contains all the package dependencies such as Python interpreter, Qt5, PyQt5 etc can be deployed easily as a snap application.&lt;/p&gt;
&lt;h3 id=&quot;snap-snapd-and-the-snap-file-format&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#snap-snapd-and-the-snap-file-format&quot; aria-label=&quot;snap snapd and the snap file format permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Snap, Snapd and the .snap file format&lt;/h3&gt;
&lt;p&gt;Snaps can be installed and removed using the &lt;strong&gt;snap&lt;/strong&gt; command. The snap command has several uses. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;snap version&lt;/strong&gt;, shows the version of snap and snapd installed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;snap find “media player”&lt;/strong&gt; shows all snaps related to “media player”.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;snap info vlc&lt;/strong&gt;, lists information about the vlc snap that is currently installed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;sudo snap install vlc&lt;/strong&gt; installs the vlc snap from the Snap Store.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;snap list&lt;/strong&gt; displays the list of installed snaps.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;sudo snap refresh vlc&lt;/strong&gt; updates the vlc snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;sudo snap remove vlc&lt;/strong&gt; removes the vlc snap.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Snaps are published to channels depending on their development status. Snaps may be published to the following channels: &lt;strong&gt;stable, candidate, beta and edge&lt;/strong&gt;. When installing snaps, using the snap command or a Snap GUI front-end, the channel for the snap may be specified.&lt;/p&gt;
&lt;p&gt;Snaps are managed using the snapd tool. Using snapd, we can install, remove, backup and restore snaps. Snaps are automatically updated. They can also be rolled back to previous versions. A snap app is deployed in deltas, meaning that only the parts of the application that have changed are updated.&lt;/p&gt;
&lt;p&gt;A Snap app consists of a single &lt;strong&gt;.snap&lt;/strong&gt; file. All applications dependencies are contained within this file. A snap file is based on the squashfs file system. &lt;a href=&quot;https://en.wikipedia.org/wiki/Squashfs&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Squashfs&lt;/a&gt; is a compressed read-only file system used by containers such as Docker. It allows several directories to be merged and mounted as a single directory. A squashfs file may consist of several directories mounted from different locations. The contents of the file can be viewed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;unsquashfs &lt;span class=&quot;token parameter variable&quot;&gt;-l&lt;/span&gt; file-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When a Snap App is installed, it is mounted read only at the location: &lt;strong&gt;/snap/snap-name/revision/&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;developing-snaps&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#developing-snaps&quot; aria-label=&quot;developing snaps permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Developing Snaps&lt;/h3&gt;
&lt;p&gt;Snaps are developed using the snapcraft tool. Snaps can be developed on LXC/LXD containers, Docker containers or the host system. The Snapcraft tool has &lt;a href=&quot;https://snapcraft.io/docs/getting-started&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;useful documentation on creating Snaps.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The article &lt;a href=&quot;https://tutorials.ubuntu.com/tutorial/create-your-first-snap#0&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Create your first Snap&lt;/a&gt; is an excellent starting point for getting started with Snap application development. First we need to install snapcraft using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; snap &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--classic&lt;/span&gt; snapcraft&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This installs snapcraft as a snap app. The snap command requires the snapd tool. Snapd may be installed on Ubuntu using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; snapd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once the snapcraft snap has been installed, we can create a snap using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snapcraft init&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command creates a snap folder in the current directory. The snap folder has a single file called &lt;strong&gt;snapcraft.yaml&lt;/strong&gt;. This is the main configuration file for the Snap App. It contains all information that is needed to build the Snap. The end result of building a snap is a &lt;strong&gt;.snap&lt;/strong&gt; file. This file may be installed locally using the snap command or it may be published to a snap store.&lt;/p&gt;
&lt;h4 id=&quot;the-snapcraftyaml-file&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-snapcraftyaml-file&quot; aria-label=&quot;the snapcraftyaml file permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The snapcraft.yaml file&lt;/h4&gt;
&lt;p&gt;The main parts of the &lt;strong&gt;snapcraft.yaml&lt;/strong&gt; file are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt;. This is the short name of the snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;base&lt;/strong&gt;. This is the name of the base snap. The snap being built will use libraries and files provided by the base name. If the base snap is omitted, then snapcraft runs in legacy mode without new features and bug fixes. The base snap may be set to &lt;strong&gt;core&lt;/strong&gt;, which provides an Ubuntu 16.04 base. &lt;strong&gt;core18&lt;/strong&gt; provides an Ubuntu 18.04 base. &lt;strong&gt;core20&lt;/strong&gt; provides an Ubuntu 20.04 base.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;version&lt;/strong&gt;. This is the version of the snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;summary&lt;/strong&gt;. This is a short summary description of the snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;. This is the long description of the snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;grade&lt;/strong&gt;. This indicates the development status of the snap. It is set to &lt;strong&gt;devel&lt;/strong&gt; by default. When set to &lt;strong&gt;stable&lt;/strong&gt;, the snap may be published to the stable and candidate channels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;confinement&lt;/strong&gt;. This indicates the security level required to run the snap. The value &lt;strong&gt;devmode&lt;/strong&gt; provides flexible security level that is useful during development. &lt;strong&gt;strict&lt;/strong&gt; should be used for snaps that are ready to be published. &lt;strong&gt;classic&lt;/strong&gt; removes security restrictions and effectively provides device ownership to the snap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;parts&lt;/strong&gt;. A snap consists of one or more &lt;a href=&quot;https://snapcraft.io/docs/adding-parts&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;parts&lt;/a&gt;, which describe the application. For example a snap may consist of a server part which provides a daemon service or a GUI part which provides a graphical front-end. Each part contains the part name, the location of the source code for the part and a &lt;a href=&quot;https://snapcraft.io/docs/snapcraft-plugins&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;plugin&lt;/a&gt; that describes how the part should be built. For example Python applications are build using the &lt;a href=&quot;https://snapcraft.io/docs/python-apps&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;python plugin&lt;/a&gt;. A part also contains the dependencies required for building the part.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;apps&lt;/strong&gt;. The &lt;strong&gt;apps&lt;/strong&gt; section defines one or more applications. Each application has a name and a command which gives the location of the executable to run, when the command is entered. A Snap may contain several applications. Applications are run using the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snap-name.app-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If the app name is same as the snap name, then it may be run using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snap-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;building-the-snap&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#building-the-snap&quot; aria-label=&quot;building the snap permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Building the snap&lt;/h4&gt;
&lt;p&gt;After the snapcraft.yaml file has been updated, the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; snapcraft &lt;span class=&quot;token parameter variable&quot;&gt;--debug&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;should be run from the directory containing the snap folder. This command creates a &lt;strong&gt;.snap&lt;/strong&gt; file using the information given in the &lt;strong&gt;snapcraft.yaml&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;Snapcraft uses &lt;a href=&quot;https://snapcraft.io/multipass&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Multipass&lt;/a&gt; to build the snap file. Multipass is a virtual machine management system. It allows launching and managing Virtual Machines on Linux, Mac and Windows. The &lt;strong&gt;—debug&lt;/strong&gt; options causes snapcraft to open the virtual machine command prompt in case of errors. This makes it easier to debug problems.&lt;/p&gt;
&lt;p&gt;When using multipass, the first time the snap is built it takes between 15 to 20 minutes to download the virtual machine image and package dependencies. Future builds take much less time.&lt;/p&gt;
&lt;p&gt;If the snap is being built from within a LXC/LXD container, then it makes sense to build the Snap on the current system, instead of within a virtual machine running within the container. The &lt;strong&gt;—destructive-mode&lt;/strong&gt; option should be used when building snaps within LXC/LXD containers.&lt;/p&gt;
&lt;p&gt;Once the snap has been created, we can install it using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; snap &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--devmode&lt;/span&gt; snap-file-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;example-snapcraftyaml-file-for-executable-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-snapcraftyaml-file-for-executable-files&quot; aria-label=&quot;example snapcraftyaml file for executable files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example snapcraft.yaml file for executable files&lt;/h4&gt;
&lt;p&gt;A sample &lt;strong&gt;snapcraft.yaml&lt;/strong&gt; file for executable files is as follows:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;name: snap-name # you probably want to &apos;snapcraft register &amp;lt;name&gt;&apos;
base: core20 # the base snap is the execution environment for this snap
version: &apos;1.2.0&apos; # just for humans, typically &apos;1.2+git&apos; or &apos;1.3.2&apos;
summary: Package summary # 79 char long summary
description: |
Package description

grade: devel # must be &apos;stable&apos; to release into candidate/stable channels
confinement: devmode # use &apos;strict&apos; once you have the right plugs and slots

layout:
  source-file-path:
    bind-file: $SNAPtarget-file-path
parts:
  # The application files      
  app-files:
    plugin: dump
    source: path-to-folder
    filesets:
       data-files:
         - data-file-path-1
         - data-file-path-2
       binaries: [&quot;bin/bin-file-name&quot;]
       desktop-files:
         - usr/share/applications/app-name.desktop
       icons:
         - usr/share/applications/app-icon.svg
    stage:
      - $data-files
      - $binaries
      - $desktop-files
      - $icons
    prime:
      - $data-files
      - $binaries
      - $desktop-files
      - $icons
    organize:         
      &quot;data/*.db&quot;: &quot;usr/local/share/&quot;  
      &quot;data/*.desktop&quot;: &quot;usr/share/applications/&quot;
      &quot;data/*.svg&quot;: &quot;usr/share/applications/&quot;
    
apps:    
  app-name:    
    extensions:
      - kde-neon
    command: bin/bin-file-name
    plugs:
    - desktop
    - desktop-legacy
    - wayland
    - unity7
    desktop: usr/share/applications/app.desktop&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above file contains all the information needed to create a snap file for a PyQt5 executable file. It may be used for any executable file that needs to run on Gnome or KDE.&lt;/p&gt;
&lt;p&gt;A typical desktop executable application consists of an executable file, desktop launcher file, application icon and data files. All these files should be placed in a single folder. The &lt;strong&gt;source&lt;/strong&gt; entry for the &lt;strong&gt;app-files&lt;/strong&gt; part should point to this folder. In the above example this folder is &lt;strong&gt;path-to-folder&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;All these files need to be copied to the correct location by the build process. This is done using the &lt;a href=&quot;https://snapcraft.io/docs/dump-plugin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;dump&lt;/a&gt; plugin. The dump plugin simply copies the contents of a file or folder from the location specified under source, to another location.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;filesets&lt;/strong&gt; entry allows us to group all project files. Each entry under &lt;strong&gt;filesets&lt;/strong&gt; is for a specific category of files. This allows us to reference all files in a category using a single key name. For example &lt;strong&gt;data-files&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;stage&lt;/strong&gt; and &lt;strong&gt;prime&lt;/strong&gt; entries are used to specify the files that should be copied over from the build stage. In the above example, we specify that the data files, binary files, icons and desktop launcher files should be copied over.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;organize&lt;/strong&gt; entry allows us to specify how the application files should be placed in the snap. In the above example, we specify that the data files in &lt;strong&gt;path-to-folder/data&lt;/strong&gt; should appear in &lt;strong&gt;usr/local/share&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;layout&lt;/strong&gt; entry allows us to specify refer to files from within our application code. In the above example &lt;strong&gt;source-file-path&lt;/strong&gt; refers to the path that is used in the source code of our application. This should be an absolute path. The &lt;strong&gt;$SNAPtarget-file-path&lt;/strong&gt; is the actual location of the file in the snap. $SNAP is an environment variable that refers to the base location within the snap.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;usr/share/applications/&lt;/strong&gt; folder is a standard location for desktop launcher files. The contents of a sample app.desktop file are:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[Desktop Entry]
Name=App Name
X-GNOME-FullName=App Name
Comment=short-description
Categories=GNOME;category-name (see: https://developer.gnome.org/menu-spec/);
Exec=snap-name.app-name
Icon=${SNAP}/usr/share/applications/app-icon.svg
Terminal=false
Type=Application
Version=1.0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;snapcraft.yaml&lt;/strong&gt; file also needs to specify the desktop environments, in which the GUI app will run. This can be done by listing the plugs required by the app. In the above example, the &lt;strong&gt;plugs&lt;/strong&gt; entry indicates that the app needs to be run on &lt;strong&gt;desktop, desktop-legacy, unity7 and wayland desktop environments&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;publishing-the-snap&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#publishing-the-snap&quot; aria-label=&quot;publishing the snap permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Publishing the snap&lt;/h4&gt;
&lt;p&gt;Once the Snap has been created and tested, it can be pushed to the &lt;a href=&quot;https://dashboard.snapcraft.io/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ubuntu Snap Store&lt;/a&gt;. In order to publish the Snap to the store, we need to first register an account. Next we need to login to the snap store from the command line using:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snapcraft login&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to register our snap using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snapcraft register snap-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to set the grade to stable in &lt;strong&gt;snapcraft.yaml&lt;/strong&gt;. Next we need to rebuild the snap using command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snapcraft&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will create a &lt;strong&gt;.snap&lt;/strong&gt; file in the current directory. After that we can push our snap to the snap store using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;snapcraft push snap-file-name &lt;span class=&quot;token parameter variable&quot;&gt;--release&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;candidate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command publishes our snap on the candidate channel. We may specify the stable channel once the snap is ready. We should then be able to install our snap from the snap store using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; snap &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; snap-name &lt;span class=&quot;token parameter variable&quot;&gt;--channel&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;candidate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this article I have described how to create a snap application for a PyQt5 executable file. Snaps are a popular application format. They allow portable distribution of applications. Snaps have several useful features such as interfaces, layouts, hooks and data snapshots. Applications deployed as snaps are secure, easy to maintain and can run on multiple platforms.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating desktop applications with Python using PyQt5]]></title><description><![CDATA[PyQt5 is a Python package that provides a wrapper for accessing the Qt framework libraries.]]></description><link>https://pakjiddat.netlify.app//posts/creating-desktop-applications-with-python-using-pyqt5</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-desktop-applications-with-python-using-pyqt5</guid><pubDate>Tue, 10 Aug 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://pypi.org/project/PyQt5/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PyQt5&lt;/a&gt; is a Python package that provides a wrapper for accessing the &lt;a href=&quot;https://en.wikipedia.org/wiki/Qt_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Qt framework libraries&lt;/a&gt;. Qt is a cross platform widget toolkit that allows creating graphical user interfaces. It supports Windows, Android, Linux and Mac. Several options exist for developing GUI applications using Python. For example &lt;a href=&quot;https://en.wikipedia.org/wiki/PySide&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Pyside&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Tkinter&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;TKinter&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/PyGTK&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PyGTK&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Kivy_(framework)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Kivy&lt;/a&gt; are Python packages for creating GUI applications&lt;/p&gt;
&lt;p&gt;The obvious benefit of desktop applications is that they allow the data to remain on the local computer. Also the desktop application is always available since it does not depend on internet connectivity. The drawback of desktop applications is that they are not as easy to access as Web based applications. For instance a desktop application needs to be installed on each computer where it is to run.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Python virtual environments are often used during development. The benefit of using virtual environments is that they allow packages to be installed independently of other virtual environments or the system wide packages. &lt;strong&gt;virtualenv&lt;/strong&gt; is a virtual environment for Python. To create a new virtual environment using virtualenv, the following command is run:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;python3 &lt;span class=&quot;token parameter variable&quot;&gt;-m&lt;/span&gt; virtualenv path-to-project&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will create a folder with standard Python libraries and binaries. This folder works as an isolatedenvironment within which Python applications can be developed. Once a virtual environment has been created, it needs to activated using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;source&lt;/span&gt; bin/activate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Packages can be installed in the virtual environment using the &lt;strong&gt;pip&lt;/strong&gt; package manager. To install the PyQt5 package, we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pip &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; PyQt5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To test if the PyQt5 package has been successfully installed, enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;import&lt;/span&gt; PyQt5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;from the Python shell. If the command does not give errors, then the PyQt5 has been successfully installed&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://pypi.org/project/qt5-tools/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Qt 5 Tools&lt;/a&gt; is a package that provides tools for the Qt5 framework. It includes the Qt5 Desginer which is a graphical designer for Qt5 applications. The Qt5 tools package may be installed with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pip &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; qt5-tools&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;creating-pyqt5-applications&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-pyqt5-applications&quot; aria-label=&quot;creating pyqt5 applications permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating PyQt5 applications&lt;/h3&gt;
&lt;p&gt;Python GUI applications are run in the same way as command line applications. The main difference is that instead of output being shown on the console, a graphical window pops up. The main steps in writing a PyQt5 application are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import the &lt;strong&gt;QtWidgets&lt;/strong&gt; class using:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; PyQt5 &lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; QtWidgets&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Create an instance of the &lt;strong&gt;QMainWindow&lt;/strong&gt; class. Command line arguments are passed to the constructor.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;app &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; QtWidgets&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;QApplication&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;argv&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Create an instance of the &lt;strong&gt;QMainWindow&lt;/strong&gt; class. This is the actual user interface class.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;MainWindow &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; QtWidgets&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;QMainWindow&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Create an instance of the &lt;strong&gt;Ui_MainWindow&lt;/strong&gt; class using:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;ui &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Ui_MainWindow&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This class is used to setup the user interface class created in the previous step. This class is generated by the &lt;a href=&quot;#using-the-qt-designer&quot;&gt;pyuic5 tool&lt;/a&gt;. The &lt;strong&gt;pyuic5 tool&lt;/strong&gt; is used to generate python code from the user interface class created by the Qt Designer. The following code is used to setup the MainWindow class:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;ui&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;setupUi&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MainWindow&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;The next step is to create an instance of your own class. As an example the class can be named &lt;strong&gt;Ui_Manager&lt;/strong&gt;. This class is used to setup event handlers for the graphical components. The constructor of this class may take the ui object as parameter.&lt;/li&gt;
&lt;li&gt;The next step is to display the window using: &lt;strong&gt;MainWindow.show()&lt;/strong&gt;. This method blocks until the user closes the application.&lt;/li&gt;
&lt;li&gt;The final step is to call: &lt;strong&gt;sys.exit(app.exec_())&lt;/strong&gt;. This will end the application&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The GUI related code is usually auto generated using the Qt Desginer and pyuic5. We need to keep our custom code such as event handling code separate from the auto generated GUI code. Otherwise the custom code can get overwritten. The benefit of this approach is that it separates the users custom graphics code from the auto generated code. The following code shows the &lt;strong&gt;“main”&lt;/strong&gt; function of a typical PyQt5 application:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; __name__ &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;    
    app        &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; QtWidgets&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;QApplication&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;argv&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    MainWindow &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; QtWidgets&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;QMainWindow&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    ui         &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Ui_MainWindow&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    ui&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;setupUi&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MainWindow&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    ui_manager &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Ui_Manager&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    ui_manager&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;initialize_ui&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ui&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    MainWindow&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;show&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    sys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exit&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;app&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exec_&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;using-the-qt-designer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-the-qt-designer&quot; aria-label=&quot;using the qt designer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using the Qt Designer&lt;/h3&gt;
&lt;p&gt;The Qt Designer allows generating user interface for Qt5 applications. It allows user interfaces to be created by dragging and dropping widgets. It supports several widgets such as &lt;strong&gt;ComboBoxes, Lists, Tables, Buttons, Labels&lt;/strong&gt; and more. It supports four types of layouts which are &lt;strong&gt;Horizontal Layout, Vertical Layout, Grid Layout and Form Layout&lt;/strong&gt;. These layouts allow widgets to be arranged correctly.&lt;/p&gt;
&lt;p&gt;Each user interface created in the Qt Designer is saved in XML format as a single file with &lt;strong&gt;.ui&lt;/strong&gt; extension. Each &lt;strong&gt;.ui&lt;/strong&gt; file need to be converted to Python code. This can be done using the &lt;strong&gt;pyuic5&lt;/strong&gt; tool. For example the following command creates a Python file from a &lt;strong&gt;.ui&lt;/strong&gt; file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pyuic5 ui-file.ui &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; ui-file.py&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The generated Python file can be run using &lt;code class=&quot;language-text&quot;&gt;python3 ui-file.py&lt;/code&gt;. This will run the GUI application. The application should look exactly like the preview in the Qt Designer.&lt;/p&gt;
&lt;p&gt;The PyQt5 framework provides classes in Python for creating desktop applications. It provides classes for widgets. For example the &lt;strong&gt;QApplication&lt;/strong&gt; class implements the main window class. Classes such as &lt;strong&gt;QLabel&lt;/strong&gt; and &lt;strong&gt;QPushButton&lt;/strong&gt; implement labels and buttons.&lt;/p&gt;
&lt;h3 id=&quot;generating-executable-files-using-pyqtdeploy&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-executable-files-using-pyqtdeploy&quot; aria-label=&quot;generating executable files using pyqtdeploy permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating executable files using pyqtdeploy&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.riverbankcomputing.com/software/pyqtdeploy/intro&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;pyqtdeploy&lt;/a&gt; is a tool that allows deploying PyQt applications. It supports deploying applications to desktop platforms and mobile platforms. It supports Linux, Windows, MacOs and Android. pyqtdeploy creates a standalone binary file that can be run on the target platform.&lt;/p&gt;
&lt;p&gt;pyqtdeploy can be installed as a Python package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pip &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; pyqtdeploy&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It requires PyQt5 and Python 3.5 and later. A useful way to learn about pyqtdeploy is to deploy the &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/demo.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;demo application&lt;/a&gt; that is packaged with pyqtdeploy. The demo application is a simple application written using PyQt5 and Python. The documentation for the demo application describes how to build the application on the target platform.&lt;/p&gt;
&lt;p&gt;Generating a standalone binary file using pyqtdeploy requires the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Identify the PyQt modules and other third party components that are required by the application. These components are specified in the &lt;strong&gt;sysroot.json&lt;/strong&gt; file. The sysroot.json file that is provided with the demo application is a good starting point.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The systemroot contains the Python libraries and third part components required by the application. The document &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/sysroot.html#ref-building-a-sysroot&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Building a System Root Directory&lt;/a&gt; describes how to build a sysroot. Building a sysroot can take several hours depending on the components selected. The system root is then built using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pyqtdeploy-sysroot  &lt;span class=&quot;token parameter variable&quot;&gt;--sysroot&lt;/span&gt; sysroot-linux-64/ --source-dir lib &lt;span class=&quot;token parameter variable&quot;&gt;--verbose&lt;/span&gt;  sysroot.json&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;pyqtdeploy-sysroot&lt;/strong&gt; command is part of the pyqtdeploy package.&lt;/p&gt;
&lt;p&gt;Building a sysroot causes the components specified in sysroot.json to be compiled. Qt5, Python interpreter, Sip and PyQt5 are core components and need to listed in sysroot.json. SSL and Zlib are optional components.&lt;/p&gt;
&lt;p&gt;Compiling Qt5 requires certain packages. The article &lt;a href=&quot;https://doc.qt.io/qt-5/linux-requirements.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Qt for X11 Requirements&lt;/a&gt; describes the dependency packages that are required for building Qt5 from source. For example on Ubuntu the dependencies may be installed with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; build-dep qt5-default&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that this command requires source entries in the &lt;strong&gt;/etc/apt/sources.list&lt;/strong&gt; file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The next step is to create a project file that identifies the application source code and all the components used by the application. The project file has a &lt;strong&gt;.pdy&lt;/strong&gt; file extension. It can be created using the &lt;strong&gt;pyqtdeploy&lt;/strong&gt; command. This command opens a graphical application that allows generating the project file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example the command: &lt;strong&gt;pyqtdeploy pyqt-demo.pdy&lt;/strong&gt; allows editing project file for the demo application. The document &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/pyqtdeploy.html#ref-creating-a-project&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Creating a pyqtdeploy Project&lt;/a&gt; describes how to create a pyqtdeploy project.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The next step is to freeze the Python modules and generate a &lt;strong&gt;.pro&lt;/strong&gt; file. This can be done using the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pyqtdeploy-build &lt;span class=&quot;token parameter variable&quot;&gt;--sysroot&lt;/span&gt; sysroot-linux-64/  &lt;span class=&quot;token parameter variable&quot;&gt;--verbose&lt;/span&gt; pyqt-demo.pdy&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The article &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/building.html#ref-building-an-application&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Building the Application&lt;/a&gt; describes how to do generate the &lt;strong&gt;.pro&lt;/strong&gt; file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The next step is to generate the &lt;strong&gt;MakeFile&lt;/strong&gt; using the qmake command. This can be done using the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;path-to-qmake&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; pyqt-demo.pro&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command should be run from the target build directory which was generated during the previous step. The &lt;strong&gt;path-to-qmake&lt;/strong&gt; is the absolute path to the qmake binary file within the sysroot. This is usually &lt;strong&gt;sysroot-linux-64/Qt/bin/qmake&lt;/strong&gt;. Once the MakeFile has been generated, the next step is to generate the executable file using the command: &lt;strong&gt;make&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this article I have described my experience with creating graphical applications using the PyQt5 framework and deploying the graphical applications using &lt;strong&gt;pyqtdeploy&lt;/strong&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Islam Companion]]></title><description><![CDATA[The Islam Companion project is a desktop application. It is available as a snap application on Ubuntu Store. It allows users to read Holy Quran and Hadith. It provides two applications. A Hadith reader and a Quran reader.]]></description><link>https://pakjiddat.netlify.app//posts/islam-companion</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/islam-companion</guid><pubDate>Tue, 10 Aug 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 748px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/b7da167c6d12debdc92aff487e784039/f8915/islamcompanion.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 84.58333333333331%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAACEUlEQVR42qVUyW7bMBDVZwWNLffUY1rU7bH/bbhRLGuz9oVaqcWvM4ylBFlaIyXwQA418zTDWbRPNzdgrFerV1jd3uLr3R1+br/jx3aLb3TWV2vo6zU2DF1Xejphs/mMX190aLvdDveGgTiOEUWRQhAEC8IwREQIL7BtG67nwXUdWJYF3/ef9OmsWdYRpmmqi9PpBI+Q5TmEEApFUSjkBJaVLhG7rgvzYCoHZp2CvmtMYhj3OBwOeHgw6GwgyzJUVYWyLBewzGDSeS+rEnESq+9ZliNNU2ht24LX+XzGW2u+Zz2OIifveWfjsiDCMEZd1ZBSIkkSaE3TLIYz3lrDOCojKTuMw4i2axGWIYIigBwletk/Ev7Lw2maMBLZOAxPOrT1g4QnPHilh2ZoriPM84wePVQPP2czDKNLxiOIVCAJE7R1C9nL6zx8bw3TAL+mn9QB2rG9PuT3EiVKASdxcAyOKJsSff8fhJwczrIoqFZzgYHed8nyR0Pupx5mcYRd2qjHGk3dqG77sIePrRqrZHXEwcX+V8Ln8sv6nMYJTdsgqzKkIoWkEloI58LmentJwm/DNTjLs840ndFTMR8LC7agkIdadUsUR9C6rnvlERtyOI7jkFKs6pGHQRCEy2RhbwS1XhREFHJHfX3xcL/fq6Gw3/+Gf/JR17VqfB4QxWXC8Dm9yPM993SapSrbi5ym+APhwvlj5P2dagAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/b7da167c6d12debdc92aff487e784039/8ac56/islamcompanion.webp 240w,
/static/b7da167c6d12debdc92aff487e784039/d3be9/islamcompanion.webp 480w,
/static/b7da167c6d12debdc92aff487e784039/0bb9d/islamcompanion.webp 748w&quot;
              sizes=&quot;(max-width: 748px) 100vw, 748px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/b7da167c6d12debdc92aff487e784039/8ff5a/islamcompanion.png 240w,
/static/b7da167c6d12debdc92aff487e784039/e85cb/islamcompanion.png 480w,
/static/b7da167c6d12debdc92aff487e784039/f8915/islamcompanion.png 748w&quot;
            sizes=&quot;(max-width: 748px) 100vw, 748px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/b7da167c6d12debdc92aff487e784039/f8915/islamcompanion.png&quot;
            alt=&quot;Islam Companion&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Islam Companion&lt;/strong&gt; project is a desktop application. It is availabe as a snap application on &lt;a href=&quot;https://snapcraft.io/islamcompanion&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ubuntu Store&lt;/a&gt;. It allows users to read Holy Quran and Hadith. It provides two applications. A Hadith reader and a Quran reader.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The Quran text can be read in 43 languages. These are: &lt;strong&gt;Amharic, Arabic, Azerbaijani, Bosnian, Bengali, Bulgarian, Amazigh, Czech, German, Divehi, Spanish, English, Persian, French, Hindi, Hausa, Indonesian, Italian, Japanese, Korean, Kurdish, Malayalam, Malay, Dutch, Norwegian, Portuguese, Polish, Russian, Romanian, Swedish, Somali, Sindhi, Albanian, Swahili, Turkish, Tajik, Tamil, Tatar, Thai, Uzbek, Urdu, Uyghur and Chinese.&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Hadith text can be read in Urdu, English and Arabic languages.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The Islam Companion has the following limitations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The text for some languages may be difficult to read because of font size.&lt;/li&gt;
&lt;li&gt;The hadith text in English language is a rough translation and may contain grammatical errors.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The Islam Companion application may be downloaded from the Ubuntu Snap Store.&lt;/p&gt;
&lt;iframe src=&quot;https://snapcraft.io/islamcompanion/embedded?button=black&quot; frameborder=&quot;0&quot; width=&quot;100%&quot; height=&quot;370px&quot; style=&quot;border: 1px solid #CCC;border-radius: 2px;width: 50%;left: 16%;position: relative;&quot;&gt;&lt;/iframe&gt;
&lt;h3 id=&quot;development&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#development&quot; aria-label=&quot;development permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Development&lt;/h3&gt;
&lt;p&gt;For details on how to develop the Islam Companion application refer to the &lt;a href=&quot;https://github.com/pakjiddat/islam-companion&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GitHub repository&lt;/a&gt; for the project.&lt;/p&gt;
&lt;h3 id=&quot;acknowledgements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#acknowledgements&quot; aria-label=&quot;acknowledgements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Acknowledgements&lt;/h3&gt;
&lt;p&gt;The purpose of the Islam Companion project is to allow users to read the Holy Quran and Hadith text in their own language.&lt;/p&gt;
&lt;p&gt;The following resources were used in the development of the project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Translations of the Quran were obtained from: &lt;a href=&quot;https://tanzil.net/trans/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://tanzil.net/trans/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Translations of the Hadith were obtained from: &lt;a href=&quot;http://www.hadithcollection.com/downloads.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://www.hadithcollection.com/downloads.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Icons were obtained from: &lt;a href=&quot;https://www.iconfinder.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.iconfinder.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Banner image was obtained from: &lt;a href=&quot;https://pixabay.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://pixabay.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Language fonts were obtained from:
&lt;ul&gt;
&lt;li&gt;Persian and Uyghur: &lt;a href=&quot;https://fontlibrary.org/en/font/xb-shafigh&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://fontlibrary.org/en/font/xb-shafigh&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Sindhi: &lt;a href=&quot;https://fonts2u.com/zaheer-sindhi.font&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://fonts2u.com/zaheer-sindhi.font&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Amharic: &lt;a href=&quot;https://www.metaappz.com/References/Amharic_Fonts.aspx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.metaappz.com/References/Amharic_Fonts.aspx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Divehi: &lt;a href=&quot;https://www.fontspace.com/mv-dawlatulislam-font-f22932&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.fontspace.com/mv-dawlatulislam-font-f22932&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kurdish: &lt;a href=&quot;https://www.kurdfonts.com/font-info/609&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.kurdfonts.com/font-info/609&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The quran and hadith readers were developed using the PyQt5 framework. The applications were developed in Python language and use Sqlite3 for the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To report bugs or make feature requests, post an &lt;a href=&quot;https://github.com/pakjiddat/islam-companion/issues&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;issue&lt;/a&gt;. Constructive feedback is most welcome !.&lt;/p&gt;
&lt;h3 id=&quot;licence&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#licence&quot; aria-label=&quot;licence permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Licence&lt;/h3&gt;
&lt;p&gt;The Islam Companion project is available under the &lt;strong&gt;MIT licence&lt;/strong&gt;. You may use the application source code in your own projects.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Producer and Consumer Surplus]]></title><description><![CDATA[Producer and consumer surplus are used by economists to measure the total wealth of a society in a free market. In a free market trade is governed only by the principles of supply and demand. In this article I will describe what is meant by producer surplus, consumer surplus, total surplus, price ceiling and price floor. I will describe these terms along with examples and some related questions.]]></description><link>https://pakjiddat.netlify.app//posts/producer-and-consumer-surplus</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/producer-and-consumer-surplus</guid><pubDate>Thu, 29 Jul 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 350px; &quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 100%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAA3XAAAN1wFCKJt4AAACnElEQVR42q1VS2sTURg9mcmjeWcyyUySTpwSQ6wtLrQgUtBILVJ1UXDZXSsh0Vht3QmBgC70F7hz60JExIUiKC601pUbi1p1oaldiCBCdxp6/e7MTfMwabLwg8PcmXvvyfmeAYARQpbgwH+ykBcw+KIKSAPeiRDi/K4AvW97AGaJ8hGi4qCDCfQhDAJDJoZm03BfycFdHYP6I2jt5IHAU+AokWS+03ogfVnmgckiUBmRMLltjxO+Bk4SYZ5wjDBKcPO9plLWeDqRYioMFm0hcrTFf5LkPyHCVcinXkGeeQl59gNwgtlxItKqHdfkpg/alg6j5m3K4T/E2sNDPu5/RoT3gbPXgfkKsPDRVszVqvyMrjO/5WJTae8Y+4HxO3Jo5rOsTz2SY6cfy8qZDYSPf4F/6pscna64bh2EpzpC5zRyRhVZ3c38BwLqg1IktnJJjb8oq/GVsqKtF5TE15Ku1+avOpfz40Aa8KbocIKg9CvDw4i/vQBttYLI7ZtQ7l2DUV/EMCtAY/pzwMkQDbHBCz9hStpaUUpuXaTnspTcuCyl6ue9KkvZ+0e8NZL3Ewi3Z76n5QMgQiqHkqXKYIuErL13Vzapgvlqm1xhYt3HJoPQ3heJjFBfQuz3REcmd0jeULtRVvbRcg9hGN1blSt8VyDCJWh/pruUxQ4hKXSdozKjqh8VvdzNJnzQP5XJzTlgzb0bITcez192ph3dY6oukMvrRZ7RHkXr6ZTAY8k7iSD/Sxq+oSD88JD9UpU6+pPD2/qNNZW5OekmTasWwsb4sjoAPYZsz8yKUcfVBgjO1gummIkx3rqwOsOa5Px7RmTUFNmNCcQD9lMlgrTHPtcQZrHzhMj28ESOMCb+GgxBystlL8HViqwd44y4k/sLNpadAo7yJhwAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/9b3e0f7000e2751ffd7726fad8b2611c/8ac56/economic-surplus.webp 240w,
/static/9b3e0f7000e2751ffd7726fad8b2611c/a3432/economic-surplus.webp 350w&quot;
              sizes=&quot;(max-width: 350px) 100vw, 350px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/9b3e0f7000e2751ffd7726fad8b2611c/8ff5a/economic-surplus.png 240w,
/static/9b3e0f7000e2751ffd7726fad8b2611c/13ae7/economic-surplus.png 350w&quot;
            sizes=&quot;(max-width: 350px) 100vw, 350px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/9b3e0f7000e2751ffd7726fad8b2611c/13ae7/economic-surplus.png&quot;
            alt=&quot;Economic surplus&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;
By User:SilverStar - Own work, CC BY 2.5, &lt;a href=&quot;https://commons.wikimedia.org/w/index.php?curid=1450405&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://commons.wikimedia.org/w/index.php?curid=1450405&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/microeconomics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Microeconomics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it useful. As part of the course, we were given some practice questions related to producer and consumer surplus. In this article, I have listed these practice questions and my answers to the questions.&lt;/p&gt;
&lt;p&gt;Producer and consumer surplus are used by economists to measure the total wealth of a society in a free market. In a free market trade is governed only by the principles of supply and demand. In this article I will describe what is meant by producer surplus, consumer surplus, total surplus, price ceiling and price floor. I will describe these terms along with examples and some related questions.&lt;/p&gt;
&lt;h3 id=&quot;consumer-surplus&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#consumer-surplus&quot; aria-label=&quot;consumer surplus permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Consumer surplus&lt;/h3&gt;
&lt;p&gt;According to the Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Economic_surplus&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;consumer surplus&lt;/a&gt;, is the monetary gain obtained by consumers because they are able to purchase a product for a price that is less than the highest price that they would be willing to pay.&lt;/p&gt;
&lt;p&gt;The consumer surplus can be illustrated on a supply and demand curve. It is the area below the demand curve that is above the horizontal line that indicates the equilibrium price.&lt;/p&gt;
&lt;h3 id=&quot;producer-surplus&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#producer-surplus&quot; aria-label=&quot;producer surplus permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Producer surplus&lt;/h3&gt;
&lt;p&gt;Wikipedia defines producer surplus as the amount that producers benefit by selling at a market price that is higher than the least that they would be willing to sell for; this is roughly equal to profit (since producers are not normally willing to sell at a loss and are normally indifferent to selling at a break-even price).&lt;/p&gt;
&lt;p&gt;The producer surplus is indicated on a supply and demand curve, by the area above the supply curve that is below the horizontal line that indicates the equilibrium price.&lt;/p&gt;
&lt;h3 id=&quot;total-surplus&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#total-surplus&quot; aria-label=&quot;total surplus permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Total surplus&lt;/h3&gt;
&lt;p&gt;Total surplus is the sum of producer and consumer surplus.&lt;/p&gt;
&lt;h3 id=&quot;price-ceiling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#price-ceiling&quot; aria-label=&quot;price ceiling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Price ceiling&lt;/h3&gt;
&lt;p&gt;Price ceiling is a government intervention policy that fixes the market price to a value that is less than or equal to the ceiling price. Price ceiling affects the consumer and producer surplus and hence the total surplus.&lt;/p&gt;
&lt;h3 id=&quot;price-flooring&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#price-flooring&quot; aria-label=&quot;price flooring permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Price flooring&lt;/h3&gt;
&lt;p&gt;Price flooring is a government intervention policy that fixes the market price to a value that is more than or equal to the floor price. Price flooring affects the consumer and producer surplus and hence the total surplus.&lt;/p&gt;
&lt;h3 id=&quot;how-can-we-reduce-the-shortage-of-organs&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-can-we-reduce-the-shortage-of-organs&quot; aria-label=&quot;how can we reduce the shortage of organs permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How can we reduce the shortage of organs&lt;/h3&gt;
&lt;h4 id=&quot;background&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background&quot; aria-label=&quot;background permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;As we discussed in the lessons this module, advances in medical treatments have resulted in a dramatic increase in the number of organ transplants performed each year. A limited supply of organs, however, prevents many individuals from receiving organ replacements that could either save a life or substantially improve the recipient’s quality of life. The Organ Procurement and Transplantation Network (OPTN) reports as of today (2/6/2012) there are 117,011 patients waiting for organs and only 11,663 organ donors.&lt;/p&gt;
&lt;p&gt;In the U.S., all states have enacted a variation of the Uniform Anatomical Gift Act of 1968. Under this law, individuals are able to specify that some or all of their body may be donated after their death. The original version of this Act neither allowed, nor prohibited, the sale of human organs. The revised Uniform Anatomical Gift Act of 1987, however, prohibited the sale of human organs&lt;/p&gt;
&lt;h4 id=&quot;discussion-question&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question&quot; aria-label=&quot;discussion question permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;What type of policies would help shrink (or eliminate) the shortage of human organs? Use the concepts we learned this module to explain your answer.&lt;/p&gt;
&lt;h4 id=&quot;answer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer&quot; aria-label=&quot;answer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;The following types of policies can help to reduce shortage of human organs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Policies that promote development of artificial generation of human organs.&lt;/li&gt;
&lt;li&gt;Policies that allow human organs to be traded at a price subject to ethical rules. For example organs may be traded only if the organ donor is not alive.&lt;/li&gt;
&lt;li&gt;Policies may be formed regarding occupations that have health hazards. For example coal miners may be given the option of donating their organs in case of death during work.&lt;/li&gt;
&lt;li&gt;Policies that allow people to exchange each others organs for free or for a price. An ethical restriction could be that only those needing an organ are allowed to donate one of their other organs.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;should-we-let-price-gauging-takes-place-in-times-of-natural-disasters&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#should-we-let-price-gauging-takes-place-in-times-of-natural-disasters&quot; aria-label=&quot;should we let price gauging takes place in times of natural disasters permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Should we let price gauging takes place in times of natural disasters&lt;/h3&gt;
&lt;h4 id=&quot;background-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-1&quot; aria-label=&quot;background 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;During times of crisis, particularly natural disasters, governments enforce strict rules (and penalties) to prevent price gauging. Price gouging is a pejorative term referring to a situation in which a seller prices goods or commodities much higher than is considered reasonable or fair. So, for instance, sellers of critical necessities such as water and gasoline are not allowed to hike up their prices right after a hurricane.&lt;/p&gt;
&lt;p&gt;Nevertheless, as you learned in class, price ceilings tend to reduce social welfare by limiting the number of potential transactions. Someone has a higher incentive to load their pickup with water and drive to a hurricane-devastated area to sell it when they have the chance of charging a higher price for it.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-1&quot; aria-label=&quot;discussion question 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Do you think we should let price gauging take place in times of natural disasters? Again, please use the models and concepts discussed in the lectures to answer the question.&lt;/p&gt;
&lt;h4 id=&quot;answer-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-1&quot; aria-label=&quot;answer 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;I think price gauging should be allowed in times of natural disasters, but it should be subjected to ethical rules. Consider the following two examples:&lt;/p&gt;
&lt;h4 id=&quot;example-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-1&quot; aria-label=&quot;example 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 1&lt;/h4&gt;
&lt;p&gt;For example in case of a natural disaster the quantity supplied of goods such as rice or flour may decrease. As a result the price of the goods will increase. Many low income consumers may not be able to afford the goods. If the goods are non essential, then the consumers can simple switch to a substitute good.&lt;/p&gt;
&lt;p&gt;But if the goods are essential, such as water or some other good for which a substitute is not easily available, then the government should intervene and impose a price ceiling for the goods, so that it can be afforded by all.&lt;/p&gt;
&lt;h4 id=&quot;example-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-2&quot; aria-label=&quot;example 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 2&lt;/h4&gt;
&lt;p&gt;Consider another example. A disease breaks out in a country and the price of medicine or protective equipment increases. People are willing to pay more for the medicine and protective equipment. Also more people will want to buy. Sellers will sense this and will want to charge more. They should have the freedom to increase the price in order to satisfy the increase in demand for the medicine and protective equipment.&lt;/p&gt;
&lt;p&gt;Because of the increase in demand, the demand curve will shift upwards and to the right. Because of this a new equilibrium price and quantity needs to be established, which will be at the intersection of the supply curve and the new demand curve. At this new equilibrium point, the sum of producer and consumer surplus, which is the total economic surplus is maximized.&lt;/p&gt;
&lt;p&gt;The amount charged by sellers in many cases is not fair. For example misinformation can cause sellers to over price or under price an item. Also the price charged by sellers may be influenced by other factors such as their individual financial conditions or societal pressures. As a result supplier may not be able to correctly assess the demand for the goods.&lt;/p&gt;
&lt;p&gt;As a result the amount charged by sellers may be fixed by local trade unions or the government. For example the government may impose a price ceiling on the sale of the medicine and protective equipment.&lt;/p&gt;
&lt;p&gt;Although the intention of the price ceiling is to make the goods available for all, it has the adverse affect that the producer’s surplus is reduced because they are being forced to sell at a lower price. If the seller is not happy, then the total economic welfare is reduced and society as a whole does not gain from the price ceiling.&lt;/p&gt;
&lt;p&gt;I think these days the goods consumed by a country are produced all over the world, so there is no direct connection between producers and consumers. The quantity and price of supplied items depends on international trade. Governments can only influence their own producers, but not those of other countries. In case of natural disasters, having good international relations with other countries can be useful.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-so-hard-to-find-a-cab-in-high-crime-neighborhoods&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-is-it-so-hard-to-find-a-cab-in-high-crime-neighborhoods&quot; aria-label=&quot;why is it so hard to find a cab in high crime neighborhoods permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why is it so hard to find a cab in high crime neighborhoods&lt;/h3&gt;
&lt;h4 id=&quot;background-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-2&quot; aria-label=&quot;background 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Cab fares are usually regulated in most cities. For instance, in Chicago, where I live, cab drivers are not allowed to charge more than $2.25 for the first 1/9 mile, and $0.20 for each additional 1/9 mile. So, in effect, the city of Chicago imposes a price ceiling on the price of cab fares.&lt;/p&gt;
&lt;p&gt;Nevertheless, as you learned in class, price ceilings tend to reduce social welfare by limiting the number of potential transactions.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-2&quot; aria-label=&quot;discussion question 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Do you think there is a relationship between the price ceiling for cab fares and the fact that it is very difficult to find cabs in high crime neighborhoods? Again, please use the models and concepts discussed in the lectures to answer the question.&lt;/p&gt;
&lt;h4 id=&quot;answer-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-2&quot; aria-label=&quot;answer 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;In high crime neighborhoods, it is not easy for people to negotiate a price due to volatile economic conditions. An effective way to maximum welfare in society is to use price ceilings. When a price ceiling is in affect, both suppliers and consumers are aware of the market price before the transaction. There is less chance of disagreement, which can lead to crimes.&lt;/p&gt;
&lt;h3 id=&quot;why-do-we-only-get-peanuts-on-us-flights&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-do-we-only-get-peanuts-on-us-flights&quot; aria-label=&quot;why do we only get peanuts on us flights permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why do we only get peanuts on U.S. flights&lt;/h3&gt;
&lt;h4 id=&quot;background-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-3&quot; aria-label=&quot;background 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;People always complain about the lack of complimentary meals in flights. And older people always tell stories of how in the “good old days” airlines used to serve full meals for free on their flights, and they also had more leg room between seats. But, also in the good old days airlines did not have much control over the price they charged for their flights. The U.S. government had strict regulations over the airline industry, including how much they could charge fliers. During those times it was hard for an airline to lower their prices without first getting permission from governmental authorities. So, in effect, the government used to impose a price floor on the market for air fare.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-3&quot; aria-label=&quot;discussion question 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Do you think there is a relationship between the price floor and the fact that today airlines offer fewer amenities than before? Furthermore, do you think air travel is better now (with fewer amenities) than before? Again, please use the models and concepts discussed in the lectures to answer the question.&lt;/p&gt;
&lt;h4 id=&quot;answer-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-3&quot; aria-label=&quot;answer 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;Assuming that the price floor is less than the equilibrium price, having a price floor means supplier can continue to provide the airline service at the same equilibrium price. Hence producer surplus is not affected by the price floor.&lt;/p&gt;
&lt;p&gt;Consumer surplus may decrease because some consumers may not be willing to pay at prices equal to or more than the price floor. So demand for airline travel will decrease. To increase demand for airline travel, airlines may adopt strategies such as serving full meals for free and providing more leg room between seats. As a result, consumers will be willing to pay more for airline travel. This may explain why airlines offered complimentary meals on flights in the “good old days”.&lt;/p&gt;
&lt;p&gt;I think airlines fares these days is much cheaper than it used to be. As a result consumer surplus is high and there is no need to provide extra amenities on flights such as complimentary meals.&lt;/p&gt;
&lt;h3 id=&quot;why-would-an-increase-in-the-minimum-wage-lead-to-less-unemployment&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-would-an-increase-in-the-minimum-wage-lead-to-less-unemployment&quot; aria-label=&quot;why would an increase in the minimum wage lead to less unemployment permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why would an increase in the minimum wage lead to less unemployment&lt;/h3&gt;
&lt;h4 id=&quot;background-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-4&quot; aria-label=&quot;background 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;In class this module we presented the traditional textbook explanation of the minimum wage. The minimum wage is a price floor that tends to increase unemployment by encouraging more workers to enter the labor force to compete for fewer jobs. Nevertheless, this theory has not been so easy to prove by looking at the data. Some studies, in fact, have proven it, but others have not. In fact, some studies have suggested an increase in the minimum wage could lead to less, not more unemployment.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-4&quot; aria-label=&quot;discussion question 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;How could a price floor such as the minimum wage lead to less, not more, unemployment? Again, please use the models and concepts discussed in class to answer the question, and for purposes of this discussion, completely refrain from any moral or ethical arguments.&lt;/p&gt;
&lt;h4 id=&quot;answer-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-4&quot; aria-label=&quot;answer 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;Unemployment implies a difference in demand for jobs and jobs available. In other words, there is a difference in quantity demanded and quantity supplied, which means that the market for jobs is not operating at the equilibrium point.&lt;/p&gt;
&lt;p&gt;If the current price or wages are below the equilibrium point, then a price floor that is above the current market price but below the equilibrium price will result in a smaller difference in jobs demanded and jobs supplied. Hence there will be less unemployment.&lt;/p&gt;
&lt;h3 id=&quot;should-you-stand-in-the-line-or-pay-someone-to-do-it-for-you&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#should-you-stand-in-the-line-or-pay-someone-to-do-it-for-you&quot; aria-label=&quot;should you stand in the line or pay someone to do it for you permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Should you stand in the line or pay someone to do it for you&lt;/h3&gt;
&lt;h4 id=&quot;background-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-5&quot; aria-label=&quot;background 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;National Public Radio, NPR, reported the case of a person in China that earns his living by waiting in line for other people.&lt;/p&gt;
&lt;p&gt;He is a “professional queuer”. Last year, when Apple introduced its iPad Mini, news reported many instances where some people had paid others to stand in line for them to buy the iPad. For instance, in one high profile case, a man made $1,500 waiting in line to buy the iPad for someone else.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-5&quot; aria-label=&quot;discussion question 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Do you think these type of transactions increase or decrease social welfare? Suppose the government makes these types of transactions (charging someone to wait in line for them). Which groups in society are bound to lose the most as a result of this law?&lt;/p&gt;
&lt;h4 id=&quot;answer-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-5&quot; aria-label=&quot;answer 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;I think these type of transactions decrease social welfare. If the supplier had directly received the additional amount that the consumer was willing to spend, then the supplier would have increase the price of the item, which would increase the supplier surplus. An increase in the supplier’s surplus would increase the total economic surplus.&lt;/p&gt;
&lt;p&gt;If the government passed a law making it illegal to pay someone else to stand in line, then this would adversely affect people who are mentally or physically incapable of standing in line, such as disabled people. It will also adversely affect unskilled people who can earn money by standing in line for other people.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Counting problems]]></title><description><![CDATA[Combinatorics is a field of Mathematics that allows us to efficiently count numbers. It includes topics such as probabilities, permutations and combinations. It has applications in many areas outside Mathematics. In this article I will describe some problems related to Combinatorics.]]></description><link>https://pakjiddat.netlify.app//posts/counting-problems</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/counting-problems</guid><pubDate>Mon, 26 Jul 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/combinatorics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Combinatorics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt;. The course provides useful knowledge about counting and probabilities. I found the course very useful and interesting. In this article I will describe some problems that were given to the students to solve.&lt;/p&gt;
&lt;p&gt;Combinatorics is a field of Mathematics that allows us to efficiently count numbers. It includes topics such as probabilities, permutations and combinations. It has applications in many areas outside Mathematics. In this article I will describe some problems related to Combinatorics.&lt;/p&gt;
&lt;p&gt;Problems related to permutations and combinations can be grouped as ordered or unordered. They may or may not involve repetitions. There are four main categories of problems. These are ordered with repetitions, ordered without repetitions, unordered with repetitions and unordered without repetitions. For each category there is a formula, which can be used to solve the problem.&lt;/p&gt;
&lt;p&gt;Combinations are arrangement of unordered items. They may or may not involve repetitions. Permutations are arrangement of ordered items without repetitions. Tuples are arrangement of items with repetitions.&lt;/p&gt;
&lt;p&gt;The formula for combinations without repetitions is &lt;strong&gt;n!/k!*(n-k)!&lt;/strong&gt;, where n is the number of items and k is the number of selections. The formula for combinations is often stated as n choose k.&lt;/p&gt;
&lt;p&gt;The formula for combinations with repetitions is &lt;strong&gt;(n+k-1)!/(n-1)!*(k)!&lt;/strong&gt;, where n is the number of items and k is the number of selections.&lt;/p&gt;
&lt;p&gt;The formula for permutations is &lt;strong&gt;n!/(n-k)!&lt;/strong&gt;, where n is the number of items and k is the number of selections.&lt;/p&gt;
&lt;p&gt;The formula for tuples is &lt;strong&gt;n^k&lt;/strong&gt;, where n is the number of items and k is the number of selections.&lt;/p&gt;
&lt;h3 id=&quot;problem-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-1&quot; aria-label=&quot;problem 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem 1&lt;/h3&gt;
&lt;p&gt;How many binary strings of length 6 can be created containing equal number of 0s and 1s.&lt;/p&gt;
&lt;p&gt;The binary string of length 6 can be regarded as 6 distinct positions or indexes. These need to be selected 3 at a time. There are 3 selections and 6 items. The indexes are unique so there are no repetitions. Also the selection of the index numbers is unordered. So we can use the formula for combinations without repetitions, which is &lt;strong&gt;n!/k!*(n-k)!&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This is equal to &lt;strong&gt;6!/3!*(6-3)!&lt;/strong&gt; which is equal to &lt;strong&gt;20&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The result can be verified using the following Python script. The script finds all binary numbers of length 6. For each number if the number of 0s and 1s is equal it increases the value of a counter.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;bin_comb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token triple-quoted-string string&quot;&gt;&quot;&quot;&quot;Returns the number of 6 bit binary strings that contain equal number of 
    0s and 1s.
    &quot;&quot;&quot;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;# The number of binary strings of length 6 that contain equal number of&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# zeros and ones.&lt;/span&gt;
    count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# Each number from 0 to 63 is converted to a binary string&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# Convert to binary string&lt;/span&gt;
        num &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token builtin&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;replace&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0b&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# The number is right padded so the total string length is 6&lt;/span&gt;
        num &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; num&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;zfill&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# If the number of zeros and ones is equal&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; num&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; num&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            count &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
            
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; count            
        
&lt;span class=&quot;token comment&quot;&gt;# The number of binary strings of length 6 that contain equal number of&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# zeros and ones.        &lt;/span&gt;
count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; bin_comb&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;        
&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;problem-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-2&quot; aria-label=&quot;problem 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem 2&lt;/h3&gt;
&lt;p&gt;How many 6 digit numbers are there with equal number of even and odd digits. Each digit can have a value from 0 to 9.&lt;/p&gt;
&lt;p&gt;This problem is similar to the previous problem with two main differences. First each position can be occupied by 5 values. Second a number cannot start with 0.&lt;/p&gt;
&lt;p&gt;First we consider the number of 6 digit numbers with 3 even digits and 3 odd digits. This is same as the number of binary strings of length 6 with 3 0s and 3 1s.&lt;/p&gt;
&lt;p&gt;So there are 20, 6 digit numbers with equal number of even and odd digits. However for each combination of 3 even and 3 odd digits, each digit can have 5 different values. An odd digit can have the values &lt;strong&gt;1,3,5,7,9&lt;/strong&gt; and the even digit can have the values &lt;strong&gt;0,2,4,6,8&lt;/strong&gt;. So the total number of 6 digit numbers is *&lt;em&gt;20&lt;/em&gt;(5^6)**. But this will include numbers that start with 0, which are not valid. So we need to consider the number of 6 digit numbers that start with an odd digit and the number of 6 digit numbers that start with an even digit.&lt;/p&gt;
&lt;p&gt;The number of 6 digit numbers that start with an even digit is simply 5 choose 2. This is because, the left most position is even and there are 5 positions left. 3 of these are odd and 2 are even. So the number of 6 digit numbers that start with an even digit is &lt;strong&gt;5!/3!*2!&lt;/strong&gt;. This is equal to 10. For the left most digit, there are 4 possibilities, which are &lt;strong&gt;2,4,6 and 8&lt;/strong&gt;. For the other digits there are 5 possibilities for each position. So the total count of all 6 digit numbers that start with an even digit is &lt;strong&gt;10*4*5^5 = 125000&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The number of 6 digit numbers that start with an odd digit is equal to the number of 6 digit numbers minus the number of 6 digit numbers that start with an even digit. This is equal to &lt;strong&gt;20-10 = 10&lt;/strong&gt;. Each position can have 5 different values. So the total count of all 6 digit numbers that start with an odd digit is &lt;strong&gt;10*5^6 = 156250&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The total count of all 6 digit numbers that contain 3 even digits and 3 odd digits is &lt;strong&gt;156250+125000 = 281250&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This can be verified using the following Python script. The script checks all numbers between &lt;strong&gt;100,000&lt;/strong&gt; and &lt;strong&gt;999,999&lt;/strong&gt;. For each number it counts the number of even and odd digits. If these are equal, then the script increases the value of a counter.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_even_odd_count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token triple-quoted-string string&quot;&gt;&quot;&quot;&quot;Returns the count of all 6 digit numbers with equal number of even and
    odd numbers. Each digit can have a value from 0 to 9.
    &quot;&quot;&quot;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;# The number of 6 digit numbers with equal number of even and odd digits&lt;/span&gt;
    count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# All numbers between 1000000 and 1000000 are checked&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# i is converted to string&lt;/span&gt;
        s &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# The count of even number of digits&lt;/span&gt;
        ec &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        ec &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;8&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# The count of odd number of digits&lt;/span&gt;
        oc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;7&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        oc &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;9&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;  
        &lt;span class=&quot;token comment&quot;&gt;# If the number of even and add digits is equal&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; ec &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; oc&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            count &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# print(s)&lt;/span&gt;
            
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; count
        
        
&lt;span class=&quot;token comment&quot;&gt;# The number of all 6 digit numbers with equal number of even and odd digits&lt;/span&gt;
count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; get_even_odd_count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;problem-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-3&quot; aria-label=&quot;problem 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem 3&lt;/h3&gt;
&lt;p&gt;What will the following program print?&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;n &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;
count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; j &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; k &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; j &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; j &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; k&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                count &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code should print the number of all combinations of i, j and k such that &lt;strong&gt;i &amp;#x3C; j &amp;#x3C; k&lt;/strong&gt;, where i, j and k are between 0 and 9.&lt;/p&gt;
&lt;p&gt;If we consider the following table:&lt;/p&gt;
&lt;p&gt;| i | j | k | total count |
| :--- | :--- | :--- | :--- | :---------------------- |
| 0 | (1,2,3,4,5,6,7,8) | (8,7,6,5,4,3,2,1) | 36 |
| 1 | (2,3,4,5,6,7,8) | (7,6,5,4,3,2,1) | 28 |
| 2 | (3,4,5,6,7,8) | (6, 5, 4, 3, 2, 1) | 21 |
| 3 | (4,5,6,7,8) | (5, 4, 3, 2, 1) | 15 |
| 4 | (5,6,7,8) | (4, 3, 2, 1) | 10 |
| 5 | (6,7,8) | (3, 2, 1) | 6 |
| 6 | (7, 8) | (2, 1) | 3 |
| 7 | (8) | (1) | 1 |&lt;/p&gt;
&lt;p&gt;The first column is the possible values for i. The second column contains the possible value for j for the given value of i, such that i &amp;#x3C; j. The third column contains for each value of i and j, the number of possible values for k, such that j &amp;#x3C; k. The forth column contains the total number of values for k. It is the sum of the values in the k column. The sum of the total count column is the required result.&lt;/p&gt;
&lt;p&gt;The total is &lt;strong&gt;36 + 28 + 21 + 15 + 10 + 6 + 3 + 1 = 120&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The values in the fourth column may be represented with the formula: &lt;strong&gt;sigma(1, n+k-2)&lt;/strong&gt;, where &lt;strong&gt;n = 10&lt;/strong&gt; and &lt;strong&gt;k&lt;/strong&gt; is the position number or the value of i. k has 8 values in total, which is equal to n-2. So the following formula gives the total number of combinations: &lt;strong&gt;sigma(1, n-2)sigma(1, n+k-2)&lt;/strong&gt;. Where the sigma functions are nested. This mean that each value for the outer sigma function is a value for k in the inner sigma function. n has the constant value of 10.&lt;/p&gt;
&lt;p&gt;This formula can be useful for large values of n. The following Python script uses this formula to find all combinations where &lt;strong&gt;i &amp;#x3C; j &amp;#x3C; k, for n = 1000&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;seq_sum&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token triple-quoted-string string&quot;&gt;&quot;&quot;&quot;Returns the sum of the first k natural numbers where k is from 0 to n-2.
    &quot;&quot;&quot;&lt;/span&gt;
    
    &lt;span class=&quot;token builtin&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; k &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; n&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token builtin&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; k&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;k&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;sum&lt;/span&gt;
    
&lt;span class=&quot;token comment&quot;&gt;# The value of n    &lt;/span&gt;
n &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The sum of the sequence&lt;/span&gt;
s &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; seq_sum&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The output is displayed&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;The number of combinations that satisfies i &amp;lt; j &amp;lt; k = &quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; s&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Supply and demand]]></title><description><![CDATA[The principles of supply and demand form the base of modern microeconomics. In this article I will describe the principles of supply and demand along with examples and some related questions.]]></description><link>https://pakjiddat.netlify.app//posts/supply-and-demand</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/supply-and-demand</guid><pubDate>Sat, 17 Jul 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 480px; &quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 100%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAACb0lEQVR42q1UPW/aUBR9GALYBAwBQ5zwVRUpqtUmSLTIaexaArtYQspmZamULXP3DpaaJf+gW4eMGfsHKlUdo06dqkb9EaUrt/c+nhOgfA1FOsZcno/Pvee8xxhjdYTC/uNHR+wh9hF5RAZRQ0gbPi8j0tOFOBWep9O1oaoWXhaL2TNNe7wBUYwulcqbsqrWC9M1TghhmPjd61V2GMt9aLWMzcRBrNeDShiCNK+QZLORbeuhriuXzWYDTk+z6+i63XGu34fifP2eEDodBY6Py4DSwXX3YOUcIWbboDsOJJYS8mXYNpimPO52c9Dv87eDmE1ERNfhEAqWBYVFr5olNIwkYOtcpePsEvn8A74/Tg0GoEfkqwj5AiTKkzr8TvDWgyB+/0KYtEqky4YRXxRs8LwyEm7TXEekVKjxPCi7LqirzMoIMBFmejB2g6r+mOb+uNVK3bmuCo5eOnIgb76GnXXuP0EcirYloZgg3eA87zondXBY4p19/ejjq6tnkUGzRv1LWEUkp8gIFAfpO5Jen7w/emvf6r8auAEGaJgZPJi4gFiemqFoOeT5o4wd4sys9hdt9ELb/UxmkfuWpYHva5SItbGJPjj8DLkZBMBHEeC6nxR6IsPfY99P8XuqeV4GLi62FhIaBiTJSVRXetgFTiIU88UIyTyfZBQax6NFyi2rMHPa0AYnEky/dn4O6UVdGJM5MxH6ba6O8kpqw1CayWGnc6scHHzNRrFhLJg3qIng/weTGguR5BPm9Ae2/q3d1rC0Fe0ORRySmP6qLEYgTxlWEyd7I6rjvlOqk/uUIMohnm56qtN8SEFp2QIx49pfFfa4dRRko+MAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/9b5ed4d38a98ba7301d5c548990ed4e6/8ac56/supply-and-demand.webp 240w,
/static/9b5ed4d38a98ba7301d5c548990ed4e6/d3be9/supply-and-demand.webp 480w&quot;
              sizes=&quot;(max-width: 480px) 100vw, 480px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/9b5ed4d38a98ba7301d5c548990ed4e6/8ff5a/supply-and-demand.png 240w,
/static/9b5ed4d38a98ba7301d5c548990ed4e6/e85cb/supply-and-demand.png 480w&quot;
            sizes=&quot;(max-width: 480px) 100vw, 480px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/9b5ed4d38a98ba7301d5c548990ed4e6/e85cb/supply-and-demand.png&quot;
            alt=&quot;Supply and Demand&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;
By Paweł Zdziarski (faxe), Astarot - Own work, CC BY-SA 3.0, &lt;a href=&quot;https://commons.wikimedia.org/w/index.php?curid=741993&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://commons.wikimedia.org/w/index.php?curid=741993&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/microeconomics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Microeconomics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it useful. As part of the course, we were given some practice questions related to supply and demand. In this article, I have listed these practice questions and my answers to the questions.&lt;/p&gt;
&lt;p&gt;The principles of supply and demand form the base of modern microeconomics. In this article I will describe the principles of supply and demand along with examples and some related questions.&lt;/p&gt;
&lt;h3 id=&quot;law-of-supply&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#law-of-supply&quot; aria-label=&quot;law of supply permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Law of supply&lt;/h3&gt;
&lt;p&gt;According to Wikipedia the &lt;a href=&quot;https://en.wikipedia.org/wiki/Supply_(economics)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;law of supply&lt;/a&gt; states that assuming all other factors are constant, an increase in the price of items supplied leads to an increase in quantity supplied.&lt;/p&gt;
&lt;h3 id=&quot;law-of-demand&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#law-of-demand&quot; aria-label=&quot;law of demand permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Law of demand&lt;/h3&gt;
&lt;p&gt;According to Wikipedia the &lt;a href=&quot;https://en.wikipedia.org/wiki/Demand&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;law of demand&lt;/a&gt; states that assuming all other factors are constant, an increase in the price of items leads to a decrease in quantity demanded.&lt;/p&gt;
&lt;h3 id=&quot;the-supply-curve&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-supply-curve&quot; aria-label=&quot;the supply curve permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The supply curve&lt;/h3&gt;
&lt;p&gt;The supply curve shows the variation of item price (y-axis) and quantity supplied (x-axis). The term “supply” refers to the state of the supply curve and is different from quantity supplied. For example if the supply of an item goes up, then for the same price, the quantity supplied is more. Hence the supply curve shifts to the right. If the supply decreases, then for the same price the quantity supplied is less. Hence the supply curve shifts to the left.&lt;/p&gt;
&lt;h3 id=&quot;the-demand-curve&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-demand-curve&quot; aria-label=&quot;the demand curve permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The demand curve&lt;/h3&gt;
&lt;p&gt;The demand curve shows the variation of item price (y-axis) and quantity demanded (y-axis). This term “demand” refers to the state of the supply curve and is different from quantity demanded. For example if the demand for an item goes up, then at the same price the quantity demanded is more. Hence the demand curve shifts to the right. If the demand decreases, then for the same price the quantity demanded is less. Hence the demand curve moves to the left.&lt;/p&gt;
&lt;h3 id=&quot;why-is-it-so-hard-to-find-good-math-and-science-teachers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-is-it-so-hard-to-find-good-math-and-science-teachers&quot; aria-label=&quot;why is it so hard to find good math and science teachers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why is it so hard to find good math and science teachers&lt;/h3&gt;
&lt;h4 id=&quot;background&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background&quot; aria-label=&quot;background permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;One of the major problems in public education in the U.S. is the shortage of science and math teachers. Could we explain this shortage using the supply and demand model?. We might, if we recognize the supply for teachers depends on the opportunity cost for working.&lt;/p&gt;
&lt;p&gt;Remember that everything has a cost. The opportunity cost of your time working as a teacher is the salary you could make working somewhere else. Therefore, the larger the salary you could make working somewhere else, the larger your opportunity cost of working as a public school teacher. Salaries in math and science are usually higher than salaries in other disciplines such as humanities and the social sciences. Therefore, a person with a degree in math and science typically gives up a much larger salary to teach than a person teaching in a different discipline.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question&quot; aria-label=&quot;discussion question permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use a supply and demand diagram to illustrate how this higher opportunity cost for math and science teachers creates a shortage of them.&lt;/p&gt;
&lt;h4 id=&quot;answer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer&quot; aria-label=&quot;answer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;A higher price implies that there is more competition and teaching standards for math and science teachers goes up and hence there are fewer people who can meet the new standards. As a result there is a decrease in the supply of math and science teachers. This could be prevented by reducing the opportunity cost for math and science teachers.&lt;/p&gt;
&lt;h3 id=&quot;where-did-all-the-farmers-go&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#where-did-all-the-farmers-go&quot; aria-label=&quot;where did all the farmers go permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Where did all the farmers go&lt;/h3&gt;
&lt;h4 id=&quot;background-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-1&quot; aria-label=&quot;background 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;In the 1950’s about 17% of the labor force in the U.S. worked on farms. More than fifty years later, in 2004, that percentage was only 3%. What happened? Why did people stop farming in the U.S.? One explanation has to do with increases in productivity in farming.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-1&quot; aria-label=&quot;discussion question 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use a supply and demand diagram to explain how increases in productivity in farming creates an incentive for farmers to leave farming.&lt;/p&gt;
&lt;h4 id=&quot;answer-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-1&quot; aria-label=&quot;answer 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;Increase in productivity implies improvement in technology. This results in a right shift of the supply curve. It means that at the same price the quantity supplied is more, which implies that the cost of production decreases. A decrease in cost of production means that laborers are payed less. Hence fewer people will want to work on farms.&lt;/p&gt;
&lt;p&gt;A lower cost of production implies it costs less to produce and hence the price of items sold by farmers would decrease. A decrease in price would mean farmers will earn less income. Hence they would be encouraged to leave farming.&lt;/p&gt;
&lt;h3 id=&quot;why-are-people-moving-back-downtown&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-are-people-moving-back-downtown&quot; aria-label=&quot;why are people moving back downtown permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why are people moving back downtown&lt;/h3&gt;
&lt;h4 id=&quot;background-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-2&quot; aria-label=&quot;background 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;In the U.S. people are moving back downtown. Cities such as Chicago have seen a boom of residential real estate development in their downtown areas. Take a drive around the South Loop (as the south part of Chicago’s downtown is known), and you will see plenty of building cranes. Why is this?&lt;/p&gt;
&lt;p&gt;Interestingly enough, one reason may have to do with the increase in online shopping. As people continue to get their shopping done online, large retailers have been closing their stores in the downtown areas. This has increased the availability of real estate in those areas.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-2&quot; aria-label=&quot;discussion question 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use a supply and demand diagram to explain how the increase in online shopping has created an incentive for people to move back downtown.&lt;/p&gt;
&lt;p&gt;An increase in online shopping would mean there is less demand for retail shops. As a result the prices of items sold at retails shops will increase. This will further discourage people from buying from retail shops.&lt;/p&gt;
&lt;p&gt;Fewer retails shops implies more space for buildings such as schools, residential buildings, offices etc. This will encourage more people to move downtown.&lt;/p&gt;
&lt;p&gt;An increase in residential buildings usually means a decrease in house prices. A decrease in price results in an increase in quantity demanded. So more there will be more incentive for people to move downtown.&lt;/p&gt;
&lt;h3 id=&quot;why-would-more-drug-enforcement-of-illegal-drug-lords-lead-to-more-crime&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-would-more-drug-enforcement-of-illegal-drug-lords-lead-to-more-crime&quot; aria-label=&quot;why would more drug enforcement of illegal drug lords lead to more crime permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why would more drug enforcement of illegal drug lords lead to more crime&lt;/h3&gt;
&lt;h4 id=&quot;background-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-3&quot; aria-label=&quot;background 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;For the last 40 years, the U.S. has been fighting a war against illegal drugs. The major targets have been marijuana, cocaine, heroine, and, most recently, new drugs such as ecstasy and meth. The goal of this “war” has been to reduce the supply of these drugs coming to the country by either seizing the drugs or by incarcerating those involved in the illegal market. Paradoxically, many argue that this increase in enforcement has led to an increase in the crime associated with the use and distribution of these drugs. Why?&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-3&quot; aria-label=&quot;discussion question 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use a supply and demand diagram to explain how an increase in drug enforcement could lead to an increase in crime.&lt;/p&gt;
&lt;h4 id=&quot;answer-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-2&quot; aria-label=&quot;answer 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;If the supply of drugs decreases, then the supply curve would move left. A decrease in the supply of drugs means people will be willing to pay more for drugs. So the price of drugs will increase. Less users will be able to pay for drugs so people will be more likely to commit crimes in order to pay for drugs.&lt;/p&gt;
&lt;h3 id=&quot;why-has-the-price-of-oil-increased-in-the-last-10-years-or-has-it&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-has-the-price-of-oil-increased-in-the-last-10-years-or-has-it&quot; aria-label=&quot;why has the price of oil increased in the last 10 years or has it permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why has the price of oil increased in the last 10 years? Or has it&lt;/h3&gt;
&lt;h4 id=&quot;background-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-4&quot; aria-label=&quot;background 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;In 1994, the average cost for a gallon of gasoline in the U.S. was $1.21. These days, the same gallon of gasoline goes for about $3.40. On the one hand, we could explain this increase in price to a larger demand for gasoline, particularly from rapidly growing countries such as India and China. On the other hand, if gasoline was, in fact, so expensive, we would see smaller and more efficient cars on the street, but we have not.&lt;/p&gt;
&lt;p&gt;I drive a 2011 Honda CRV that gives me an average of about 25 miles per gallon (MPG). The same model in 1995 gave you, are you ready just about the same: 25 MPG. Studies have shown that from 1975 to 1980, the average vehicle weight in the U.S. dropped almost 1,000 pounds, from 4,060 lbs. to 3,228 lbs. By 2005 those reductions had all been gained back, and the average car was as heavy as it was in 1975. If the price of gasoline is higher, why are people driving bigger and less efficient cars?&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-4&quot; aria-label=&quot;discussion question 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Use a diagram of supply and demand to explain why people in the U.S. are driving larger and less fuel efficient cars today if the price of gasoline has continued to increase.&lt;/p&gt;
&lt;h4 id=&quot;answer-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-3&quot; aria-label=&quot;answer 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;An increase in cost of gasoline, would mean that it costs more to produce and deliver cars. The quantity supplied for cars will decrease. If fewer cars are being supplied, then in order to consume the available gasoline, the average vehicle weight can be increased. This may explain why people are driving bigger and less fuel efficient cars.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Finding numbers between 0 and 9999]]></title><description><![CDATA[Combinatorics is a field of Mathematics that allows us to efficiently count numbers. It includes topics such as probabilities, permutations and combinations. In this article I will describe how to solve a problem in Combinatorics that involves numbers between 0 and 9999.]]></description><link>https://pakjiddat.netlify.app//posts/finding-numbers-between-0-9999</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/finding-numbers-between-0-9999</guid><pubDate>Sun, 11 Jul 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/combinatorics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Combinatorics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt;. The course provides useful knowledge about counting and probabilities. I found the course very useful and interesting. In this article I will describe one of the problems that were given to the students to solve.&lt;/p&gt;
&lt;p&gt;Combinatorics is a field of Mathematics that allows us to efficiently count numbers. It includes topics such as probabilities, permutations and combinations. In this article I will describe how to solve a problem in Combinatorics that involves numbers between 0 and 9999.&lt;/p&gt;
&lt;p&gt;The problem is to find out how many numbers between 0 and 9999 inclusive contain exactly one “1” and one “3”.&lt;/p&gt;
&lt;h3 id=&quot;solution&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#solution&quot; aria-label=&quot;solution permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Solution&lt;/h3&gt;
&lt;p&gt;Numbers containing one “1” and one “3” that are less than 9999, can have 2, 3 or 4 digits. We need to sum the count of 2 digit, 3 digit and 4 digit numbers that contain exactly one “1” and one “3”.&lt;/p&gt;
&lt;p&gt;Suppose that we label the digit which does not have the value “1” or “3” as &lt;strong&gt;“c”&lt;/strong&gt;. This digit can have the values 0,2,4,5,6,7,8,9.&lt;/p&gt;
&lt;h3 id=&quot;count-of-two-digit-numbers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#count-of-two-digit-numbers&quot; aria-label=&quot;count of two digit numbers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Count of two digit numbers&lt;/h3&gt;
&lt;p&gt;The number of 2 digit numbers that contain exactly one “1” and one “3” are &lt;strong&gt;2&lt;/strong&gt;, which are 13 and 31.&lt;/p&gt;
&lt;h3 id=&quot;count-of-three-digit-numbers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#count-of-three-digit-numbers&quot; aria-label=&quot;count of three digit numbers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Count of three digit numbers&lt;/h3&gt;
&lt;p&gt;For 3 digit numbers that contain exactly one “1” and one “3”, there is only one digit, c that can have values between 0 and 9 excluding 1 and 3. This digit can be the first digit, second digit or third digit.&lt;/p&gt;
&lt;p&gt;If c is the first digit, then the second and third digits can be arranged in two different ways, 1,3 and 3,1. For each possible value of c, there are two possibilities for the remaining digits. The possible values for c are 2,4,5,6,7,8,9. i.e there are 7 options. Notice that 0 is excluded because a 3 digit number cannot start with 0. For each of these 7 options there are 2 ways of arranging the remaining digits so there are 7*2=14 3 digit numbers that start with c.&lt;/p&gt;
&lt;p&gt;If c is the second digit, then it can have 8 values which are 0,2,4,5,6,7,8,9. For each value of c, there are two possibilities for the remaining 2 digits. So there are 8*2=16 numbers with c as the second digit.&lt;/p&gt;
&lt;p&gt;If c is the third digit, then it can have 8 values which are 0,2,4,5,6,7,8,9. For each value of c, there are two possibilities for the remaining 2 digits. So there are 8*2=16 numbers with c as the third digit.&lt;/p&gt;
&lt;p&gt;So in total there are &lt;strong&gt;16+16+14=46&lt;/strong&gt;, 3 digit numbers containing exactly one “1” and one “3”.&lt;/p&gt;
&lt;h3 id=&quot;count-of-four-digit-numbers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#count-of-four-digit-numbers&quot; aria-label=&quot;count of four digit numbers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Count of four digit numbers&lt;/h3&gt;
&lt;p&gt;Consider the following table. It shows the different possibilities for the four digit numbers. a and b are digits that can be either 1 or 3. c is a number that can have all values between 0 and 9 except for 1 and 3. The table shows the different ways of arranging a, b and c.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th align=&quot;left&quot;&gt;1&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;3&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;c&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;c&lt;/th&gt;
&lt;th align=&quot;left&quot;&gt;number of results&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(7*8=56 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;b&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;c&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;a&lt;/td&gt;
&lt;td align=&quot;left&quot;&gt;(8*8=64 possibilities)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The total is &lt;strong&gt;(64*6)+(56*7)=720&lt;/strong&gt;. There are &lt;strong&gt;720&lt;/strong&gt;, 4 digit numbers that contain exactly one “1” and one “3”.&lt;/p&gt;
&lt;p&gt;The total count is equal to sum of 2 digit count, 3 digit count and 4 digit count. The total is therefore &lt;strong&gt;2+46+720=768&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#code&quot; aria-label=&quot;code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Code&lt;/h3&gt;
&lt;p&gt;The following code prints all numbers between 0 and 9999 inclusive that contain exactly one “1” and one “3”. It can be used to verify that the total count is 768.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# Takes as input the upper bound for the numbers.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;number_checker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token builtin&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  vc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token builtin&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    a &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    oc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    tc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; j &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; a&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; j &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        oc &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;elif&lt;/span&gt; j &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        tc &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;tc &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; oc &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      vc &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; vc
  
      
vc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; number_checker&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;The number of integers between 0 and 9999 is:&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; vc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Economics in daily life]]></title><description><![CDATA[According to Wikipedia: Economics is the social science that studies how people interact with value; in particular, the production, distribution, and consumption of goods and services. In this article I will discuss some daily life applications of Economics.]]></description><link>https://pakjiddat.netlify.app//posts/economics-in-daily-life</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/economics-in-daily-life</guid><pubDate>Sun, 11 Jul 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 225px; &quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 100%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAUABQDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAAMEAv/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAd9M/ZVlG+gTB//EABoQAAIDAQEAAAAAAAAAAAAAAAECAxETIgD/2gAIAQEAAQUC2qQzDOOXkU0kydA2MltlDDFPf//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABwQAAIDAQADAAAAAAAAAAAAAAABESExAhBR8P/aAAgBAQAGPwJy6NjqMLEukvpMr2ThNkPx/8QAHhAAAgMAAgMBAAAAAAAAAAAAAREAITFRkUFhcbH/2gAIAQEAAT8h0zVPqOKPagmc7Xmo8EP1mGDXK4eotQMBQ+QDALAvZejmoLKPeT//2gAMAwEAAgADAAAAEGMAAP/EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EACAQAQACAgEEAwAAAAAAAAAAAAERIQAxQVFhcYGRofD/2gAIAQEAAT8QExAQRXYAOGZufPGKWTQQYRRh02bxsrh3ZabeecB9dynYHrYfOOp48YY1E6XPrJSmKCApmtgf2jxN4LUAgVD+vAKWlkFeh2z/2Q==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/87e5cea917c0e8b8716af0a9bf5dbef3/d7e55/barter.webp 225w&quot;
              sizes=&quot;(max-width: 225px) 100vw, 225px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/87e5cea917c0e8b8716af0a9bf5dbef3/863e1/barter.jpg 225w&quot;
            sizes=&quot;(max-width: 225px) 100vw, 225px&quot;
            type=&quot;image/jpeg&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/87e5cea917c0e8b8716af0a9bf5dbef3/863e1/barter.jpg&quot;
            alt=&quot;Barter&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;
Ben.rajesh, CC BY-SA 4.0 &lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://creativecommons.org/licenses/by-sa/4.0&lt;/a&gt;, via Wikimedia Commons&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/microeconomics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Microeconomics&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it useful. As part of the course, we were given some practice questions related to applying economics in daily life. In this article, I have listed these practice questions and my answers to the questions.&lt;/p&gt;
&lt;p&gt;According to Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Economics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Economics&lt;/a&gt; is the social science that studies how people interact with value; in particular, the production, distribution, and consumption of goods and services. In this article I will discuss some daily life applications of Economics.&lt;/p&gt;
&lt;h3 id=&quot;economics-in-your-daily-life&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#economics-in-your-daily-life&quot; aria-label=&quot;economics in your daily life permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Economics in your daily life&lt;/h3&gt;
&lt;p&gt;According to Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Trade&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Trade&lt;/a&gt; involves the transfer of goods or services from one person or entity to another, often in exchange for money.&lt;/p&gt;
&lt;h4 id=&quot;background&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background&quot; aria-label=&quot;background permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Many of the concepts we will be discussing this semester should apply to your daily life, including the ones we talked about this module. This discussion question gives you a chance to begin exploring economics in your daily life.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question&quot; aria-label=&quot;discussion question permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Give at least 2 examples of any of the concepts we introduced this module that you observe in your daily life. Try to be very specific describing the examples, and also describe how the economic principle applies to your examples.&lt;/p&gt;
&lt;h4 id=&quot;answer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer&quot; aria-label=&quot;answer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I have tomatoes. I have to eat them every day, so I dont like them very much. My friend has milk cream. She also has to eat it every day and is tired of having it. I like milk cream and my friend likes tomatoes. If I give some tomatoes to my friend and she gives me some milk cream, then we would both be happy with the trade.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I buy the same food from the same shop every few days. I am used to paying the same price for the food. Suddenly the price of one of the food items, x increases by 100%. This is very disturbing because I have a fixed budget and have to allocate money for other routine tasks. What should I do?. I decided to switch from buying the food item x to buying the food item y which is cheaper than x but has the same value in terms of taste. However y is less nutritious than x. I am less concerned with nutrition, so I decided to buy y. y costs about the same as x did few days back from the price increase. So the marginal cost of switching from x to y is small. The cost from switching from x to y is that I lose some nutritional benefits of x.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;visual-economics&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#visual-economics&quot; aria-label=&quot;visual economics permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Visual Economics&lt;/h3&gt;
&lt;h4 id=&quot;background-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-1&quot; aria-label=&quot;background 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;A picture is worth a thousand words. I truly believe this is true. Not only can a picture more easily describe a concept, but the process of finding that picture can also be a good learning experience.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-1&quot; aria-label=&quot;discussion question 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Find 1 picture (photograph) that represents any of the 4 principles we introduced this module.  Along with your picture, post a brief description of how this photograph is a good representation of the principle in action.&lt;/p&gt;
&lt;h4 id=&quot;answer-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-1&quot; aria-label=&quot;answer 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;The outcome of trade is that both parties benefit from it. The picture illustrates this concept.&lt;/p&gt;
&lt;h3 id=&quot;what-is-the-opportunity-cost-of-going-to-college&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-is-the-opportunity-cost-of-going-to-college&quot; aria-label=&quot;what is the opportunity cost of going to college permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What is the opportunity cost of going to college&lt;/h3&gt;
&lt;p&gt;According to Wikepedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Opportunity_cost&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Opportunity cost&lt;/a&gt; is the loss of the benefit that could have been enjoyed if the best alternative choice were chosen instead. Directly or indirectly, opportunity cost underpins the majority of day-to-day economic decisions that are made in society.&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-2&quot; aria-label=&quot;discussion question 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Please list the 2 largest opportunity costs of obtaining a 4-year degree (assume you must go to college full time to get this degree). Now, use 1 of these costs to explain the following trend: When the unemployment rate increases, enrollment in college also increases, and vice-versa.&lt;/p&gt;
&lt;h4 id=&quot;answer-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-2&quot; aria-label=&quot;answer 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You are not able to stay at home and look after family members or socialize with general public. Your circle of friends becomes exclusive.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The money spent on going to college, may be spent on other resources.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When the unemployment rate increases, fewer people are working and more are spending time at home with their families. When people are forced to stay at home with family, they start getting used to being at home and are more willing to go out and explore new opportunities such as going to college.&lt;/p&gt;
&lt;p&gt;When enrollment in colleges increases, a lot of people spend a lot of time behind books and in class rooms. In a sense, they become isolated from the rest of society and are not able to participate in activities that add value to society. If value is not being added, then there are fewer opportunities for people, which may result in an increase in the unemployment rate.&lt;/p&gt;
&lt;p&gt;When the unemployment rate increases, people are not encouraged to spend on non essential products and services. This may encourage them to spend on college.&lt;/p&gt;
&lt;p&gt;When enrollment in college increases, people spend a lot on college tuition, so there is less money for other resources. Because there is not enough money, there are less opportunities for people to work, which can lead to an increase in unemployment.&lt;/p&gt;
&lt;h3 id=&quot;when-does-the-invisible-hand-not-work&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#when-does-the-invisible-hand-not-work&quot; aria-label=&quot;when does the invisible hand not work permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;When Does the Invisible Hand NOT Work&lt;/h3&gt;
&lt;p&gt;According to Wikipedia: The &lt;a href=&quot;https://en.wikipedia.org/wiki/Invisible_hand&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Invisible Hand&lt;/a&gt; is an economic concept that describes the unintended greater social benefits and public good brought about by individuals acting in their own self-interests.&lt;/p&gt;
&lt;h4 id=&quot;background-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-2&quot; aria-label=&quot;background 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;One of the principles we introduced this module is the invisible hand principle: society generates the most welfare when individuals try to maximize their individual interests. As many economists point out, this principle requires good societal institutions in order to work. When institutions do not work correctly, what we have is sort of an invisible foot. So here is the question:&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-3&quot; aria-label=&quot;discussion question 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Please describe a situation in which the invisible hand does not seem to work. Then explain why the principle does not work and what would need to happen for it to work.&lt;/p&gt;
&lt;h4 id=&quot;answer-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-3&quot; aria-label=&quot;answer 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;It is common for people to want to increase the amount of money they have in the bank. But if there are no opportunities for spending this money, then it becomes useless. It may even become a burden on society, since interest in payed on the money in the bank account. In many cases, the money in the account holders bank account increases automatically, without the knowledge or explicit consent of the account holder.&lt;/p&gt;
&lt;p&gt;The individual may think that his interest is being served, but society as a whole will probably not benefit, because simply transferring money to a users account, without the knowledge or consent of the account holder will not create any value. So it would seem that the invisible hand principle does not work in this case.&lt;/p&gt;
&lt;p&gt;To make it work in this case, the banking institutions should transfer money to and from an account after investigating the activities of the account holders. One way to achieve this is to allow the banking transactions to take place, but only finalize the transaction after the activities that led to the transaction have been investigated. The banking institutions should collaborate with other social institutions in this regard.&lt;/p&gt;
&lt;p&gt;Another option is to create specialized accounts that serve the needs of different types of account holders. It would be also useful if the banking institutions engage with their customers on a personal level and try to find spending opportunities for their customers. In this way the customers will be happy and society as a whole will benefit because of creation of value, that should result from the customers spending.&lt;/p&gt;
&lt;h3 id=&quot;what-is-the-best-way-to-teach-a-coursera-course&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-is-the-best-way-to-teach-a-coursera-course&quot; aria-label=&quot;what is the best way to teach a coursera course permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What is the Best Way to Teach a Coursera Course&lt;/h3&gt;
&lt;h4 id=&quot;background-3&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-3&quot; aria-label=&quot;background 3 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;One of the questions we discussed this module was what would be the best way to teach a Coursera course. Since my time is a limited resource, and since there are more than one way of distributing this limited resource, this is a classic example of the economic problem. In our lecture we listed the following three possible distribution schemes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I teach the class for free to as many students as sign up (this is the way it is done right now).&lt;/li&gt;
&lt;li&gt;I teach the class for free to just a few students who pay the most. Assume that either Coursera and/or the University get the money from the participants, while I teach the course “pro-bono” or free.&lt;/li&gt;
&lt;li&gt;I choose a few students at random and teach the class to those students for free.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;discussion-question-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-4&quot; aria-label=&quot;discussion question 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Choose which 1 of the 3 distribution schemes that you think is the best. Then, clearly discuss why you think this is the best way to distribute the limited resource. In your answer, please also discuss the pros and cons of the 3 distributions schemes.&lt;/p&gt;
&lt;h4 id=&quot;answer-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-4&quot; aria-label=&quot;answer 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Con: If you teach the class for free for all students, then some students may not be motivated to study since they are not paying. Also Coursera and the instructor would not benefit financially, since they are offering a service for free.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Pro: If you teach the class for free for all students, then a lot people benefit from excellent teaching material. This will result in fewer social problems and higher employment. Specially useful in developing countries.&lt;/p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Con: If you teach the class for free to just a few students who pay the most, then a lot of people who dont have the money but are motivated to study will not be able to study.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Pro: Coursera will earn money for their service.&lt;/p&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Con: If you teach the class for free to a random students, then not all students will benefit from the class. Some motivated students may be left out. Also Coursera and the instructor will not make any money.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Pro: Some motivated students who are not able to pay the fees will be able to study. But only if they are lucky.&lt;/p&gt;
&lt;h3 id=&quot;is-it-better-to-study-in-groups&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#is-it-better-to-study-in-groups&quot; aria-label=&quot;is it better to study in groups permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Is it Better to Study in Groups&lt;/h3&gt;
&lt;h4 id=&quot;background-4&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#background-4&quot; aria-label=&quot;background 4 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Background&lt;/h4&gt;
&lt;p&gt;Many education researchers are discovering the benefits of studying in groups. Yet for an economist, this should have been obvious…or is it?&lt;/p&gt;
&lt;h4 id=&quot;discussion-question-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#discussion-question-5&quot; aria-label=&quot;discussion question 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Discussion Question&lt;/h4&gt;
&lt;p&gt;Explain the economic benefits of studying in a group versus individually. Please try to offer a specific example to demonstrate your arguments. For instance, would it be better for you to study with another person for the first exam of this class? If so, how many students would be a good number of group partners? Why might the benefits of adding more partners to the group decrease as more partners are added the group?&lt;/p&gt;
&lt;h4 id=&quot;answer-5&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#answer-5&quot; aria-label=&quot;answer 5 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Answer&lt;/h4&gt;
&lt;p&gt;The main benefit of studying in a group is that it allows people to share their different views and opinions on a topic. This should improve the students understanding of the topic. I think before studying in a group, the students should first go over the course material individually. Three or four would be a good number of group partners. I think that if more group members are added, students become more distracted since there is a large number of other group members they need to think about. Also students may get over-whelmed if they need to consider too many points of view on a topic.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[R Package For Word Prediction]]></title><description><![CDATA[Wordpredictor is a R package for developing and evaluating n-gram  models. It provides methods for data analysis, data cleaning, data sampling,  converting text to tokens, generating n-gram transition probabilities,  generating n-gram models and evaluating n-gram model performance.]]></description><link>https://pakjiddat.netlify.app//posts/r-package-for-word-prediction</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/r-package-for-word-prediction</guid><pubDate>Thu, 10 Jun 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Wordpredictor is a R package for developing and evaluating n-gram models. It
provides methods for data analysis, data cleaning, data sampling, converting
text to tokens, generating n-gram transition probabilities, generating n-gram
models and evaluating n-gram model performance.&lt;/p&gt;
&lt;p&gt;The goal of the &lt;strong&gt;wordpredictor&lt;/strong&gt; package is to provide a flexible and
easy to use framework for generating &lt;a href=&quot;https://en.wikipedia.org/wiki/N-gram&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;n-gram
models&lt;/a&gt; for word prediction.&lt;/p&gt;
&lt;p&gt;The package allows generating n-gram models from input text files. It
also allows exploring n-grams using plots. Additionally it provides
methods for measuring n-gram model performance using
&lt;a href=&quot;https://en.wikipedia.org/wiki/Perplexity&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Perplexity&lt;/a&gt; and accuracy.&lt;/p&gt;
&lt;p&gt;The n-gram model may be customized using several options such as n-gram
size, data cleaning options and options for extracting tokens from text.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;You can install the released version of wordpredictor from CRAN with:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;install.packages&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;wordpredictor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And the development version from GitHub with:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# install.packages(&quot;devtools&quot;)&lt;/span&gt;
devtools&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;install_github&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;pakjiddat/word-predictor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/pakjiddat/word-predictor&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code repository&lt;/a&gt; for
the package is on GitHub.&lt;/p&gt;
&lt;h3 id=&quot;package-structure&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#package-structure&quot; aria-label=&quot;package structure permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Package structure&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package is based on &lt;strong&gt;R6 classes&lt;/strong&gt;. It is easy to
customize and improve. It provides the following classes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;DataAnalyzer&lt;/strong&gt;. It allows analyzing n-grams.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DataCleaner&lt;/strong&gt;. It allows cleaning text files. It supports several
data cleaning options.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DataSampler&lt;/strong&gt;. It allows generating sample files of specified size
from a text file. It also allows generating train, test and
validation sample files from a given input text file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TokenGenerator&lt;/strong&gt;. It allows generating n-gram tokens of given
size.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TPGenerator&lt;/strong&gt;. It allows generating transition probabilities for
the given n-gram file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ModelGenerator&lt;/strong&gt;. It allows generating n-gram models using
different configuration options.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ModelEvaluator&lt;/strong&gt;. It allows evaluating the performance of n-gram
models. 4 metrics are used to compare the performance. These are:
Perplexity, accuracy, memory and time taken.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ModelPredictor&lt;/strong&gt;. It allows predicting the next word, given a set
of previous words.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Base&lt;/strong&gt;. The base class for all the other classes. It
allows provides methods for reading and writing files and processing
large text files.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Information about the package can be obtained using the command line or
the package website. For example, the command: &lt;strong&gt;?wordpredictor&lt;/strong&gt;
returns information about how the given class works and the parameter
details for each class method.&lt;/p&gt;
&lt;h3 id=&quot;generating-the-model&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-the-model&quot; aria-label=&quot;generating the model permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating the model&lt;/h3&gt;
&lt;p&gt;The following example shows how to generate a n-gram model.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;input.txt&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The following code generates n-gram model using default options for data&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# cleaning and tokenization. See the following section on how to customize these&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# options. Note that input.txt is the name of the input data file. It should be&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# present in the data directory. ddir is the data directory. mdir is the model&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# directory. The output model file, which is def-model.RDS will be placed in&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# this directory.&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# ModelGenerator class object is created&lt;/span&gt;
mg &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; ModelGenerator&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;def-model&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    desc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;N-gram model generating using default options&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;def-model.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    df &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;input.txt&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    n &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    ssize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    dir &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    dc_opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    tg_opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ve
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Generates n-gram model. The output is the file def-model.RDS&lt;/span&gt;
mg&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;generate_model&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code generates the file &lt;strong&gt;def-model.RDS&lt;/strong&gt;. This file
represents the n-gram model.&lt;/p&gt;
&lt;h3 id=&quot;predicting-words&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#predicting-words&quot; aria-label=&quot;predicting words permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Predicting words&lt;/h3&gt;
&lt;p&gt;The following example shows how to predict the next word given a set of
words:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;def-model.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The model file name&lt;/span&gt;
mfn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/def-model.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# An object of class ModelPredictor is created. The mf parameter is the name of&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the model file that was generated in the previous example.&lt;/span&gt;
mp &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; ModelPredictor&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mf &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; mfn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Given the words: &quot;how are&quot;, the next word is predicted. The top 3 most likely&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# next words are returned along with their respective probabilities.&lt;/span&gt;
res &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; mp&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;predict_word&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;words &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;how are&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;analyzing-n-grams&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#analyzing-n-grams&quot; aria-label=&quot;analyzing n grams permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Analyzing N-grams&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package includes a class called &lt;strong&gt;DataAnalyzer&lt;/strong&gt;,
that can be used to get an idea of the frequency distribution of n-grams
in a model. The model generation process described above, creates an
n-gram file in the model directory.&lt;/p&gt;
&lt;p&gt;For each n-gram number less than or equal to the n-gram size of the
model, a n-gram file is generated. In the example above the n-gram size
of the model is 4. So 4 n-gram files are generated in the model folder.
These files are: &lt;strong&gt;n1.RDS, n2.RDS, n3.RDS and n4.RDS&lt;/strong&gt;. The &lt;strong&gt;n2.RDS&lt;/strong&gt;
file contains n-grams of size 2.&lt;/p&gt;
&lt;p&gt;The following example plots the top 10 most occurring bi-grams along
with their frequencies:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The file name&lt;/span&gt;
fn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# An object of class DataAnalyzer is created. The fn parameter is the path to&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the n-gram file.&lt;/span&gt;
da &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; DataAnalyzer&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The top 10 most occurring features are plotted&lt;/span&gt;
df &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; da&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;plot_n_gram_stats&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;type&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;top_features&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;n&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;save_to&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;dir&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 576px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/7c4e8dd7550a132b02acc7bc67165b60/533c1/analyze-ngrams-1-1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 66.66666666666666%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAB7klEQVR42nWSu0rsQBjH421ZUWGXlfWyKqxgYScoWFnaaimIgr6BD2Cj4mOIzTb6DBaWVpaCoHtO4HA2J/e5JNlk8s2cb5KAhevwJ8wk85vfZOYzlFJSSnwSSv/2+9bn5++3tz/v76nvK84lYz8FAIwSjhijQqQXF3JzE3Z3YWcn394eHfy0tZXt7XHTrGBOaShEcnwM9TosLkK7/WMWFqDVEuvrrN/XsCrMYZYNT07kzAx0OpofmaUlWF7GJcTGRgWX2yZ5Pjw6UuPjstWSjcbIqHpdTU6qsTFoNtnHhxGGIfJZkhAhRptLW6cj5+f5zY3/8hI+PfnPz9TzDNM0hRDlPw9PT+XcHKyu6tllcKF2G19q7dQU7fVspdw4tuOYMmbkeR7HceB5pIRnZ2FlRdswaGs00v198vhI7+/p3V3w+uq4rjcYOIMBJcTA6/J9nwRB+H3bCE9PJ+fn2kaIw7kbBK7juJ7nOA6l1MDTQjMjRJvPzmSzCd0urK3pdLtoRtjJMs+yEPPcqlUwnhbkOSckQPjgQBmGrNXkxIROrYbD5PDwnxCuZSFQYths20ZddVVZmkZYJL2evLyE29v8+lpcXWEHh9nDQ1RUETYEGGOco4tEUVQUiSorRUJR5LpfRBd8lv0qdOUQT/drMsB/yl4kHYVfu3kAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/7c4e8dd7550a132b02acc7bc67165b60/8ac56/analyze-ngrams-1-1.webp 240w,
/static/7c4e8dd7550a132b02acc7bc67165b60/d3be9/analyze-ngrams-1-1.webp 480w,
/static/7c4e8dd7550a132b02acc7bc67165b60/6264f/analyze-ngrams-1-1.webp 576w&quot;
              sizes=&quot;(max-width: 576px) 100vw, 576px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/7c4e8dd7550a132b02acc7bc67165b60/8ff5a/analyze-ngrams-1-1.png 240w,
/static/7c4e8dd7550a132b02acc7bc67165b60/e85cb/analyze-ngrams-1-1.png 480w,
/static/7c4e8dd7550a132b02acc7bc67165b60/533c1/analyze-ngrams-1-1.png 576w&quot;
            sizes=&quot;(max-width: 576px) 100vw, 576px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/7c4e8dd7550a132b02acc7bc67165b60/533c1/analyze-ngrams-1-1.png&quot;
            alt=&quot;N-gram Top Features&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;!-- --&gt;&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following example plots the n-gram frequency coverage. It shows the
percentage of n-grams with frequency 1, 2 … 10.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The file name&lt;/span&gt;
fn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# An object of class DataAnalyzer is created. The fn parameter is the path to&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the n-gram file.&lt;/span&gt;
da &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; DataAnalyzer&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The top 10 most occurring features are plotted&lt;/span&gt;
df &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; da&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;plot_n_gram_stats&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;type&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;coverage&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;n&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;save_to&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;dir&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 576px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/616b299d5ce2fff25f346ce8db2b5f97/533c1/analyze-ngrams-2-1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 66.66666666666666%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABL0lEQVR42qVS24rCMBDtB/nqg4Kf4E8t+Dt+hGBFfPJdQaxabRJikkm81CZ7srWLywruZRgOhzNzMmU6SQiBrM2Wy+V8rvM8WFtp7Y15kURVVSXhdrMhuMHAt1plr1d2Oi+y2y3b7XO/b6SMZo3hb29qOJSzmRyPj5OJTNN7PvI0rUvHNBXTqVYqCd6b81mORrwomHPMGE4EfJq8RqJCKa11opQi58RiwXc7+PnhID7waYqmge330ZxlmTZGoMYYF4JzQMSnIZoGxlg0b7dbgy95MPzCvF6vieh7x4/Ml8slTv6bGUfyLzMWDok18ckLbPUrqUtAKCr+5xBOpxOYaUJKiVexCOjWWijOOSBElOoe8LsZgUMNTVyv13jwRHmer1arzWaDUVC892VZPra9Azx+vLuvuJtWAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/616b299d5ce2fff25f346ce8db2b5f97/8ac56/analyze-ngrams-2-1.webp 240w,
/static/616b299d5ce2fff25f346ce8db2b5f97/d3be9/analyze-ngrams-2-1.webp 480w,
/static/616b299d5ce2fff25f346ce8db2b5f97/6264f/analyze-ngrams-2-1.webp 576w&quot;
              sizes=&quot;(max-width: 576px) 100vw, 576px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/616b299d5ce2fff25f346ce8db2b5f97/8ff5a/analyze-ngrams-2-1.png 240w,
/static/616b299d5ce2fff25f346ce8db2b5f97/e85cb/analyze-ngrams-2-1.png 480w,
/static/616b299d5ce2fff25f346ce8db2b5f97/533c1/analyze-ngrams-2-1.png 576w&quot;
            sizes=&quot;(max-width: 576px) 100vw, 576px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/616b299d5ce2fff25f346ce8db2b5f97/533c1/analyze-ngrams-2-1.png&quot;
            alt=&quot;N-gram Frequency Coverage&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;!-- --&gt;&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following example shows how to get the list of bi-grams starting
with &lt;strong&gt;“great_”&lt;/strong&gt; along with their frequencies. It also shows how to
get the frequency of the bi-gram &lt;strong&gt;“great_deal”&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The file name&lt;/span&gt;
fn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/n2.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# An object of class DataAnalyzer is created. The fn parameter is the path to&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the n-gram file.&lt;/span&gt;
da &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; DataAnalyzer&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Bi-grams starting with &quot;great_&quot; are returned&lt;/span&gt;
df &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; da&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;get_ngrams&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; fn&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; c &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; pre &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;^great_*&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The data frame is sorted by frequency&lt;/span&gt;
df &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; df&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;order&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;df&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;freq&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; decreasing &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The frequency of the bi-gram &quot;great_deal&quot;&lt;/span&gt;
f &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; as.numeric&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;df&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;df&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;pre &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;great_deal&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;freq&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;customizing-the-n-gram-model&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#customizing-the-n-gram-model&quot; aria-label=&quot;customizing the n gram model permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Customizing the n-gram model&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;dc_opts&lt;/strong&gt; parameter to the &lt;strong&gt;ModelGenerator&lt;/strong&gt; class specifies the
data cleaning options. The following code shows the data cleaning
options and their default values:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# @field dc_opts The options for the data cleaner object.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   min_words -&gt; The minimum number of words per sentence.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   line_count -&gt; The number of lines to read and clean at a time.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   save_data -&gt; If the combined processed lines should be saved.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   output_file -&gt; Name of the output file used to store the data.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   sw_file -&gt; The stop words file path.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   dict_file -&gt; The dictionary file path.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   bad_file -&gt; The bad words file path.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   to_lower -&gt; If the words should be converted to lower case.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_stop -&gt; If stop words should be removed.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_punct -&gt; If punctuation symbols should be removed.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_non_dict -&gt; If non dictionary words should be removed.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_non_alpha -&gt; If non alphabet symbols should be removed.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_extra_space -&gt; If leading, trailing and double spaces&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#     should be removed.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   remove_bad -&gt; If bad words should be removed&lt;/span&gt;
dc_opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;min_words&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;line_count&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;sw_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;dict_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;bad_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;to_lower&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_stop&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; F&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_punct&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_non_dict&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_non_alpha&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_extra_space&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;remove_bad&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; F
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;tg_opts&lt;/strong&gt; parameter to the &lt;strong&gt;ModelGenerator&lt;/strong&gt; class specifies the
token generation options. The following code shows the token generation
options and their default values:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# @field tg_opts The options for the token generator obj.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   min_freq -&gt; All ngrams with frequency less than min_freq are&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#     ignored.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#   stem_words -&gt; If words should be transformed to their stems.&lt;/span&gt;
tg_opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;stem_words&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; F&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token string&quot;&gt;&quot;min_freq&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;evaluating-model-performance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#evaluating-model-performance&quot; aria-label=&quot;evaluating model performance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Evaluating model performance&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package allows evaluating n-gram model
performance. It can measure the performance of a single model as well as
compare the performance of multiple models. When evaluating the
performance of a model, intrinsic and extrinsic evaluation is performed.&lt;/p&gt;
&lt;p&gt;Intrinsic evaluation measures the Perplexity score for each sentence in
a validation text file. It returns the minimum, maximum and mean
Perplexity score for the sentences.&lt;/p&gt;
&lt;p&gt;Extrinsic evaluation measures the accuracy score for the sentences in a
validation text file. It tries to predict the last word of each
sentence. If the word was correctly predicted, then the accuracy count
is increased. The extrinsic evaluation returns the number of valid and
invalid predictions.&lt;/p&gt;
&lt;p&gt;The following example shows how to evaluate the performance of a model:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# The required files&lt;/span&gt;
rf &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;def-model.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;validate.txt&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The test environment is setup&lt;/span&gt;
ed &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; setup_env&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rf&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The model file name&lt;/span&gt;
mfn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/def-model.RDS&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The validation file name&lt;/span&gt;
vfn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;/validate.txt&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ModelEvaluator class object is created&lt;/span&gt;
me &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; ModelEvaluator&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mf &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; mfn&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The performance evaluation is performed. The performance stats are returned as&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# a data frame and also saved within the model file itself.&lt;/span&gt;
stats &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; me&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;evaluate_performance&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; vfn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# The test envionment is cleaned up&lt;/span&gt;
clean_up&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;demo&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#demo&quot; aria-label=&quot;demo permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Demo&lt;/h3&gt;
&lt;p&gt;A &lt;a href=&quot;https://pakjiddat.shinyapps.io/word-predictor/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DEMO&lt;/a&gt; application
demonstrates how to make word predictions. It is based on the Shiny
package. It allows predicting the next word based on the given set of
words. It displays the 10 most likely words along with their respective
probabilities.&lt;/p&gt;
&lt;p&gt;The demo app is based on Shiny platform. It consists of two files.
&lt;a href=&quot;https://gist.github.com/pakjiddat/43c61c54b645e5bd0096d6fd75e58127&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;server.r&lt;/a&gt;
and
&lt;a href=&quot;https://gist.github.com/pakjiddat/96727c1df77755e5bcf8a7d4ff731dea&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ui.r&lt;/a&gt;.
The n-gram model file must be present in the same folder as the two
files. It can be generated using the ModelGenerator class.&lt;/p&gt;
&lt;h3 id=&quot;website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#website&quot; aria-label=&quot;website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Website&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://pakjiddat.github.io/word-predictor/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;wordpredictor website&lt;/a&gt;
provides details about how the packages works. It includes code samples
and details of all the classes and methods.&lt;/p&gt;
&lt;h3 id=&quot;benefits&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#benefits&quot; aria-label=&quot;benefits permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Benefits&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package provides an easy to use framework for
working with n-gram models. It allows n-gram model generation,
performance evaluation and word prediction.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The n-gram language model requires a lot of memory for storing the
n-grams. The &lt;strong&gt;wordpredictor&lt;/strong&gt; package has been tested on a machine with
dual core processor and 4 GB of RAM. It works well for input data files
of size less than 40 Mb and n-gram size 4. For larger data files and
n-gram size, more memory and CPU power will be needed.&lt;/p&gt;
&lt;h3 id=&quot;future-work&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#future-work&quot; aria-label=&quot;future work permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Future Work&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package may be extended by adding support for
different smoothing techniques such as
[Good-Turing](&lt;a href=&quot;https://en.wikipedia.org/wiki/Good%E2%80%93Turing_frequency_estima&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Good%E2%80%93Turing_frequency_estima&lt;/a&gt;
tion),
&lt;a href=&quot;https://en.wikipedia.org/wiki/Katz%27s_back-off_model&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Katz-Back-off&lt;/a&gt;
and handling of &lt;a href=&quot;https://en.wikipedia.org/wiki/N-gram#Out-of-vocabulary_words&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Out Of Vocabulary
Words&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Support for different types of n-gram models such as
&lt;a href=&quot;https://en.wikipedia.org/wiki/N-gram#Skip-gram&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Skip-Grams&lt;/a&gt; and
&lt;a href=&quot;https://en.wikipedia.org/wiki/N-gram#Syntactic_n-grams&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Syntatic
n-grams&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;wordpredictor&lt;/strong&gt; package is used for predicting words. It may be
extended to support other use cases such as spelling correction,
biological sequence analysis, data compression and more. This will
require further performance optimization.&lt;/p&gt;
&lt;p&gt;The source code is organized using R6 classes. It is easy to extend.
Contributions are welcome !.&lt;/p&gt;
&lt;h3 id=&quot;acknowledgments&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#acknowledgments&quot; aria-label=&quot;acknowledgments permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Acknowledgments&lt;/h3&gt;
&lt;p&gt;I was motivated to develop the &lt;strong&gt;wordpredictor&lt;/strong&gt; package after taking
the courses in the &lt;a href=&quot;https://www.coursera.org/specializations/jhu-data-science&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Data Science
Specialization&lt;/a&gt;
offered by John Hopkins university on Coursera. I would like to thank
the course instructors for making the courses interesting and motivating
for the students.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[R6 class for processing large text files]]></title><description><![CDATA[In this article I will describe a R6 class that I had developed for processing large text files.]]></description><link>https://pakjiddat.netlify.app//posts/r6-class-for-processing-large-text-files</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/r6-class-for-processing-large-text-files</guid><pubDate>Tue, 25 May 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In this article I will describe a R6 class called &lt;strong&gt;TextFileProcessor&lt;/strong&gt; that I had developed for processing large text files. I had developed the class as part of the &lt;a href=&quot;https://github.com/pakjiddat/word-predictor&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;wordpredictor&lt;/a&gt; package.&lt;/p&gt;
&lt;p&gt;The class can be used as a base class by classes that need to process large text files a fixed number of lines at a time.&lt;/p&gt;
&lt;h3 id=&quot;how-the-class-can-be-used&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-the-class-can-be-used&quot; aria-label=&quot;how the class can be used permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How the class can be used&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;TextFileProcessor&lt;/strong&gt; class, provides a method called &lt;strong&gt;process_file&lt;/strong&gt;. This method processes a given text file a given number of lines at a time by calling user defined methods. The method takes three arguments. A &lt;strong&gt;pre-processing&lt;/strong&gt; method, a &lt;strong&gt;processing&lt;/strong&gt; method and a &lt;strong&gt;post-processing&lt;/strong&gt; method. These methods need to be defined by the user class.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;pre-processing&lt;/strong&gt; method is called before the processing of the text file starts. The text file is then read a fixed number of lines at a time. The number of lines to read at a time can be configured.&lt;/p&gt;
&lt;p&gt;The lines that are read are passed as argument to the &lt;strong&gt;processing&lt;/strong&gt; method. The processing methods processes the lines and returns them. The processed lines may be written to a output text file or they may be combined and then returned after all the lines in the text file have been processed.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;post-processing&lt;/strong&gt; method is called after all the lines in the text file have been read and processed.&lt;/p&gt;
&lt;h3 id=&quot;benefits-of-using-the-class&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#benefits-of-using-the-class&quot; aria-label=&quot;benefits of using the class permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Benefits of using the class&lt;/h3&gt;
&lt;p&gt;The main benefit of the &lt;strong&gt;TextFileProcessor&lt;/strong&gt; class is that it makes it easy to create applications that need to process large text files. The programmer has to simply provide a method that processes a given number of lines. Pre-processing and post-processing methods may optionally be defined.&lt;/p&gt;
&lt;p&gt;Another benefit of the class is that it supports displaying the progress of processing. This can be controlled using the verbose parameter.&lt;/p&gt;
&lt;h3 id=&quot;source-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#source-code&quot; aria-label=&quot;source code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Source code&lt;/h3&gt;
&lt;p&gt;The following is the source code for the &lt;strong&gt;TextFileProcessor&lt;/strong&gt; class:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#&apos; Base class for text file processing&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; @description&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; Provides basic structure for processing text files.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; @details&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; It provides pre-processing, processing and post-processing functions, which&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; need to be overridden by derived classes. The pre-processing function is&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; called before reading a file. The process function is called for processing a&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; line. The post processing function is called on the processed data.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; @export&lt;/span&gt;
TextFileProcessor &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; R6&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;R6Class&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;TextFileProcessor&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    public &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; It initializes the current object. It is used to set the file name&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; and verbose options.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @param fn The path to the file to clean.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @param lc The number of lines to read and clean at a time.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @param ve Indicates if progress information should be displayed.&lt;/span&gt;
        initialize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; lc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# If the given file name is not NULL and is not valid&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;is.null&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;file.exists&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                  stop&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;The given file name is not valid&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;# The base class attributes are set&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The file name is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; fn
            &lt;span class=&quot;token comment&quot;&gt;# The verbose option is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;ve &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; ve
            &lt;span class=&quot;token comment&quot;&gt;# The line count is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;lc &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; lc
            &lt;span class=&quot;token comment&quot;&gt;# The processed output is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;p_output &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    private &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @field opts The list of file processing options.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# * **save_data**. If the combined processed lines should be saved.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# * **ret_data**. If the data should be returned.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# * **output_file**. Name of the output file used to store the data.&lt;/span&gt;
        opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; F&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token string&quot;&gt;&quot;ret_data&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; F&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @field lc The number of lines to read and process at a time.&lt;/span&gt;
        lc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @field p_output The output of the processing step&lt;/span&gt;
        p_output &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @field fn The name of the text file to process.&lt;/span&gt;
        fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @field ve Indicates if progress data should be printed.&lt;/span&gt;
        ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @field con The input file connection&lt;/span&gt;
        con &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; Reads the given file one line at a time. It runs the given&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; pre-processing function before reading the file. It runs the given&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# line processing function for each line. It optionally saves the&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# output of line processing after reading the file or after processing&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# certain number of lines.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param pre_process The pre-processing function.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param process The function used to process each line.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param post_process The function used to perform post processing.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @return The combined processed data&lt;/span&gt;
        process_file &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pre_process&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; post_process&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# Pre-processing is done&lt;/span&gt;
            pre_process&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The file is opened&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;con &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; file&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The connection is opened for reading&lt;/span&gt;
            open&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;con&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The lines to be read,&lt;/span&gt;
            lines &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The loop counter&lt;/span&gt;
            c &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# Indicates that data should not be appended&lt;/span&gt;
            is_app &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; F
            &lt;span class=&quot;token comment&quot;&gt;# The output file name&lt;/span&gt;
            of &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# All lines are read&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# The lines are read&lt;/span&gt;
                lines &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; readLines&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;con&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                    n &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;lc&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                    skipNul &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;TRUE&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# If all the lines have been read&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# The lines are processed&lt;/span&gt;
                p_lines &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; process&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# If the processed lines are NULL&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;is.null&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;p_lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;next&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# If the data should be saved&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;token comment&quot;&gt;# The cleaned data is written to file&lt;/span&gt;
                    private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;write_file&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;p_lines&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; of&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; is_app&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;token comment&quot;&gt;# Debug message&lt;/span&gt;
                    private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;display_msg&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                        paste&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;p_lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;lines were written&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;token comment&quot;&gt;# Indicates that data should be appended&lt;/span&gt;
                    is_app &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; T
                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# If the processed data should be returned&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;ret_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;token comment&quot;&gt;# The processed output is merged&lt;/span&gt;
                    private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;p_output &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;p_output&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; p_lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# The loop counter is increased by 1&lt;/span&gt;
                c &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; c &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# Debug message&lt;/span&gt;
                private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;display_msg&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    paste&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;lc &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;lines have been processed&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The file connection is closed if it is open&lt;/span&gt;
            close&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;con&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# Post processing is performed&lt;/span&gt;
            post_process&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# If the data should be returned&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;ret_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# The processed output is returned&lt;/span&gt;
                return&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;p_output&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# Prints the given message depending on verbose settings.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param msg The message to be printed.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param min_debug The minimum debugging level&lt;/span&gt;
        display_msg &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;msg&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; min_debug&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# If verbose is &gt;= min_debug , then message is displayed&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;ve &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt; min_debug&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                print&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;msg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# Performs processing on the data. It should be&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# overriden by a derived class.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param lines The lines to process&lt;/span&gt;
        process &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# Performs post-processing on the processed data. It should be&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# overriden by a derived class.&lt;/span&gt;
        post_process &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# Performs pre-processing on the processed data. It should be&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# overriden by a derived class.&lt;/span&gt;
        pre_process &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            return&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following is an example of how to use the &lt;strong&gt;TextFileProcessor&lt;/strong&gt; class. The &lt;strong&gt;DataCleaner&lt;/strong&gt; class is an example class that allows cleaning large text files. The class is derived from the &lt;strong&gt;TextFileProcessor&lt;/strong&gt; class. The main method of the class is &lt;strong&gt;clean_files&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#&apos; Provides data cleaning functionality&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; @description&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; It provides a memory efficient method for removing unneeded&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; characters from text files. It is suitable for cleaning large text files.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; @details&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; It provides a method for cleaning text files. It allows removing bad&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; words, stop words, non dictionary words, extra space, punctuation and&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; non-alphabet characters. Allows conversion to lower case. It supports large&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&apos; text files.&lt;/span&gt;
DataCleaner &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; R6&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;R6Class&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;DataCleaner&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    inherit &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; TextFileProcessor&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    public &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; It initializes the current object. It is used to set the file name&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; and verbose options.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @param fn The path to the file to clean.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @param ve Indicates if progress information should be displayed.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; @export&lt;/span&gt;
        initialize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;            
            &lt;span class=&quot;token comment&quot;&gt;# The base class is initialized&lt;/span&gt;
            super&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;initialize&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;fn&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;line_count&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ve&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The save_data option of base class is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The output_file option of base class is set&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;#&apos; @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; It provides an efficient method for cleaning text files.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; It removes unneeded characters from the given text file with several&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; options. It allows removing punctuations, bad words, stop words,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; non-alphabetical symbols and non-dictionary words. It reads a certain&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; number of lines from the given text file. It removes unneeded&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; characters from the lines and then saves the lines to an output text&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; file. File cleaning progress is displayed if the verbose option was&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; set in the class constructor. It is suitable for cleaning large text&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;#&apos; files.&lt;/span&gt;
        clean_file &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The information message&lt;/span&gt;
            msg &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; paste0&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cleaning the file: &quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;fn&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The information message is shown&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;display_msg&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;msg&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# The base class process_file function is called&lt;/span&gt;
            private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;process_file&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;pre_process&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;process&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;post_process
            &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# If the data should not be saved&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;dc_opts&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# The processed output is returned&lt;/span&gt;
                return&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;private&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;p_output&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    private &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @description&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# It processes the given lines of text.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @param lines The lines of text to clean.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# @return The processed line is returned.&lt;/span&gt;
        process &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

            return&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;lines&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following example shows how the &lt;strong&gt;DataCleaner&lt;/strong&gt; class is used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;r&quot;&gt;&lt;pre class=&quot;language-r&quot;&gt;&lt;code class=&quot;language-r&quot;&gt;dc &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; DataCleaner&lt;span class=&quot;token operator&quot;&gt;$&lt;/span&gt;new&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&quot;path-to-large-text-file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 
    opts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token string&quot;&gt;&quot;line_count&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 
        &lt;span class=&quot;token string&quot;&gt;&quot;output_file&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;path-to-output-file&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 
        &lt;span class=&quot;token string&quot;&gt;&quot;save_data&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; T&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 
    ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Using N-gram models for Word Prediction]]></title><description><![CDATA[N-gram models have applications in many areas such as spell checking, biological sequence analysis, speech recognition, word prediction and more. In this article I will provide an overview of n-gram models.]]></description><link>https://pakjiddat.netlify.app//posts/using-n-gram-models-for-word-prediction</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-n-gram-models-for-word-prediction</guid><pubDate>Tue, 25 May 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/e3d94989a75a3ceaae616a4de25d2539/97bfd/mobile-keyboard.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 71.66666666666667%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACKklEQVR42k1S267TMBDM/7+DxANP/EDFE1BxShGlUq85p82taRIncS5NKeIPhp1tHfVhZXvsnd0Zr7fb7eD7PlarlcZ+v0cYhggkIonXIMSX1wAT/wg/uGO8D48BmLtarzVvu90q7m02GyyXS8xmszGiKEIQBIijEGtJ/LQ94uPmgK3s40exUO4XP37i+8sL5vM5ptOp5nht26Kua3RdB2stmqaBMUYxro2Vu9LgT1OjJF5VMEOH6/sJuskc7b8bbFWPeR4TXXKe57ovyxKukJ6FpH4kNMSzHH8/fIYJE1TSRGnKkcOL4xhJkmicTidkWYY0TfVBJURFUeied7ncZbZC/vUX+vVRO02JSyO0iRxe3/dgsKNhGMaVEojTisvlokG8b1pcF77ig2Aun2fmqodGJJ7PZ/WQHTHYJaVTBnF2m4uX+VuILi1QNVbVuHvmKCGZnVS2ziAZgyR8TCmHw2EsRD+dNXxPNYUQK6GVQyuknRwuDwlOsjs/4yq7u0u8DlfF+fbWC4esXiJf/jszCqo0+QAngSujfsLcSN0/zOAsnV6kmXdvKRZZCa+kpOo+h5n46Dx08hk8009aQ5mUS4wTcpRhHy69ksWVFQ8prW20Q3rAyu7nnmW6n3bxPB3s+NYJhxT19qbCN/m1iF3SXKnMbp13LMDuuLpRcmNCG3jHNSorJHkBL6stfCE1AnJvpWL/REjJHCmuJB27kzc1PZYi/PVlLmNlG/wHAcrxqC59yz8AAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/e3d94989a75a3ceaae616a4de25d2539/8ac56/mobile-keyboard.webp 240w,
/static/e3d94989a75a3ceaae616a4de25d2539/d3be9/mobile-keyboard.webp 480w,
/static/e3d94989a75a3ceaae616a4de25d2539/e46b2/mobile-keyboard.webp 960w,
/static/e3d94989a75a3ceaae616a4de25d2539/cff29/mobile-keyboard.webp 1078w&quot;
              sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/e3d94989a75a3ceaae616a4de25d2539/8ff5a/mobile-keyboard.png 240w,
/static/e3d94989a75a3ceaae616a4de25d2539/e85cb/mobile-keyboard.png 480w,
/static/e3d94989a75a3ceaae616a4de25d2539/d9199/mobile-keyboard.png 960w,
/static/e3d94989a75a3ceaae616a4de25d2539/97bfd/mobile-keyboard.png 1078w&quot;
            sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/e3d94989a75a3ceaae616a4de25d2539/d9199/mobile-keyboard.png&quot;
            alt=&quot;Mobile keyboard&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;N-gram models have applications in many areas such as spell checking, biological sequence analysis, speech recognition, word prediction and more. In this article I will provide an overview of n-gram models. I will first describe n-gram models and how they are used to predict words. Next I will describe the steps involved in developing n-gram models for word prediction.&lt;/p&gt;
&lt;h3 id=&quot;what-are-n-grams&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-are-n-grams&quot; aria-label=&quot;what are n grams permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What are n-grams&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/N-gram&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;N-grams&lt;/a&gt; are sequences of items such as letters, words, phonemes, syllables etc. The ‘n’ in n-grams refers to the number of items in the sequence. For example the term “4-gram words” refers to four words that occur in sequence.&lt;/p&gt;
&lt;h3 id=&quot;the-n-gram-language-model&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-n-gram-language-model&quot; aria-label=&quot;the n gram language model permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The n-gram language model&lt;/h3&gt;
&lt;p&gt;A statistical language model assigns probabilities to a sequence of words. A n-gram language model is based on the Markov assumption that the probability of a word depends only on the probabilities of the previous words. Smoothing techniques are used to assign probabilities to unknown words.&lt;/p&gt;
&lt;p&gt;Two benefits of n-gram models are that they are simple and scalable in the sense that they can be developed using small data sets and then applied to data sets of large sizes.&lt;/p&gt;
&lt;p&gt;Maximum likelihood estimation (MLE) is used to determine the probability of words in a n-gram model. The probability of a word in a n-gram model is given by P(w) = count(w)/count(wprev), where w is the word and wprev is set of the previous words. count(w) is the number of times the n-gram occurs. count(wprev) is the number of times the (n-1) gram occurs.&lt;/p&gt;
&lt;h3 id=&quot;predicting-words-using-n-gram-models&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#predicting-words-using-n-gram-models&quot; aria-label=&quot;predicting words using n gram models permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Predicting words using n-gram models&lt;/h3&gt;
&lt;p&gt;It is possible that a language model does not have the information required to determine the probability of a given word and set of previous words. In this case the language model may refer to lower level n-grams. For example if a 4-gram model does not have data for a given word and previous words, then it may check a 3-gram model. If the 3-gram model also does not have the data for the given word and 2 previous words, then a 2-gram model may be checked. This is known as &lt;strong&gt;back-off&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Another options is to calculate the probability of the given word by taking a linear combination of all n-gram models. For example the probability given by each n-gram, n-1-gram, n-2-gram etc models is multiple by constants and added together. This gives a weighted probability for the given word. This method is called interpolation.&lt;/p&gt;
&lt;h3 id=&quot;evaluating-performance-of-n-gram-models&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#evaluating-performance-of-n-gram-models&quot; aria-label=&quot;evaluating performance of n gram models permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Evaluating performance of n-gram models&lt;/h3&gt;
&lt;p&gt;To evaluate the performance of n-gram models intrinsic and extrinsic evaluation methods may be used. In extrinsic evaluation, the n-gram model is embedded into a particular application. The improvement in the application gives a measure of the model’s performance.&lt;/p&gt;
&lt;p&gt;It may not be feasible to embed a n-gram model into an application. An alternative is to measure the performance of the model independent of any application. This is called intrinsic evaluation. This can be carried out using &lt;a href=&quot;https://en.wikipedia.org/wiki/Perplexity&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Perplexity&lt;/a&gt;. Perplexity is a quantitative measure of how perplexed or confused the language model is when required to predict the probability of a given set of words. A low Perplexity value, implies that the model is less surprised to learn about the given set of words. For n-gram models, Perplexity is equal to the nth root of the inverse of the product of probabilities of each word, given the previous words.&lt;/p&gt;
&lt;h3 id=&quot;steps-involved-in-generating-n-gram-language-models&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#steps-involved-in-generating-n-gram-language-models&quot; aria-label=&quot;steps involved in generating n gram language models permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Steps involved in generating n-gram language models&lt;/h3&gt;
&lt;p&gt;The following steps can be used to generate a n-gram language model from a given input text file:&lt;/p&gt;
&lt;h4 id=&quot;data-analysis&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#data-analysis&quot; aria-label=&quot;data analysis permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Data Analysis&lt;/h4&gt;
&lt;p&gt;The first step is to analyze the given data. This involves determining various text statistics such as number of lines of text, word count, file size, type of textual content etc. This will give an idea of the size of the input data as well as the words and symbols that are not useful. This information will be used in the “Data Cleaning” step.&lt;/p&gt;
&lt;h4 id=&quot;data-sampling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#data-sampling&quot; aria-label=&quot;data sampling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Data Sampling&lt;/h4&gt;
&lt;p&gt;The next step is to generate three sample files from the given input data file. These files are the train, validate and test files. The train file is used to generate the n-gram model. The validate file is used to evaluate the model’s performance. The test file is used to run unit tests.&lt;/p&gt;
&lt;p&gt;The data in these files needs to be non overlapping. For example the first 80% of the lines in the input data file can be used for the train file, the next 10% for the validation file and the last 10% for the test file. If the train and validation files contain the same data, then the model will predict data it already knows, which can result in overly exaggerated performance scores. This is known as over-fitting.&lt;/p&gt;
&lt;h4 id=&quot;data-cleaning&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#data-cleaning&quot; aria-label=&quot;data cleaning permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Data Cleaning&lt;/h4&gt;
&lt;p&gt;The next step is to remove unwanted symbols and words from the train file that was generated in the previous step. For example vulgar words, foreign words, punctuation symbols, non alphabetical symbols etc may be removed. Once the data has been cleaned, the next step is to generate n-gram tokens from the data.&lt;/p&gt;
&lt;h4 id=&quot;tokenization&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#tokenization&quot; aria-label=&quot;tokenization permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Tokenization&lt;/h4&gt;
&lt;p&gt;In this step, the cleaned data file is read. N-grams tokens are extracted from the file and saved along with their frequencies to a new file. For example if the language model has a size of 4, then 4-gram, 3-gram, 2-gram and 1-gram tokens are extracted and saved to separate files along with their frequencies.&lt;/p&gt;
&lt;p&gt;For example for the sentence: “today is a great day to go shopping”, the 4-grams are: “today is a great”, “is a great day”, “a great day to”, “great day to go”, “day to go shopping”. The 3-grams are: “today is a”, “is a great”, “a great day”, “great day to”, “day to go”, “to go shopping”. The 2-grams are: “today is”, “is a”, “a great”, “great day”, “day to”, “to go”, “go shopping”. The 1-grams are simply the set of all words.&lt;/p&gt;
&lt;p&gt;From the above example, we can see that the higher the n-gram size, the more information or context is provided. Each of the above n-grams are stored along with their respective frequencies, which is simply the number of times, the n-gram occurs in the entire document.&lt;/p&gt;
&lt;h4 id=&quot;generating-transition-probabilities&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-transition-probabilities&quot; aria-label=&quot;generating transition probabilities permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating transition probabilities&lt;/h4&gt;
&lt;p&gt;Each n-gram may be regarded as a set of prefix words followed by a next word. The probability of the next word given the prefix words is the transition probability of the word. It is calculated by dividing the number of times the n-gram occurs by the number of times the prefix words occur. Once the transition probabilities have been generated, they can be used to predict words and calculate Perplexity.&lt;/p&gt;
&lt;h3 id=&quot;support-for-n-grams-in-r&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#support-for-n-grams-in-r&quot; aria-label=&quot;support for n grams in r permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Support for n-grams in R&lt;/h3&gt;
&lt;p&gt;R is a programming language that is well suited for performing tasks related to Data Science. A R package is software that performs a specific task. The packages &lt;a href=&quot;https://cran.r-project.org/web/packages/tm/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;tm&lt;/a&gt; and &lt;a href=&quot;https://cran.r-project.org/web/packages/quanteda/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;quanteda&lt;/a&gt; are frameworks for text processing. They provide functions for generating and analyzing n-gram tokens.&lt;/p&gt;
&lt;h3 id=&quot;the-wordpredictor-package&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-wordpredictor-package&quot; aria-label=&quot;the wordpredictor package permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The wordpredictor package&lt;/h3&gt;
&lt;p&gt;I had developed the &lt;a href=&quot;https://github.com/pakjiddat/word-predictor&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;wordpredictor&lt;/a&gt; package as part of the &lt;a href=&quot;https://www.coursera.org/learn/data-science-project&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Data Science Capstone&lt;/a&gt; course on Coursera. The package allows generating and evaluating n-gram models. It also allows predicting words. A &lt;a href=&quot;https://pakjiddat.shinyapps.io/word-predictor/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DEMO application&lt;/a&gt; shows how the wordpredictor package can be used to predict words.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Expressing numbers as a sum of fives and sevens]]></title><description><![CDATA[Recursion is one method for proving statements mathematically. It is a powerful concept that has important applications in Computer Science. In this article I will describe how to use the technique of Recursion to prove a statement mathematically.]]></description><link>https://pakjiddat.netlify.app//posts/expressing-number-as-sum-of-fives-and-sevens</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/expressing-number-as-sum-of-fives-and-sevens</guid><pubDate>Fri, 19 Mar 2021 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I recently took the &lt;a href=&quot;https://www.coursera.org/learn/what-is-a-proof&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;What is a proof&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it very useful. The course provides useful knowledge about mathematical proofs. I found the course very useful and interesting. In this article I will describe one of the problems that were given to the students to solve. The problem is related to the concept of Recursion.&lt;/p&gt;
&lt;p&gt;Recursion is one method for proving statements mathematically. It is a powerful concept that has important applications in Computer Science. In this article I will describe how to use the technique of Recursion to prove a statement mathematically. I will describe two such problems.&lt;/p&gt;
&lt;h3 id=&quot;problem-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-1&quot; aria-label=&quot;problem 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem 1&lt;/h3&gt;
&lt;p&gt;Is is possible to express any number larger than or equal to 8 as a sum of 3s and 5s. For example 8 = 3 + 5, 9 = 3 + 3 + 3, 10 = 5 + 5, 11 = 8 + 3, 12 = 9 + 3, 13 = 10 + 3 and so on.&lt;/p&gt;
&lt;p&gt;If we subtract 3 from a given number, we get another number, if we continue subtracting 3 from the number, we will get a number that is either 8, 9 or 10, which we know can be expressed as a sum of 3s and 5s. The process of subtracting 3 from a number is recursive.&lt;/p&gt;
&lt;h3 id=&quot;problem-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-2&quot; aria-label=&quot;problem 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem 2&lt;/h3&gt;
&lt;p&gt;Write a program that takes a number between 24 and 1000 as parameter and returns a list of all combinations of 5s and 7s that when added up gives a result that is equal to the number that was initially passed as argument. Also find the largest number that cannot be expressed as a sum of fives and sevens.&lt;/p&gt;
&lt;p&gt;If we can find 5 consecutive numbers that can be expressed as a sum of 5s and 7s, then we can express any number larger than the 5 consecutive numbers as a sum of 5s and 7s. We can do this by subtracting 5 from this number until it is equal to one of the 5 consecutive numbers.&lt;/p&gt;
&lt;p&gt;Since we can express the 5 consecutive numbers: 24, 25, 26, 27, 28 as a sum of 5s and 7s, we can express any number larger than 28 as a sum of 5s and 7s. So the largest number that cannot be expressed as a sum of 5s and 7s must be 23.&lt;/p&gt;
&lt;p&gt;The following code can be used to express any number between 24 and 1000 as a sum of fives and sevens:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;
&lt;span class=&quot;token comment&quot;&gt;# Main function that is used to express the given number as a sum of fives and sevens&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;change&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;amount&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    
  &lt;span class=&quot;token comment&quot;&gt;# complete this method&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;26&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;    
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;    
            
  &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;amount &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;24&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; amount &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  coins &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; change&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;amount&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  coins&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;append&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; coins
  
&lt;span class=&quot;token comment&quot;&gt;# Express 50 as a sum of fives and sevens&lt;/span&gt;
coins &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; change&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Print the result&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;coins&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Solving N Diagonal Problem]]></title><description><![CDATA[In the N Diagonal problem, we have a board containing NxN squares. Each square can have 2 diagonals, but the diagonals of neighboring squares should not intersect. A square can have three possible states. Either empty, a left diagonal or a right diagonal. We need to find out if it is possible to have X number of diagonals.]]></description><link>https://pakjiddat.netlify.app//posts/solving-n-diagonal-problem</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/solving-n-diagonal-problem</guid><pubDate>Fri, 19 Mar 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 599px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/ed44b8f9cbb44a46159ea0923fa5d2cc/43142/16-diagonals-on-5x5-board.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 82.91666666666667%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAADQ0lEQVR42m1UaVMTQRTk/1d5lOKFFwp7zszemz2TbGIoD8QLLUVAQBLwX7T9llTUKj+kMvv2Hd39enatWEwxWEwQH9cIT1vEBwWyPcPzENFJi2xXIT6qEfFd/kat8rK3GslhiZA58XGDfN6hvphhLZ63CM8quEc5iyq0wU34s+cIFi0Mf7rdQJvfhb4cwR8/wThdh5oP4U83+3N4VsM7GiA4LZEtxlhLz4cIz1n8LcWsuIf8o4HNxvlixIQRrJMK9a6Lab0B67hA/UFjkt25Ou+HfY05zBH8rMm0w1rChtFiiDS+jfC1A/sgg9s95dQc3iHPo8ewfpSIu00YcxMWh4d8H6hrsIg0fPEcKZEGZJrPiTBhMBLYBynMzwa1uQHNAjlr/oLBPdRE5Ava9xrBjwLqpFyeS2jWqq8JdRVW3RXl6LyBoQ475QMU7xRsJuUXI6QXY1inNdqXFibDR7CJOGU8IUqHNDPqmjFHmgZnS8q9hpwusGMW2tTGnWzC43T/ewaHZxmQsqGJbsFl3GXcnT6DfzigNAX0rtcvp0colGM+uJ8jeJxc+dfgUzeP8Tq5DVU96It8NrLeOPAowyC7C5Osw70co6g2kJJZwD0M5sstR6IXt7nTPES558EhzRmbDnm2qE3K5hmpCvoJ7TKkrayzBt3ONiZciiLDgHl/KItenBhxGVtsHKrrSNhQ7GOzgUPRHWqsSDmlTbYY97N1DPI72CY7/63XL3ZFOeI09SXqN6toG5uLEZEN4wFNXdKDmraw6UfDuGZzh7qpXx1Kmj2v/kNZEVlGTeR8tcFxT1M8OCLyjksQM19tuaHhGX/F7bOhzx4ryiuE+8EKoUMKgkR85tDsHqdX1Fc8qZnrs9jUD9FwGb7Y5lPQX9/8Hw15U0Q30SeghplcNQ4zNHrKRhaHbc+24PICiKbbO1uwGUuaDWRyUzg0/2fLbPSCXqtIw+aWp6QyemX3xh5z0IgNLN6SbEnZFinkjvOdPv3L2MmyoUeqRnxI72neW3XZkdJ9BCzwf03QkLKR5Sz11sPHaIv7/bPU/jE2G8byteFEw0T5j/gVEcSahvaIwiZF60sCtedDczGSF/IiSK74V7QWUPJN/A0CSkAC6CsOBwAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/ed44b8f9cbb44a46159ea0923fa5d2cc/8ac56/16-diagonals-on-5x5-board.webp 240w,
/static/ed44b8f9cbb44a46159ea0923fa5d2cc/d3be9/16-diagonals-on-5x5-board.webp 480w,
/static/ed44b8f9cbb44a46159ea0923fa5d2cc/6407c/16-diagonals-on-5x5-board.webp 599w&quot;
              sizes=&quot;(max-width: 599px) 100vw, 599px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/ed44b8f9cbb44a46159ea0923fa5d2cc/8ff5a/16-diagonals-on-5x5-board.png 240w,
/static/ed44b8f9cbb44a46159ea0923fa5d2cc/e85cb/16-diagonals-on-5x5-board.png 480w,
/static/ed44b8f9cbb44a46159ea0923fa5d2cc/43142/16-diagonals-on-5x5-board.png 599w&quot;
            sizes=&quot;(max-width: 599px) 100vw, 599px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/ed44b8f9cbb44a46159ea0923fa5d2cc/43142/16-diagonals-on-5x5-board.png&quot;
            alt=&quot;NxN board with 16 non intersecting diagonals&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;I took the &lt;a href=&quot;https://www.coursera.org/learn/what-is-a-proof&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;What is a proof&lt;/a&gt; course on &lt;a href=&quot;https://www.coursera.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coursera&lt;/a&gt; and found it very useful. The course provides useful knowledge about mathematical proofs. I found the course very useful and interesting. In this article I will describe one of the problems that were given to the students to solve.&lt;/p&gt;
&lt;p&gt;In the N Diagonal problem, we have a board containing NxN squares. Each square can have 2 diagonals, but the diagonals of neighboring squares should not intersect. A square can have three possible states. Either empty, a left diagonal or a right diagonal. We need to find out if it is possible to have X number of diagonals.&lt;/p&gt;
&lt;h3 id=&quot;solution-overview&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#solution-overview&quot; aria-label=&quot;solution overview permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Solution Overview&lt;/h3&gt;
&lt;p&gt;We have to go one step at a time, from the bottom left square and from left to right. A square can have 3 possible values. 0, 1 and 2. 0 means empty, 1 means diagonal is from right to left. 2 means diagonal is from left to right.&lt;/p&gt;
&lt;p&gt;We can use a list to store the square values in Python. Python does not have built in support for arrays, so we can use a list instead.&lt;/p&gt;
&lt;p&gt;First we need to find all possible values that a square can have. Since each square has three possible values, there are many possible combinations of values of a squares neighbors.&lt;/p&gt;
&lt;p&gt;We can instead check if there is some combination of neighbor values which makes it impossible for the square to have a value of 1. Similarly we need to check if there is some combination of neighbor values which makes it impossible for the square to have a value of 2.&lt;/p&gt;
&lt;p&gt;A square cannot have a value of 1 if the left square has a value of 2 or bottom square has a value of 2 or bottom right square has a value of 1.&lt;/p&gt;
&lt;p&gt;A square cannot have a value of 2 if the left square has a value of 1 or bottom square has a value of 1 or bottom left square has a value of 2.&lt;/p&gt;
&lt;h3 id=&quot;pseudo-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#pseudo-code&quot; aria-label=&quot;pseudo code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Pseudo Code&lt;/h3&gt;
&lt;p&gt;Here is the pseudo code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;function SolveNDiagonal(n, diag_count, arr, index):
    if sum of 1s and 2s in list is more than N, then 
        print list
        exit

    For each x in arr starting from index upto NxN
        values = GetPossibleValuesOfSquareAtX(n, arr, x)
    For each val in values, 
        if val is  more than 0, then
            SolveNDiagonal(n, diag_count, arr, index+1)
            
The function is called as follows:

SolveNDiagonal(n, diag_count, arr, 0)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where &lt;strong&gt;n=5&lt;/strong&gt;, &lt;strong&gt;diag_count=16&lt;/strong&gt;, &lt;strong&gt;arr&lt;/strong&gt; is a Python list initialized with &lt;strong&gt;0s&lt;/strong&gt;. The last parameter is the starting index, which is &lt;strong&gt;0&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;source-code-in-python&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#source-code-in-python&quot; aria-label=&quot;source code in python permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Source code in Python&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Main function&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# n is the number of rows or cols in the board&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# diag_count is the required number of diagonals&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# arr is a list of size NxN&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# index is the starting position&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The function prints state of all squares on the board&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Such that the board has diag_count number of diagonals&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;solve_n_diagonal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; diag_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; index&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;    
 
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; diag_count&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Solved for n = &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; 
            &lt;span class=&quot;token string&quot;&gt;&quot; and diagonal count = &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;diag_count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;    
    &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    exit&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
              
  &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; x &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;index&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; n&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    values &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; get_element_values&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; val &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; values&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;x&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; val
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; val &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        solve_n_diagonal&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; diag_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        
&lt;span class=&quot;token comment&quot;&gt;# The values of neighboring squares&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# We are only concerned with the values of squares on the&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# left, bottom, bottom right and bottom left         &lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_neighbor_values&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  neighbor_values &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;bottom_right&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;bottom_left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 
                     &lt;span class=&quot;token string&quot;&gt;&quot;bottom&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; n &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;x&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt; n &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;x &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; n &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; n &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom_right&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;x&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt; n &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;x &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; n &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom_left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;x&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;      
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;&gt;=&lt;/span&gt; n&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;   
     neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;x&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;      
     
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; neighbor_values
  
&lt;span class=&quot;token comment&quot;&gt;# Get the possible values that the square at position x can have&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The possible values are returned in a list&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_element_values&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;  
  neighbor_values &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; get_neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  values &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  is_one_valid &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;True&lt;/span&gt;
  is_two_valid &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;True&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom_right&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    is_one_valid &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;False&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; neighbor_values&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;bottom_left&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    is_two_valid &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;False&lt;/span&gt;  
    
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; is_one_valid&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    values&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;append&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; is_two_valid&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    values&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;append&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    
  values&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;append&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; values
  
&lt;span class=&quot;token comment&quot;&gt;# Initialize a list of size n*n with 0s  &lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;initialize_array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  arr &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; x &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    arr&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;append&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; arr
     
&lt;span class=&quot;token comment&quot;&gt;# The number of rows or cols in the board      &lt;/span&gt;
n &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The required number of diagonals&lt;/span&gt;
diag_count &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;16&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The list is initialized&lt;/span&gt;
arr &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; initialize_array&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# The main function is called&lt;/span&gt;
solve_n_diagonal&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;n&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; diag_count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code prints the state of each square on a board, such that a square is either empty or it has a diagonal which does not intersect with the diagonals of its neighboring squares.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Containerization - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Docker and LXC/LXD containers:]]></description><link>https://pakjiddat.netlify.app//posts/containerization---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/containerization---quick-tips</guid><pubDate>Sun, 16 Aug 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Docker and LXC/LXD containers:&lt;/p&gt;
&lt;h4 id=&quot;removing-unused-docker-images&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#removing-unused-docker-images&quot; aria-label=&quot;removing unused docker images permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.docker.com/engine/reference/commandline/image_prune/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Removing unused Docker images&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To remove all unused docker images with no associated container enter the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker image prune --all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;getting-console-output-of-docker-container&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#getting-console-output-of-docker-container&quot; aria-label=&quot;getting console output of docker container permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/33083385/getting-console-output-from-a-docker-container&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Getting console output of Docker container&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To get the console output of a Docker container, enter the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker logs [container-id]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To get the console output in real time use the -f switch&lt;/p&gt;
&lt;h4 id=&quot;running-docker-container-in-detached-mode&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-docker-container-in-detached-mode&quot; aria-label=&quot;running docker container in detached mode permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.docker.com/engine/reference/run/#detached--d&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running Docker container in detached mode&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To run a Docker container in detached mode, use the -d switch. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -d [image-name]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;running-a-docker-container-on-server-boot&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-a-docker-container-on-server-boot&quot; aria-label=&quot;running a docker container on server boot permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.docker.com/engine/reference/run/#restart-policies---restart&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running a Docker container on server boot&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The Docker restart policy determines how a Docker container should be restarted once it exits. The restart policy is specified using the —restart flag. The default value of this flag is “no”. To automatically start the container each time the Docker daemon starts, the restart flag should be set to “always”. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run --restart=&quot;always&quot; [image-name]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This can be used to automatically run Docker containers when the server boots.&lt;/p&gt;
&lt;h4 id=&quot;listing-lxc-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#listing-lxc-containers&quot; aria-label=&quot;listing lxc containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linuxcontainers.org/lxc/manpages/man1/lxc-ls.1.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Listing LXC containers&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To list LXC containers, the &lt;strong&gt;lxc-ls&lt;/strong&gt; command should be used. It supports flags for listing running and stopped containers. For example to list all running LXC containers, use the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;lxc-ls --running&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Installing Jahia Community SDK on Debian 9]]></title><description><![CDATA[Jahia is a software company which provides enterprise products and services. Its main products are jContent (a content management system), jExperience (combines customer data with customer management for personalized customer experience and jCustomer (an open source customer data platform). These products are combined in innovative way to provide solutions such as CMS (Customer Management System), PWA (Headless Progressive Web Applications), Customer Portals and more. Jahia provides a 30 day trial period of most of its products and solutions.]]></description><link>https://pakjiddat.netlify.app//posts/installing-jahia-community-sdk-on-debian-9</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-jahia-community-sdk-on-debian-9</guid><pubDate>Sat, 15 Aug 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.jahia.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia&lt;/a&gt; is a software company which provides enterprise products and services. Its main products are jContent (a content management system), jExperience (combines customer data with customer management for personalized customer experience and jCustomer (an open source customer data platform).&lt;/p&gt;
&lt;p&gt;These products are combined in innovative ways to provide solutions such as CMS (Customer Management System), PWA (Headless Progressive Web Applications), Customer Portals and more. Jahia provides a 30 day trial period of most of its products and solutions.&lt;/p&gt;
&lt;p&gt;Jahia is supported by an active &lt;a href=&quot;https://academy.jahia.com/community&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;open source community&lt;/a&gt;. It initiated the &lt;a href=&quot;https://unomi.apache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Unomi&lt;/a&gt; project and is an active contributor to the Karaf and Cellar Apache projects, as well as GraphQL Java. Jahia has hundreds of open source repositories on Git Hub.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://academy.jahia.com/documentation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia documentation site&lt;/a&gt; provides useful documentation for end users, system administrators and developers.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://store.jahia.com/sites/private-app-store/home.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia module store&lt;/a&gt; provides modules that extend Jahia product features.&lt;/p&gt;
&lt;h3 id=&quot;trying-out-jahia&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#trying-out-jahia&quot; aria-label=&quot;trying out jahia permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Trying out Jahia&lt;/h3&gt;
&lt;p&gt;From the Jahia website we can download Jahia (currently at version 8) after creating a user account. The &lt;a href=&quot;https://academy.jahia.com/downloads&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Downloads&lt;/a&gt; section of the website allows downloading Jahia Enterprise and Jahia Community.&lt;/p&gt;
&lt;p&gt;The Jahia Enterprise is available for a 30 day trial period. The community edition contains a preinstalled Jahia instance, a demo website and Jahia Studio, which allows managing Jahia modules, website content and more.&lt;/p&gt;
&lt;p&gt;To try out Jahia, we can install it as a Docker image using the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker pull jahia/jahia-dev:8.0.0.0
docker run -p 8080:8080 jahia/jahia-dev:8.0.0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This provides an Enterprise edition of Jahia for a 30 day period. The Jahia instance can be accessed over port 8080.&lt;/p&gt;
&lt;p&gt;The community edition has the following features: Content editing, Digital asset management, Multi-language management, Search, Digital portal building, Engagement, Web marketing, Ouf-of-the-box mobile readiness and advanced multi-channels features and Developer tools which includes Jahia Studio and Integrated Development Tools.&lt;/p&gt;
&lt;h3 id=&quot;jahia-system-requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jahia-system-requirements&quot; aria-label=&quot;jahia system requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jahia system requirements&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://academy.jahia.com/documentation/system-administrator/jahia/8/installing-and-configuring-jahia/installing-configuring-and-troubleshooting-jahia/prerequisites-and-system-requirements&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia system requirements&lt;/a&gt; are quite demanding. Jahia requires Java JDK version 8 or 11. It requires 4 Gb of RAM and a dual core processor for a development environment and 8 Gb RAM and quad core processor for a production environment.&lt;/p&gt;
&lt;p&gt;Java 8 is the default Java version for Debian 9. It may be installed using the command: &lt;strong&gt;apt-get install default-jdk&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To install JDK version 11, we need to add the backports repository to the apt sources list using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;echo &apos;deb http://ftp.debian.org/debian stretch-backports main&apos; | sudo tee /etc/apt/sources.list.d/stretch-backports.list&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can then install the JDK 11 using the command: &lt;strong&gt;apt-get install openjdk-11-jdk&lt;/strong&gt;. To see which version of Java was installed, enter the command: &lt;strong&gt;java -version&lt;/strong&gt;. The article &lt;a href=&quot;https://linuxconcept.com/install-java-on-debian-9-operating-system/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Install Java on Debian 9 Operating System&lt;/a&gt; describes how to install Java on Debian 9. Java JDK comes in two flavors called OpenJdk and OracleJdk. Installation of both flavors is described in the article.&lt;/p&gt;
&lt;p&gt;Also make sure to set the &lt;strong&gt;JAVA_HOME&lt;/strong&gt; environment variable to the path of the JDK installation. On Debian 9 the location of the JDK is &lt;strong&gt;/usr/lib/jvm/java-11-openjdk-amd64&lt;/strong&gt;. The variable should be set in /home/[user]/.bashrc file, where [user] is the system user account used to run Jahia. For example add following to /home/user/.bashrc file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;export JAVA_HOME=&quot;/usr/lib/jvm/java-11-openjdk-amd64&quot;
export PATH=$JAVA_HOME/bin:$PATH&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;installing-jahia-community&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-jahia-community&quot; aria-label=&quot;installing jahia community permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Jahia community&lt;/h3&gt;
&lt;p&gt;To install Jahia community, we need to first create an account on the Jahia website and then download the community edition zip file. Once the file has been downloaded, it needs to be unzipped. Next we need to run the file &lt;strong&gt;start.sh&lt;/strong&gt;. The command should be run as a non root user. After that Jahia should be up and running. It should be accessible on port 8080.&lt;/p&gt;
&lt;h3 id=&quot;jahia-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jahia-features&quot; aria-label=&quot;jahia features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jahia features&lt;/h3&gt;
&lt;p&gt;I downloaded and installed Jahia first as a Docker image. This provided an out of the box preinstalled Jahia enterprise edition. However it had a 30 day trial period. Next I downloaded the Jahia community edition zip file.&lt;/p&gt;
&lt;p&gt;Both Jahia instances are basically a Content Management System (CMS), which allow managing website content from a back-end area. Modules can be used to add features to the website. These modules provide a wide range of features that can make your website function as a simple CMS, or a CRM (customer relationship management).&lt;/p&gt;
&lt;p&gt;Jahia has a front-end and a back-end. The front-end is simply the front-end of the default website that was created from the Jahia back-end. The Jahia back-end is also called Jahia Studio. It is accessible over port &lt;strong&gt;8080&lt;/strong&gt; on the url &lt;strong&gt;/start&lt;/strong&gt;. For example &lt;strong&gt;&lt;a href=&quot;http://localhost:8080/start&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:8080/start&lt;/a&gt;&lt;/strong&gt;. Jahia Studio allows managing modules, websites, users and groups and more.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://store.ahia.com/sites/private-app-store/home.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia module store&lt;/a&gt; provide a wide range of features. For example there are modules related to Business and Commerce, Collaboration and Document Management, Content Types, Marketing, Portals, Social Networks and User Generated content, Templating and Extensions and Tools and Utilities.&lt;/p&gt;
&lt;p&gt;Depending on the modules installed, your Jahia instance can function as an Ecommerce site, a Blog, as a Social Network or any other type of site that can be created from Jahia modules. The &lt;a href=&quot;https://academy.jahia.com/documentation/system-administrator/jahia/8/server-administration-ui/modules-and-extensions/modules&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jahia documentation on managing modules&lt;/a&gt; describes how to create, install and update Jahia modules.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Jahia is an excellent enterprise content management system. It is very flexible and has a lot of features. It is easy to install and is well documented.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Adding Table of Contents to a Gatsby website]]></title><description><![CDATA[Gatsby is a modern CMS that is well suited for publishing Blog posts. However managing a Gatsby Blog is like managing a web application and can be difficult for those not familiar with Software Development. In this blog post I will describe my experience of adding table of contents to a Gatsby Blog.]]></description><link>https://pakjiddat.netlify.app//posts/adding-table-of-contents-to-gatsby-website</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/adding-table-of-contents-to-gatsby-website</guid><pubDate>Sun, 26 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Gatsby is a modern CMS that is well suited for publishing Blog posts. However managing a Gatsby Blog is similar to managing a web application and can be difficult for those not familiar with Software Development.&lt;/p&gt;
&lt;p&gt;One of the useful features of Gatsby is that it provides a clean separation between the different stages involved in Web Development. For example connecting the blog to a data source, adding features using plugins etc. Features such as Sitemaps, Search Engine Optimization (SEO), Pagination etc can be easily added by installing and configuring plugins. In an earlier post I described my experience with &lt;a href=&quot;/posts/migrating-blog-to-gatsby&quot;&gt;migrating a blog to Gatsby&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Readers of Blog posts can sometimes lose the overall picture when reading long articles. A table of contents describes the main components of an article and gives an overall picture. In this blog post I will describe my experience of adding table of contents to a Gatsby Blog.&lt;/p&gt;
&lt;h3 id=&quot;table-of-contents-script&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#table-of-contents-script&quot; aria-label=&quot;table of contents script permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Table of contents script&lt;/h3&gt;
&lt;p&gt;Gatsby provides a plugin called &lt;a href=&quot;https://www.gatsbyjs.org/packages/gatsby-remark-table-of-contents/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Remark Table of Contents&lt;/a&gt;, which allows adding a table of contents to markdown files. To use the plugin, We would have to add table of contents markdown to all post files. This would take a long time on large blogs. Also if I wanted to update the table of contents layout or position, then I would have to edit all markdown files.&lt;/p&gt;
&lt;p&gt;The Gatsby website is based on the &lt;a href=&quot;gatsbyjs.org/starters/gatsbycentral/gatsby-v2-starter-lumen/&quot;&gt;Lumen Starter Theme&lt;/a&gt;. The theme fetches data from Markdown files using GraphQL. It converts the Markdown to HTML and displays the HTML inside React Js template files.&lt;/p&gt;
&lt;p&gt;The blog was initially based on a custom PHP framework called &lt;a href=&quot;/posts/pak-php-framework&quot;&gt;Pak Php Framework&lt;/a&gt;. I had created a script in PHP language for &lt;a href=&quot;https://gist.github.com/nadirlc/9d1368f86fa3d96bca70a7cd626c8890&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;generating table of contents from HTML text&lt;/a&gt;. I converted this script to JavaScript and used it to generate the table of contents for my new Blog.&lt;/p&gt;
&lt;p&gt;I managed to convert the script and published it as a NPM module. The NPM package is called &lt;a href=&quot;https://www.npmjs.com/package/@pakjiddat/toc&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Node.js Table of Contents Generator&lt;/a&gt;. The script can be used to add table of contents to a Gastby website. It can also be used on other headless CMSs.&lt;/p&gt;
&lt;p&gt;The script takes as input article text in HTML format and produces an unordered nested HTML list, which is the table of contents. The script also returns updated article text, which includes heading ids.&lt;/p&gt;
&lt;h3 id=&quot;adding-table-of-contents-to-gatsby-blog&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-table-of-contents-to-gatsby-blog&quot; aria-label=&quot;adding table of contents to gatsby blog permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding Table of Contents to Gatsby blog&lt;/h3&gt;
&lt;p&gt;To add Table of Contents, you need to follow these steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install the table of contents script using the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; i @pakjiddat/toc &lt;span class=&quot;token parameter variable&quot;&gt;--save&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Create a new Gatsby component called Toc, under the Post component. To create the component, create a folder called Toc under the &lt;strong&gt;src/components/Post&lt;/strong&gt; folder. Add a file to this folder called &lt;strong&gt;Toc.tsx&lt;/strong&gt; with following contents:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;ts&quot;&gt;&lt;pre class=&quot;language-ts&quot;&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; React &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;react&apos;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; tocStyles &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./Toc.module.scss&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Toc&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Component &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; tocList &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;props&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tocList&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; visibilityClass &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;props&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;visibilityClass
    
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;div className&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;tocStyles&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tocList &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; visibilityClass&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; id&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toc-box&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
        &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;h5 className&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;tocStyles&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tocHeader&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;Table Of Contents&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;h5&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
        &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;div dangerouslySetInnerHTML&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;__html&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; tocList&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
      &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;div&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; Toc&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Next add a file called &lt;strong&gt;Toc.module.scss&lt;/strong&gt; in the same folder, with following contents:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;pre class=&quot;language-scss&quot;&gt;&lt;code class=&quot;language-scss&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.tocList &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 15%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 76%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;margin-right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 30px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; fixed&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2px solid gray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;max-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 350px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.tocHeader &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.75rem 1.25rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;margin-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;.03&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px solid &lt;span class=&quot;token function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;.125&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.visible &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.hidden &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;ul &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;margin-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;li &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;margin-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0 &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.sidebarBtns &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; fixed&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 99&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.125rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transparent&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pointer&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.9375rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.25rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;/arrow-up.svg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; no-repeat&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.toggleTocBtn &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;/toggle-toc.svg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; cadetblue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; screen &lt;span class=&quot;token operator&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1200px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token selector&quot;&gt;.tocList &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; relative&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 30%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;Toc.module.scss&lt;/strong&gt; file is used to style the table of contents. Update this file if you want to change the look and feel of the table of contents.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Next add a file called &lt;strong&gt;index.ts&lt;/strong&gt; in the same folder, with following contents:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;ts&quot;&gt;&lt;pre class=&quot;language-ts&quot;&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; Toc &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./Toc&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Next import this component into your blog post template file. This can be done using the following code:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;ts&quot;&gt;&lt;pre class=&quot;language-ts&quot;&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; Toc &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./Toc&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; toc    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;@pakjiddat/toc/index&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; tocStyles &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./Toc/Toc.module.scss&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Next within your blog post template file, generate the table of contents from your article HTML text using:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; tocData &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; toc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Generate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;html&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; page_html &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; tocData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;updatedText&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; toc_list &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; tocData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tocList
  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; visibility_class &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; tocStyles&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;visible
    
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;tocData&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;updatedText &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    page_html &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; post&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;html
    toc_list &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;
    visibility_class &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;hidden&quot;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code assumes that your article HTML text is in the &lt;strong&gt;post.html&lt;/strong&gt; variable&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Next display the updated article text returned by the table of contents script. The updated article text is in the variable: &lt;strong&gt;page_html&lt;/strong&gt;. Use this variable instead of the &lt;strong&gt;post.html&lt;/strong&gt; variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the table of contents component to your post template file using the following code:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;Toc&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;tocList&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;{toc_list}&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;visibilityClass&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;{visibility_class}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After following the above steps you should have a table of contents on each blog post.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The table of contents script requires that your article headings are ordered correctly. i.e lower order headings are nested within higher order headings.&lt;/p&gt;
&lt;h3 id=&quot;future-work&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#future-work&quot; aria-label=&quot;future work permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Future work&lt;/h3&gt;
&lt;p&gt;The table of contents script may be extended so it adds an anchor icon to each article heading. The script may also be extended to support extraction of headings from Markdown files.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this blog post I have described how to add table of contents to a Gatsby Blog. The main steps outlined in the article may be applied to other headless CMSs.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Adding scroll to top button to a Gatsby website]]></title><description><![CDATA[Scrolling to top is a useful feature for Blogs. It allows readers to scroll to the top of the page any time with a single click of a button. In this article I will describe how to add a scroll to top button to a Gatsby website.]]></description><link>https://pakjiddat.netlify.app//posts/adding-scroll-to-top-button-to-gatsby-website</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/adding-scroll-to-top-button-to-gatsby-website</guid><pubDate>Sun, 26 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Scrolling to top is a useful feature for Blogs. It allows readers to scroll to the top of the page any time with a single click of a button. In this article I will describe how to add a scroll to top button to a Gatsby website.&lt;/p&gt;
&lt;h3 id=&quot;client-side-script&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#client-side-script&quot; aria-label=&quot;client side script permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Client side script&lt;/h3&gt;
&lt;p&gt;To add scroll to top feature, we need to add a button and a JavaScript file. The JavaScript file will be used client side. Create a file called gatsby-browser.ts in the root folder. It should have following contents:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;ts&quot;&gt;&lt;pre class=&quot;language-ts&quot;&gt;&lt;code class=&quot;language-ts&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./src/assets/scss/main.scss&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; wrapRootElement &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./internal/gatsby/wrap-root-element&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The SideBarBtns class */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SideBarBtns&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;/** Used to register the scroll event handler */&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** When the user scrolls down 300px from the top of the document, show the buttons */&lt;/span&gt;
    window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;toggleButtons&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** Event handler for toogle toc button */&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toggle-toc-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;toggleTocBox&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** Event handler for scroll to top button */&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollToTop&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;/** Displays/Hides the buttons */&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;toggleButtons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** If the scroll top button does not exist, then function returns */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** If the current current scroll is 300px or more */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The scroll to top button is displayed */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;block&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The toggle toc button is displayed */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toggle-toc-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;block&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The scroll to top button is hidden */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;none&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The toggle toc button is hidden */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toggle-toc-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;none&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;/** When the user clicks on the button, scroll to the top of the document */&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;scrollToTop&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** The user is scrolled to the top of the page */&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;/** When the user clicks on the button, make the toc box invisible */&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;toggleTocBox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** If the toc box is hidden */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toc-box&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;none&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The toc box is displayed */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toc-box&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;block&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** The toc box is displayed */&lt;/span&gt;
      document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;toc-box&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;none&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;load&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;  
      &lt;span class=&quot;token comment&quot;&gt;/** The SideBarBtns object is created */&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sidebarbtns &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SideBarBtns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** If the current page is an article page */&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;/** The SideBarBtns object is initialized */&lt;/span&gt;
        sidebarbtns&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;navigation&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;navigate&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;event&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;  
      &lt;span class=&quot;token comment&quot;&gt;/** The SideBarBtns object is created */&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; sidebarbtns &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SideBarBtns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** If the current page is an article page */&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;scroll-btn&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;/** The SideBarBtns object is initialized */&lt;/span&gt;
        sidebarbtns&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above file will be automatically included by Gatsby.&lt;/p&gt;
&lt;h3 id=&quot;adding-the-scroll-to-top-button&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-the-scroll-to-top-button&quot; aria-label=&quot;adding the scroll to top button permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding the scroll to top button&lt;/h3&gt;
&lt;p&gt;Next add the following scroll to top button to your post template file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;scroll-btn&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;{styles.sidebarBtns&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;styles.scrollBtn}&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Scroll to top&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-label&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Scroll to top&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;styling-the-button&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#styling-the-button&quot; aria-label=&quot;styling the button permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Styling the button&lt;/h3&gt;
&lt;p&gt;Add the following CSS styles to the local &lt;strong&gt;Post.module.scss&lt;/strong&gt; file of your post template component.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.sidebarBtns&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; fixed&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 99&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1.125rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transparent&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; pointer&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.9375rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.25rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string url&quot;&gt;&quot;/arrow-up.svg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; no-repeat&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; center&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;.scrollBtn&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 15%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string url&quot;&gt;&quot;/arrow-up.svg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; burlywood&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The arrow-up icon which is used as the button background can be downloaded from:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;https://pakjiddat.netlify.com/arrow-up.svg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The icon should be placed in a folder called static in the root folder.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this blog post I have described how to add scroll to top button to a Gatsby blog. The button’s style can be changed by editing the given CSS code.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Node.js Table of Contents Generator]]></title><description><![CDATA[Gatsby is a modern CMS that is well suited for publishing Blog posts. However managing a Gatsby Blog is like managing a web application and can be difficult for those not familiar with Software Development. In this blog post I will describe how I managed to add Table of contents to my Gatsby Blog.]]></description><link>https://pakjiddat.netlify.app//posts/nodejs-table-of-contents-generator</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/nodejs-table-of-contents-generator</guid><pubDate>Sun, 26 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The Node.js Table of Contents Generator is a Node.js module for generating table of contents from HTML text.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; i @pakjiddat/toc &lt;span class=&quot;token parameter variable&quot;&gt;--save&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above command will download the package to the &lt;strong&gt;node_modules&lt;/strong&gt; folder. It will also add an entry to your &lt;strong&gt;package.json file&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; toc    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;@pakjiddat/toc/index&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; tocData  &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; toc&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Generate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above command the data parameter is the article text in HTML format. The tocData variable contains the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tocList&lt;/strong&gt;. The table of contents list. It is formatted as a nested unordered HTML list&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;updatedText&lt;/strong&gt;. The updated article text with id attribute added to all the headings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;headingCount&lt;/strong&gt;. The number of headings found in the article&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;errorMsg&lt;/strong&gt;. An error message describing the error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;structure&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#structure&quot; aria-label=&quot;structure permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Structure&lt;/h3&gt;
&lt;p&gt;The only required file is &lt;strong&gt;index.js&lt;/strong&gt; in the root project folder. It contains a single exported class called TOC. The class has one public function called Generate which generates table of contents for the given article text.&lt;/p&gt;
&lt;p&gt;The article text must be in HTML format. It returns the table of contents formatted as a nested unordered HTML list. Each item in the nested list links to a heading in the main article.&lt;/p&gt;
&lt;h3 id=&quot;how-it-works&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-it-works&quot; aria-label=&quot;how it works permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How it works&lt;/h3&gt;
&lt;p&gt;The TOC class extracts all HTML tags from h1 to h6. It then creates an unordered HTML list in the same order as the article headings. It also adds an &lt;strong&gt;id&lt;/strong&gt; attribute to each &lt;strong&gt;h&lt;/strong&gt; tag. This allows the items in the table of contents to link to the headings in the article.&lt;/p&gt;
&lt;p&gt;The TOC class uses a divide and conquer approach based on recursion for extracting the headings from the article text. It first extracts all the h1 tags from the article text. It then extracts the text between each successive h1 tag and then extracts the h2 text from this text. It then extracts the text between each successive h2 tag. In this way it continues until all tags from h1 to h6 have been extracted. If a tag for example h1 is not found, then the next higher order tag which is h2 is extracted.&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The limitations of the package are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It only supports article text in HTML format&lt;/li&gt;
&lt;li&gt;It requires that article headings are arranged in numeric order. i.e high order headings contain lower order headings. For example h1 tags are followed by h2-h6 tags&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;testing&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#testing&quot; aria-label=&quot;testing permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Testing&lt;/h3&gt;
&lt;p&gt;To test the package, extract the file tests/data.zip. This file contains about 150 articles with headings. Copy all articles to the tests/data folder. Next run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;test&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will run the test code in &lt;strong&gt;tests/test.js&lt;/strong&gt;. The test code reads each file in the data folder and extracts the headings from the file. It then checks if the headings have been extracted. In case of errors an error is message is logged to the console.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Evolution of web development]]></title><description><![CDATA[Websites may be developed in different ways. We can code a website from scratch or we can use libraries and frameworks. Or a combination of both approaches. All websites have a front-end end, which is displayed in a web browser to the end user. The website front-end may fetch data from a server. The data provided by the server may reside in flat files or in databases. The server may return raw data or it may process the data and combine it with presentation code.]]></description><link>https://pakjiddat.netlify.app//posts/evolution-of-web-development</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/evolution-of-web-development</guid><pubDate>Mon, 13 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Websites may be developed in different ways. We can code a website from scratch or we can use libraries and frameworks. Or a combination of both approaches. All websites have a front-end end, which is displayed in a web browser to the end user. The website front-end may fetch data from a server. The data provided by the server may reside in flat files or in databases. The server may return raw data or it may process the data and combine it with presentation code.&lt;/p&gt;
&lt;p&gt;There are numerous web development frameworks that use different approaches, but the end result is the same. It is code that runs in a web browser, which may or may not access a web server after the initial load. Thats how websites used to work. A web developer was concerned only with developing websites for browsers.&lt;/p&gt;
&lt;p&gt;During last few years, website usage has become very common and the role of the web developer has consequently evolved. As the demand for websites grew, there was a need for websites that work across different browsers and operating systems. Technologies such as response website design and poly-fills were introduced to meet this demand. Responsive website design is a collection of design practices that allows a website to look the same, irrespective of the browser’s view-port size. Poly-fills provide modern features to older browsers that do not support these features.&lt;/p&gt;
&lt;h3 id=&quot;cross-platform-development&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#cross-platform-development&quot; aria-label=&quot;cross platform development permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Cross platform development&lt;/h3&gt;
&lt;p&gt;More recently there has been a demand for websites that can be accessed from mobiles applications and desktops. The web developer is no longer making websites only for the browser. Businesses want their customers to be able to access their websites from any browser and device. This demand has resulted in technologies such as &lt;a href=&quot;https://electronjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Electron&lt;/a&gt;, &lt;a href=&quot;https://cordova.apache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cordova&lt;/a&gt; and &lt;a href=&quot;https://capacitor.ionicframework.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Capacitor&lt;/a&gt; which allow mobile applications to be developed using the familiar HTML, JavaScript and CSS technology stack. Frameworks such as the &lt;a href=&quot;https://ionicframework.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ionic framework&lt;/a&gt;, allow websites to run on mobile devices, desktops and browsers using a single code base.&lt;/p&gt;
&lt;h3 id=&quot;the-html-javascript-and-css-stack&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-html-javascript-and-css-stack&quot; aria-label=&quot;the html javascript and css stack permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The HTML, JavaScript and CSS stack&lt;/h3&gt;
&lt;p&gt;HTML, JavaScript and CSS are the basic technologies that power websites. Over the years there has been a lot of changes to these technologies. For instance the HTML standard has had different versions such as HTML 4, XHTML and now HTML 5. Similarly CSS has had two major versions. CSS 2 and now CSS 3.&lt;/p&gt;
&lt;p&gt;JavaScript has also had different versions based on the ECMAScript standards. The &lt;a href=&quot;https://en.wikipedia.org/wiki/ECMAScript&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ECMAScript&lt;/a&gt; is a set of specifications for a scripting language. JavaScript implements the ECMAScript standards. ECMAScript has been revised over the years. The most recent version is called ECMAScript 2019.&lt;/p&gt;
&lt;h3 id=&quot;extension-of-javascript-and-the-ecmascript-standard&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#extension-of-javascript-and-the-ecmascript-standard&quot; aria-label=&quot;extension of javascript and the ecmascript standard permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extension of JavaScript and the ECMAScript standard&lt;/h3&gt;
&lt;p&gt;JavaScript was initially designed to run only in web browsers. But now it has been extended and modified to run on servers as well. Frameworks such as &lt;a href=&quot;https://dart.dev/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Dart&lt;/a&gt;, &lt;a href=&quot;https://coffeescript.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CoffeeScript&lt;/a&gt;, &lt;a href=&quot;https://flutter.dev/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Flutter&lt;/a&gt;, &lt;a href=&quot;https://www.typescriptlang.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;TypeScript&lt;/a&gt; and &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Node.js&lt;/a&gt; are all based on JavaScript and ECMAScript standards. They provide new capabilities to the JavaScript language such as static typing and server side rendering.&lt;/p&gt;
&lt;p&gt;Previously JavaScript code only ran on the client side within a web browser. Now it can run on the server side as well. Frameworks such as React and Angular, which are based on Node.js involve JavaScript execution on server side as well as client side. These frameworks are becoming very popular and are commonly being used by web developers these days. These frameworks can be used to write applications that can be deployed across different platforms. For example an application based on React framework can be run as a Hybrid mobile application using the React Native framework or as a desktop application using the Electron framework. The application may be accessed as a normal website from a web browser or as a &lt;a href=&quot;https://web.dev/progressive-web-apps/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Progress Web Applications (PWA)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A Web Developer who is experienced with HTML, JavaScript and CSS should not have problems with learning the new frameworks such as &lt;a href=&quot;https://reactjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;React&lt;/a&gt;, &lt;a href=&quot;https://angular.io/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Angular&lt;/a&gt; and &lt;a href=&quot;https://vuejs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Vue&lt;/a&gt;. The main difference between these frameworks and the pure JavaScript approach is that these frameworks use a declarative approach towards programming as apposed to the commonly used procedural approach.&lt;/p&gt;
&lt;h3 id=&quot;declarative-vs-procedural-approach&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#declarative-vs-procedural-approach&quot; aria-label=&quot;declarative vs procedural approach permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Declarative vs Procedural approach&lt;/h3&gt;
&lt;p&gt;In the declarative approach the programmer is simply concerned with flow of the application. He is not concerned with the low level technical details. In procedural programming the programmer is concerned with the low level details. Procedural programming has limitations and may not be suitable in certain cases. For example development of a website that needs to work across various devices and browser sizes, is not feasible using the Procedural approach. The developer has to be concerned with too many low level details.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The role of web developers is becoming more and more specialized and focused. New frameworks and tools are being introduced for accomplishing work efficiently. Basic knowledge about the new tools and technologies can be very useful. For example having a good knowledge of a framework such as Gatsby can allow one to develop websites efficiently and according to customer requirements.&lt;/p&gt;
&lt;p&gt;Previously a web developer was only concerned with making websites following a simple workflow. Web Development has changed and now requires knowledge of many different subjects. A Web Develop may benefit from knowledge of Software Engineering methodologies such as Agile. He may need to add features to a website that requires knowledge about machine learning and artificial intelligence. He may also benefit from knowledge outside the domain of computer science that is relevant to the website.&lt;/p&gt;
&lt;p&gt;Web Development is an exciting occupation that can provide opportunity to learn new things. The main requirement for becoming a successful web developer in my opinion is to keep learning and refreshing ones knowledge about areas that are related to ones work.&lt;/p&gt;
&lt;p&gt;In my opinion, it is important for a web developer to keep him self updated about the latest trends in web development. Instead of focusing only on the day to day businesses requirements, he should learn about the new trends in web development. Learning new things keeps the mind healthy and productive and helps in all areas of life.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Migrating blog to Gatsby]]></title><description><![CDATA[Gatsby is a modern framework for developing websites. It requires knowledge of the React JavaScript framework and Node.js. Gatsby uses an innovative approach toward developing websites which is quite different from the common website development workflow.]]></description><link>https://pakjiddat.netlify.app//posts/migrating-blog-to-gatsby</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/migrating-blog-to-gatsby</guid><pubDate>Sun, 12 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/6f36c6b5a3d6a4acf5eda56091d141e7/c367c/pakjiddat-website.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 41.66666666666667%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABFklEQVR42oVR2W6EMAzc//+BfkH73s9oX1qxZdVjeesFZBcScnAkmSYGKmiR1pLlHPbYM9457xDt/v0RV3c3dPbeU7TWIs9z8HMBw0sYwWC0gpQSTdNgGAYsLdbt3FScfB5w/XC7Auz7HmmaYv+0x+EQYpIgyzIwxqiRUopy53wCnNFtN0ALBa01jDH06ZwDK0sURUEgc6yqipyV43kTsOs6nM4nCCFGwADmnEcjDVEbG1hqEqVw9O9+wf4Btm1LvrRYUNUcpqnhOoVLtgKMQnPOVxrGyY7HN7y+POP762NahiAWcSlLeTYotyFJ/pkwUtZQoVBIRQ0jWF3X4MEjo0h/c8J4sZMuyzepNIbOhK0FOby7SPkHl09umsNvUDYAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/6f36c6b5a3d6a4acf5eda56091d141e7/8ac56/pakjiddat-website.webp 240w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/d3be9/pakjiddat-website.webp 480w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/e46b2/pakjiddat-website.webp 960w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/873f3/pakjiddat-website.webp 1349w&quot;
              sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/6f36c6b5a3d6a4acf5eda56091d141e7/8ff5a/pakjiddat-website.png 240w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/e85cb/pakjiddat-website.png 480w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/d9199/pakjiddat-website.png 960w,
/static/6f36c6b5a3d6a4acf5eda56091d141e7/c367c/pakjiddat-website.png 1349w&quot;
            sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/6f36c6b5a3d6a4acf5eda56091d141e7/d9199/pakjiddat-website.png&quot;
            alt=&quot;Pak Jiddat Website&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.gatsbyjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gatsby&lt;/a&gt; is a modern framework for developing websites. It requires knowledge of the React JavaScript framework and Node.js. Gatsby uses an innovative approach toward developing websites which is quite different from the common website development workflow.&lt;/p&gt;
&lt;p&gt;The main benefit of using Gatsby is that is provides a clean separation of all the steps involved in web site development. Each step in the web development cycle is well documented and easy to implement. For example website data is fetched using the GraphQL query language. The website front-end is implemented using React components. Website optimization is accomplished using web pack. Gatsby also provides a continuous integration workflow and supports static site hosting services such as &lt;a href=&quot;https://www.netlify.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Netlify&lt;/a&gt;. Netlify has a free plan which allows free hosting of static websites.&lt;/p&gt;
&lt;p&gt;Gatsby websites are developed using React framework. Once a website has been developed, it is deployed as static HTML pages. The websites pages are loaded dynamically using JavaScript.&lt;/p&gt;
&lt;p&gt;I decided to migrate my web development blog to Gatsby mainly because of the learning experience and also to save cost. My blog was based on a custom made PHP Framework. The blog worked well, but was difficult to update and also was expensive to host.&lt;/p&gt;
&lt;p&gt;It seemed to me there is no reason to pay for hosting a blog, when you can host one for free. I decided to switch to Gatsby because it provides an innovative approach towards web development and also because it produces static websites, which can be hosted for free.&lt;/p&gt;
&lt;p&gt;Gatsby provides a component based, declarative approach towards website development, which is a refreshing change from the procedural approach commonly used for developing websites. Usually when developing websites, we need to be concerned with the low level details of each feature. With Gatsby, we can add features easily by simply installing and configuring pre-built components.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.gatsbyjs.org/docs/quick-start/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gatsby Quick Start guide&lt;/a&gt; describes how to install Gatsby. Gatsby is installed as a Node.js package from the command line using:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-g&lt;/span&gt; gatsby-cli&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To create a new site, enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gatsby new gatsby-site&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We may specify a starter template in the above command. Gatsby has hundreds of &lt;a href=&quot;https://www.gatsbyjs.org/starters/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;starter templates&lt;/a&gt; that can be used as a starting point for creating a website. Next start a development server by entering the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gatsby develop&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start a development server on port 8000. You should be able to access the website on: &lt;a href=&quot;http://localhost:8000&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:8000&lt;/a&gt;. If you edit any files in the &lt;strong&gt;src/pages&lt;/strong&gt; folder, It will cause the website to automatically reload in the browser and reflect the changes made to the files. Once the website has been developed it can be deployed as static HTML files using the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gatsby build
gatsby serve&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first command will generate static HTML files, while the second command will start a web server for serving the files. The &lt;a href=&quot;https://www.gatsbyjs.org/tutorial/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gatsby Tutorial page&lt;/a&gt; provides useful tutorials for getting started with Gatsby web development.&lt;/p&gt;
&lt;h3 id=&quot;gatsby-plugins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#gatsby-plugins&quot; aria-label=&quot;gatsby plugins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Gatsby plugins&lt;/h3&gt;
&lt;p&gt;Gatsby has hundreds of &lt;a href=&quot;https://www.gatsbyjs.org/plugins/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;plugins&lt;/a&gt; that can be used to add features to your website. For example there are plugins for adding sitemap functionality, table of contents, SEO, Authentication, data loading and transformation, Pagination, Forms, RSS Feeds, Comments and more. Gatsby plugins are installed as NPM modules from the command line. Each plugin has its own configuration details.&lt;/p&gt;
&lt;h3 id=&quot;loading-data&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#loading-data&quot; aria-label=&quot;loading data permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Loading data&lt;/h3&gt;
&lt;p&gt;Data can be loaded to a Gatsby site by using the Gatsby CreatePages API or by using GraphQL. Small sites should use the CreatePages API, while large sites should consider using GraphQL. GraphQL was developed by Facebook and is the most common method used for loading data into React components.&lt;/p&gt;
&lt;p&gt;Gatsby can load data from different sources, such as MarkDown files, WordPress, Headless CMSs and more.&lt;/p&gt;
&lt;h3 id=&quot;website-deployment&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#website-deployment&quot; aria-label=&quot;website deployment permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Website Deployment&lt;/h3&gt;
&lt;p&gt;Gatsby provides support for deploying to different static site hosting providers. The &lt;a href=&quot;https://www.gatsbyjs.org/docs/deploying-and-hosting/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gatsby Deployment and hosting guide&lt;/a&gt; lists all the hosting providers supported by Gatsby.&lt;/p&gt;
&lt;p&gt;To deploy a Gatsby site to &lt;a href=&quot;https://www.gatsbyjs.org/docs/deploying-to-netlify/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Netlify&lt;/a&gt;, we need to first commit the website to a Git Hub repository. Next we need to sign-up for a Netlify account. After that we need to create a new site in Netlify and connect the site with our Gatsby repository. The site should have a unique name.&lt;/p&gt;
&lt;p&gt;Once the repository is connected to our Netlify site, the site is built by Netlify and then deployed to a Content Delivery Network (CDN). The website should now be accessible on the URL: &lt;a href=&quot;https://your-site.netlify.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://your-site.netlify.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Netlify automatically provides HTTPS for the website. Every time we make a commit to the Git Hub repository, Netlify builds the Gatsby site and deploys the static content to its Content Delivery Network (CDN). This provides a continuous integration approach for developing the website.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In my opinion Gatsby is an excellent option for hosting blogs. It is well suited for use by web developers. It provides an innovative approach to website development which is quite different from that used by frameworks such as LAMP (Linux, Apache, MySQL, PHP) and ASP.net. It cleanly separates the main web development tasks. It is well documented and has an active open source community.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Separating source code and development environment using Docker]]></title><description><![CDATA[A common problem faced by developers involves setting up development environments. Tools such as Docker and Vagrant allow separating source code and development environments.]]></description><link>https://pakjiddat.netlify.app//posts/separating-source-code-and-development-environment-using-docker</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/separating-source-code-and-development-environment-using-docker</guid><pubDate>Mon, 30 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;A common problem faced by developers involves setting up development environments. Tools such as Docker and Vagrant allow separating source code and development environments.&lt;/p&gt;
&lt;p&gt;These tools can be used in different ways leading to different possible workflows for developers. In this article I will describe a useful workflow based on Docker. The main benefit of this workflow is that it allows separating source code and development environment.&lt;/p&gt;
&lt;h3 id=&quot;concept&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#concept&quot; aria-label=&quot;concept permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Concept&lt;/h3&gt;
&lt;p&gt;The main idea behind the workflow is to separate the application source code from the development environment. The source code is kept on the host computer and mounted in the Docker container. The Docker container runs the development environment.&lt;/p&gt;
&lt;p&gt;Currently 3 development environments are supported. LAMP (for creating applications based on LAMP stack), NodeJs (for creating applications based on Node.js) and R-Env (for creating applications based on R Programming language)&lt;/p&gt;
&lt;p&gt;Each development environment has its own Docker image. For example to develop Nodejs applications, you need to use the Nodejs Docker image. To develop LAMP based applications, you need to use the LAMP docker image.&lt;/p&gt;
&lt;p&gt;The workflow for each development environment is the same. You need to first download a Docker image, then download and extract the base directory structure for the development environment. The base directory structure is provided as a zip file. See the following guides on how to develop applications for each development environment:&lt;/p&gt;
&lt;h3 id=&quot;usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/docker-workflows/tree/master/lamp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Guide for creating LAMP applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/docker-workflows/tree/master/nodejs&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Guide for creating NodeJs applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/docker-workflows/tree/master/r-env&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Guide for creating R applications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusions&quot; aria-label=&quot;conclusions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusions&lt;/h3&gt;
&lt;p&gt;Docker is a useful tool that simplifies developer workflow. It allows developers to focus on developing applications instead of managing the development environment.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Pak Php CRM]]></title><description><![CDATA[Pak Php CRM is a simple web based task management application. It can be used by web developers to keep track of tasks, income, billing, goals and more.]]></description><link>https://pakjiddat.netlify.app//posts/pak-php-crm</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/pak-php-crm</guid><pubDate>Sat, 28 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/79dad2c608e61b0a7f3e2bc51e048830/8c557/pak-php-crm.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 41.66666666666667%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAACDElEQVR42jWRS08TYRSG53ewcOmK4I/Q4I6dLrzsSYgmxhUGKLXaQstFSYGqQG9UWryAKJoYF2oaEAgWKFAUIUYShBLoTKczpdOZefxay/ny5D3n5M05OfmkyNYU47szBN6M0e320t7aiqOjg4duN06nk3ZHZ1UrODodtDnaanknLpezhgufz4d/0I+kqTp64ZRKWIaBlUhgNjfDzesc9g9zNwUX35pcegdd6T2Gf4e5nfJwLxMgvTeImr2Fqd/BVF2oqoxkGhq2WaoOLBTylFpaMBsa4FwdP5quURc1kNxZJE+Ry68/0/jpKhemm6ifucLH1A2UnfMYR/UUDxs5yv5F6ltU6VrQeLBUIrVfgNQqdnIZ5pYprmwz/weSu5YA1vdl4VljbT8jNIOu7oC+IljF0jZQFAVp/leWtYMim8c2BzmN2PYHfD8n6NmO07sVY3hjlMDmWJXB9RDPNicZzbwkuPWKgXScoY0pHqVfEMy8JyfnkLAtbPEqUSxoTKSnuf+lD8/XAbrnhnDXcCX9eIT2fx/BuxDA+y1A79JTHi+N0LMY4Ekqipw7QaqMOkMczKllo5csTss2pmialvgs+2ylWFqyUXVDeMxqXbYsjLLwC6Micqnatf/bS8kkhXAIORomFwpyHBzjRNQniTjKZJziZAI9PoEyHkGOhNHiz8nHxlFiUfKRENrsLP8A0a4K5SGTOUgAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/79dad2c608e61b0a7f3e2bc51e048830/8ac56/pak-php-crm.webp 240w,
/static/79dad2c608e61b0a7f3e2bc51e048830/d3be9/pak-php-crm.webp 480w,
/static/79dad2c608e61b0a7f3e2bc51e048830/426ac/pak-php-crm.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/79dad2c608e61b0a7f3e2bc51e048830/8ff5a/pak-php-crm.png 240w,
/static/79dad2c608e61b0a7f3e2bc51e048830/e85cb/pak-php-crm.png 480w,
/static/79dad2c608e61b0a7f3e2bc51e048830/8c557/pak-php-crm.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/79dad2c608e61b0a7f3e2bc51e048830/8c557/pak-php-crm.png&quot;
            alt=&quot;Pak Php CRM&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Pak Php CRM is a simple web based task management application. It can be used by web developers to keep track of tasks, income, billing, goals and more.&lt;/p&gt;
&lt;p&gt;Pak Php CRM is written in PHP language and uses MySQL for storing data. It is based on the &lt;a href=&quot;/posts/pak-php-framework&quot;&gt;Pak Php Framework&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The main idea behind the Pak PHP CRM is to provide a simple application for managing basic developer tasks such as task management, time tracking, project management etc. The application can be easily customized. The idea is to allow developers to create simple applications quickly using form and table widgets.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Pak PHP CRM allows time tracking, management of tasks, goals, income, billing, loans, products and services, customers and projects&lt;/li&gt;
&lt;li&gt;It allows user management&lt;/li&gt;
&lt;li&gt;It can easily be extended with more features&lt;/li&gt;
&lt;li&gt;The website front-end is based on &lt;a href=&quot;https://www.w3schools.com/w3css/default.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WC.CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The website back-end is written in PHP&lt;/li&gt;
&lt;li&gt;The website is mobile friendly&lt;/li&gt;
&lt;li&gt;The website has good browser response time&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#requirements&quot; aria-label=&quot;requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The Pak Php CRM is based on PHP and MySQL. Installing the website on your own server requires Php 7.2 and above. The website source code is based on the Pak Php Framework. The source code is fully commented and compliant with the PSR-2 coding guidelines. The source code for the website is modular and easy to extend with new features.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The following steps can be used to install the Pak Php CRM application on your own server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://github.com/pakjiddat/pak-php-crm.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code&lt;/a&gt; from GitHub&lt;/li&gt;
&lt;li&gt;Move the source code to the document root of a virtual host&lt;/li&gt;
&lt;li&gt;Create a database and import the contents of the file: &lt;strong&gt;crm/data/pak-php-crm.sql&lt;/strong&gt; to the database. Note down the credentials used for connecting to the database&lt;/li&gt;
&lt;li&gt;Enter the database credentials in the file &lt;strong&gt;crm/config/RequiredObjects.php&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the file: &lt;strong&gt;crm/Config.php&lt;/strong&gt;, on &lt;strong&gt;line 41&lt;/strong&gt; enter the domain names that will be used to access the website&lt;/li&gt;
&lt;li&gt;Customize the following variables in the file: &lt;strong&gt;crm/config/General.php. $config[‘app_name’], $config[‘dev_mode’] and $config[‘site_url’]&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Set the &lt;strong&gt;$config[‘pear_folder_path’]&lt;/strong&gt; variable in the file: &lt;strong&gt;crm/config/Path.php&lt;/strong&gt;. The variable should be set to the path of the pear installation.&lt;/li&gt;
&lt;li&gt;Visit the website in a browser&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Installing Ghost on Debian Stretch]]></title><description><![CDATA[Ghost is an open source blogging platform similar to WordPress. It is based on a modern web architecture and has very good performance and security. It is very popular and is used by major corporations including Mozilla, NASA, Apple and more.]]></description><link>https://pakjiddat.netlify.app//posts/installing-ghost-on-debian-stretch</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-ghost-on-debian-stretch</guid><pubDate>Fri, 24 Jan 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Ghost_(blogging_platform)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ghost&lt;/a&gt; is an open source blogging platform similar to WordPress. It is based on a modern web architecture and has very good performance and security. It is very popular and is used by major corporations including Mozilla, NASA, Apple and more.&lt;/p&gt;
&lt;h3 id=&quot;ghost-architecture&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-architecture&quot; aria-label=&quot;ghost architecture permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost Architecture&lt;/h3&gt;
&lt;p&gt;Ghost is based on the Node.js platform. It is completely written in JavaScript. It is easy to install and use. According to the &lt;a href=&quot;https://ghost.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ghost website&lt;/a&gt;, the performance of Ghost is 19 times that of WordPress.&lt;/p&gt;
&lt;h4 id=&quot;the-jamstack&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-jamstack&quot; aria-label=&quot;the jamstack permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Jamstack&lt;/h4&gt;
&lt;p&gt;Ghost is based on an modern architecture for websites known as &lt;a href=&quot;https://jamstack.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jamstack&lt;/a&gt;. The JAM stands for JavaScript, APIs and Markdown. A Jamstack is essentially a static website which uses API calls to load content.&lt;/p&gt;
&lt;p&gt;Static site generators such as Jekyll, Next, Nuxt and Gatsby are used to develop Jamstack sites. A Jamstack site consists of plain html pages containing CSS and JavaScript only. The HTML pages can be deployed to a content delivery network (CDN) and delivered to browsers efficiently and with minimum latency.&lt;/p&gt;
&lt;p&gt;Jamstack sites do not require a web server. They usually load much faster and are more secure than websites with a backend such as WordPress and Drupal. Jamstack sites provide a better developer experience since they decouple features. They are also cheaper to scale.&lt;/p&gt;
&lt;h4 id=&quot;ghost-components&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-components&quot; aria-label=&quot;ghost components permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost components&lt;/h4&gt;
&lt;p&gt;Ghost consists of 3 main components. A Node.js based API, an admin client based on Ember.js and a frontend theme layer based on Handlebars.js. Ghost is also a headless CMS, which means the backend and frontend are decoupled and can be used independantly of each other. Content published using the Ghost admin can be displayed on a frontend site created using a framework such as &lt;a href=&quot;https://nextjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Next&lt;/a&gt;, &lt;a href=&quot;https://nuxtjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Nuxt&lt;/a&gt; or &lt;a href=&quot;https://www.gatsbyjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gatsby&lt;/a&gt;. The frontend site contains only HTML pages and is termed as the Jamstack site.&lt;/p&gt;
&lt;h4 id=&quot;ghost-storage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-storage&quot; aria-label=&quot;ghost storage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost storage&lt;/h4&gt;
&lt;p&gt;Ghost uses the &lt;a href=&quot;http://bookshelfjs.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bookshelf.js ORM&lt;/a&gt; for accessing the data. This allows a wide range of databases to be used with Ghost. Sqlite3 and MySQL databases are officially supported and recommended for development and production use respectively. Ghost uses the local file system for storing images. Other storage types are supported such as S3, Content Delivery Networks (CDNs), databases, Google Cloud Storage and more.&lt;/p&gt;
&lt;h3 id=&quot;installing-and-running-ghost&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-and-running-ghost&quot; aria-label=&quot;installing and running ghost permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing and running Ghost&lt;/h3&gt;
&lt;p&gt;Ghost has several installation options. Ghost Pro is a fully managed platform as a service which allows your Ghost site to be managed and run on the cloud. Ghost may also be installed locally from source for development, deployed within a Docker container or installed locally as a site.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://ghost.org/docs/install/local/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;A local installation of Ghost&lt;/a&gt; requires a &lt;a href=&quot;https://ghost.org/faq/node-versions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;recent version of Node.js&lt;/a&gt;. Node versions 8, 10 and 12 are supported. Ghost requires about 1 GB of RAM. Ubuntu Operating system versions 16.04 and 18.04 are officially supported.&lt;/p&gt;
&lt;p&gt;To install Ghost as a local site run the command: &lt;strong&gt;npm install ghost-cli@latest -g&lt;/strong&gt;. This will install the Ghost command line interface tool as a global NPM application. To create a new site, simply change to the installation directory of your choice and enter the command: &lt;strong&gt;ghost install local&lt;/strong&gt;. This will create a new installation of a Ghost site.&lt;/p&gt;
&lt;p&gt;Next enter the command: &lt;strong&gt;ghost start&lt;/strong&gt;. This will start a web server on &lt;strong&gt;port 2368&lt;/strong&gt;. You should be able to access the Ghost site on: &lt;strong&gt;&lt;a href=&quot;http://localhost:2368&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:2368&lt;/a&gt;&lt;/strong&gt;. The Ghost Admin can be accessed on: &lt;strong&gt;&lt;a href=&quot;http://localhost:2368/ghost&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:2368/ghost&lt;/a&gt;&lt;/strong&gt;. To stop the Ghost server enter the command: &lt;strong&gt;ghost stop&lt;/strong&gt; from the folder containing the Ghost site.&lt;/p&gt;
&lt;p&gt;To run your Ghost site automatically on server boot, install the forever and forever-service NPM modules globally using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;npm install -g forever
npm install -g forever-service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next install the Ghost service using the command: &lt;strong&gt;forever-service install [service-name] —script versions/[version-name]/index.js&lt;/strong&gt;. The command should be issued from the site root folder. Replace [service-name] with the name of the service such as Ghost. Replace [version-name] with the current version of the Ghost CMS. Your Ghost site will now start automatically on server boot. Also you can manage your Ghost site as a system service. For example you can stop the site using the command: &lt;strong&gt;service ghost stop&lt;/strong&gt;. You can start the site using the command: &lt;strong&gt;service ghost start&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;configuring-ghost&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-ghost&quot; aria-label=&quot;configuring ghost permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring Ghost&lt;/h3&gt;
&lt;p&gt;Ghost can be configured by simply editing configuration files. By default Ghost is installed in development mode with &lt;strong&gt;SQLite3&lt;/strong&gt; database. To switch to production mode set an environment variable using the command: &lt;strong&gt;NODE_ENV=production node index.js&lt;/strong&gt;. The configuration file for development mode is &lt;strong&gt;config.development.json&lt;/strong&gt;, while the configuration file for production mode is: &lt;strong&gt;config.production.json&lt;/strong&gt;. The configuration files are in JSON format. The main configuration options are &lt;strong&gt;URL, database and mail&lt;/strong&gt;. The &lt;a href=&quot;https://ghost.org/docs/concepts/config/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ghost configuration guide&lt;/a&gt; describes the different Ghost configuration options.&lt;/p&gt;
&lt;h3 id=&quot;how-to-use-ghost&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-to-use-ghost&quot; aria-label=&quot;how to use ghost permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How to use Ghost&lt;/h3&gt;
&lt;h4 id=&quot;ghost-workflow&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-workflow&quot; aria-label=&quot;ghost workflow permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost workflow&lt;/h4&gt;
&lt;p&gt;The workflow for using Ghost as a headless CMS is very simple. The user authors the content using the Ghost admin client. The content is then provided to a frontend framework such as Next, Nuxt or Gatsby using the Ghost API. The frontend framework then generates the static HTML pages.&lt;/p&gt;
&lt;h4 id=&quot;the-ghost-admin&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-ghost-admin&quot; aria-label=&quot;the ghost admin permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Ghost admin&lt;/h4&gt;
&lt;p&gt;The Ghost admin is a simple frontend, which uses the Ghost Admin API for saving and retrieving content. The Ghost admin can be accessed from the URL: &lt;strong&gt;&lt;a href=&quot;http://your-domain/ghost&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://your-domain/ghost&lt;/a&gt;&lt;/strong&gt;. The Ghost admin allows creating posts and pages. It also allows creating tags and users.&lt;/p&gt;
&lt;p&gt;The settings area allows installing the front-end theme. The theme can be installed by uploading a zip file.The Ghost admin allows managing the navigation menu items. It also allows importing and exporting content and deleting all content&lt;/p&gt;
&lt;h4 id=&quot;the-ghost-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-ghost-api&quot; aria-label=&quot;the ghost api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Ghost API&lt;/h4&gt;
&lt;p&gt;Ghost provides a content API as well as an admin API. The content API allows front-end frameworks to access content. The admin API allows content authoring applications to post content. This allows publishers to use their favorite authoring application, without being concerned with the front-end. The Ghost API decouples the front-end and admin features and allows Ghost to work as a Headless CMS.&lt;/p&gt;
&lt;h4 id=&quot;ghost-themes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-themes&quot; aria-label=&quot;ghost themes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost themes&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://ghost.org/docs/api/v3/handlebars-themes/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ghost themes&lt;/a&gt; are based on the Handlebars template language, which provides a separation between the HTML and the dynamic JavaScript. The Handlebars language uses helpers to insert dynamic content. Quality free and paid Ghost themes can be purchased from the &lt;a href=&quot;https://ghost.org/marketplace/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ghost marketplace&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;ghost-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ghost-features&quot; aria-label=&quot;ghost features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ghost features&lt;/h3&gt;
&lt;p&gt;Ghost provides mobile and desktop apps for authoring content. It also has built in support for SEO, Accelerated Mobile Pages (AMP), Detailed Structured data and Subscription by RSS, Email and Slack.&lt;/p&gt;
&lt;p&gt;Ghost has hundreds of &lt;a href=&quot;https://ghost.org/integrations/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;integrations&lt;/a&gt; with popular tools and services, including Discourse, Slack, Google Analytics, Zapier and more.&lt;/p&gt;
&lt;p&gt;Ghost has a built in &lt;a href=&quot;https://ghost.org/members/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;membership and subscription feature&lt;/a&gt;. It allows website owners to generate revenue by providing paid membership and subscription services. The membership and subscription feature is currently an experimental feature that needs to be enabled from the Ghost admin.&lt;/p&gt;
&lt;h3 id=&quot;publishing-ghost-sites-using-netlify&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#publishing-ghost-sites-using-netlify&quot; aria-label=&quot;publishing ghost sites using netlify permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Publishing Ghost sites using Netlify&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.netlify.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Netlify&lt;/a&gt; is a service that automates deployment of Jamstack sites. It provides a continous delivery workflow for publishing Jamstack sites. The Ghost has an &lt;a href=&quot;https://ghost.org/integrations/netlify/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;integration plugin for Netlify&lt;/a&gt; that allows Ghost sites to be deployed using the Netlify service.&lt;/p&gt;
&lt;p&gt;To use Netlify, the user has to publish the markdown files containing the website content to an online version control repository such as GitHub or BitBucket. When the user makes a commit, Netlify fetches the markdown files and runs a command which generates the static html pages. The html pages are then deployed to a content delivery network (CDN). Netlify allows custom domains, HTTPs and has a free plan.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Ghost is light weight CMS built on modern web technologies. It is a headless CMS and can be integrated with other frameworks and services. It is good option for use as a simple blog, single page applications or small company website.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Building Ionic Cordova applications for Android on Debian 10]]></title><description><![CDATA[Cordova is a platform that allows development of Mobile applications using HTML, CSS and JavaScript. These applications can be run on all major mobile platforms, which are Android, IOS and Windows Phone.]]></description><link>https://pakjiddat.netlify.app//posts/building-ionic-cordova-applications-for-android-on-debian-10</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/building-ionic-cordova-applications-for-android-on-debian-10</guid><pubDate>Wed, 27 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://cordova.apache.org/docs/en/latest/guide/platforms/android/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cordova&lt;/a&gt; is a platform that allows development of Mobile applications using HTML, CSS and JavaScript. These applications can be run on all major mobile platforms, which are Android, IOS and Windows Phone.&lt;/p&gt;
&lt;p&gt;The Cordova platform essentially creates a native application for the configured platform. The native application uses a WebView to run the application. A WebView is a browser run-time component for native mobile applications. A WebView runs HTML, CSS and JavaScript code just like a desktop browser.&lt;/p&gt;
&lt;p&gt;Applications created using Cordova are termed as hybrid mobile applications, because they are a combination or hybrid of native applications and browser based applications. Native applications are applications that are installed on a mobile device. Browser based applications are applications that are accessed using a mobile device’s web browser&lt;/p&gt;
&lt;p&gt;The Android emulator is an application that allows running different types of Android based devices in a simulated environment. The emulator works just like the actual device. It allows debugging and testing Android applications.&lt;/p&gt;
&lt;p&gt;The Cordova platform allows building and deploying applications written in HTML, CSS and JavaScript to real mobile devices or emulators. Each platform such as Android or IOS has its own emulator. Cordvoa also provides a live reloading feature. This feature allows automatically updating an application in a real device or emulator once it has been updated by the user. This saves the developer a lot of time and effort.&lt;/p&gt;
&lt;p&gt;Cordova applications can be easily tested on emulators. The emulator needs to be installed and configured for the required platform. The emulator for IOS platform is only available on IOS devices.&lt;/p&gt;
&lt;p&gt;For the Android platform installing the emulator requires installing the Android Studio. On Linux based systems, the Android Studio requires a graphical desktop environment such as Gnome or KDE. The Android studio has many features and may not be needed during development of the Cordova application. In this article I will describe how to run an Ionic Cordova application on an Android emulator without installing Android Studio.&lt;/p&gt;
&lt;h3 id=&quot;installing-the-cordova-android-requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-the-cordova-android-requirements&quot; aria-label=&quot;installing the cordova android requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing the Cordova Android requirements&lt;/h3&gt;
&lt;p&gt;In order to build and deploy Cordova applications on an Android emulator, we need the to install Android SDK, Gradle and Java Development Kit (JDK) version 8. Cordova only supports JDK 8. To find out if the requirements have been correctly installed, enter the command &lt;strong&gt;cordova requirements&lt;/strong&gt; from the root folder of the Cordova application.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://cordova.apache.org/docs/en/latest/guide/platforms/android/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Cordova Platform Guide&lt;/a&gt; describes which version of Cordova supports which Android versions. It also describes how to install and configure the requirements for the Android platform.&lt;/p&gt;
&lt;h4 id=&quot;installing-jdk-8&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-jdk-8&quot; aria-label=&quot;installing jdk 8 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing JDK 8&lt;/h4&gt;
&lt;p&gt;To install JDK 8, simply download the JDK 8 zip file from the &lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Java Oracle website&lt;/a&gt;. Download the file and extract it to &lt;strong&gt;/opt&lt;/strong&gt;, or some other folder of your choice.&lt;/p&gt;
&lt;p&gt;Next set the &lt;strong&gt;JAVA_HOME&lt;/strong&gt; environment variable in &lt;strong&gt;.bashrc&lt;/strong&gt; located in your home folder. Also add the directory containing the &lt;strong&gt;java&lt;/strong&gt; binary file to the &lt;strong&gt;PATH&lt;/strong&gt; environment variable. This can be done by adding the following commands to the &lt;strong&gt;.bashrc&lt;/strong&gt; file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;JAVA_HOME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/opt/jdk1.8.0_231/
&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;PATH&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/opt/jdk1.8.0_231/bin:&lt;span class=&quot;token environment constant&quot;&gt;$PATH&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;installing-gradle&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-gradle&quot; aria-label=&quot;installing gradle permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Gradle&lt;/h4&gt;
&lt;p&gt;Next install the latest version of &lt;a href=&quot;https://gradle.org/install/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gradle&lt;/a&gt; by using sdkman or by manually downloading the binary package. To install the binary package, simple download and extract the gradle file to the folder &lt;strong&gt;/opt&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next add the directory containing the gradle binary to the &lt;strong&gt;PATH&lt;/strong&gt; environment variable. This can be done by adding the following command to .bashrc file: &lt;strong&gt;export PATH=/opt/gradle-6.0.1/bin:$PATH&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;installing-android-development-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-android-development-tools&quot; aria-label=&quot;installing android development tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Android Development Tools&lt;/h4&gt;
&lt;p&gt;Next download and extract the &lt;a href=&quot;https://developer.android.com/studio/?gclid=EAIaIQobChMI6pTMr4OI5gIVxKsYCh39twM9EAAYASAAEgLw1PD_BwE&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Android Development Tools package&lt;/a&gt; to &lt;strong&gt;/opt&lt;/strong&gt; folder. Next set the &lt;strong&gt;ANDROID_HOME&lt;/strong&gt; and &lt;strong&gt;ANDROID_SDK_ROOT&lt;/strong&gt; environment variables.&lt;/p&gt;
&lt;p&gt;Also add the folder containing the sdkmanager and emulator binaries to the $PATH environment variable. This can be done by adding the following to &lt;strong&gt;.bashrc&lt;/strong&gt; file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;ANDROID_HOME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/opt/sdk-tools-linux
&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;ANDROID_SDK_ROOT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ANDROID_HOME&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;PATH&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ANDROID_SDK_ROOT&lt;/span&gt;/tools/bin:&lt;span class=&quot;token variable&quot;&gt;$ANDROID_SDK_ROOT&lt;/span&gt;/platform-tools:&lt;span class=&quot;token variable&quot;&gt;$ANDROID_SDK_ROOT&lt;/span&gt;/emulator:&lt;span class=&quot;token environment constant&quot;&gt;$PATH&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;installing-the-android-sdk-and-platform-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-the-android-sdk-and-platform-tools&quot; aria-label=&quot;installing the android sdk and platform tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing the Android SDK and Platform Tools&lt;/h4&gt;
&lt;p&gt;Next install Platform Tools and the Android Platform SDK. Install the version of the Android Platform SDK that is supported by the installed version of Cordova. Also install the Android SDK Build Tools, Android Emulator, Android SDK Tools and a System Image for your Android Virtual Device (AVD). The AVD will be used by the Android emulator. These packages can be installed with the &lt;strong&gt;sdkmanager&lt;/strong&gt; tool, using the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;sdkmanager &lt;span class=&quot;token string&quot;&gt;&quot;build-tools;28.0.0&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;platform-tools&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;tools&quot;&lt;/span&gt;
sdkmanager &lt;span class=&quot;token string&quot;&gt;&quot;system-images;android-28;default;x86_64&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;creating-avd-and-running-the-android-emulator&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-avd-and-running-the-android-emulator&quot; aria-label=&quot;creating avd and running the android emulator permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating AVD and running the Android emulator&lt;/h4&gt;
&lt;p&gt;After that create an Android Virtual Device (AVD) using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;avdmanager create avd &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; emulator-name &lt;span class=&quot;token parameter variable&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;system-images;android-28;default;x86_64&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once the AVD has been created, start the emulator using the newly created AVD. This can be done using the command: &lt;strong&gt;emulator -avd emulator-name&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Next run the command: &lt;strong&gt;cordova requirements&lt;/strong&gt; to check if the requirements have been correctly installed. After that add the android platform to your Cordova project using the command: &lt;strong&gt;ionic cordova platform add android&lt;/strong&gt;. Next generate the Android app using the command &lt;strong&gt;ionic cordova build android&lt;/strong&gt;. After that deploy the app to the Android emulator using the command: &lt;strong&gt;ionic cordova emulate android&lt;/strong&gt;. You should now see your app running on the emulator inside a WebView.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The Ionic Framework can use either Apache Cordova or Capacitor for deploying applications written in HTML, CSS and JavaScript to mobile platforms.&lt;/p&gt;
&lt;p&gt;In this article I have described how to prepare the development environment so it can be used to deploy Ionic applications to Android platform using Apache Cordova.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Securing websites using Content-Security-Policy and X-Frame-Options]]></title><description><![CDATA[Websites are playing an increasingly important role in society. They are no longer used casually. Over the last few years websites have evolved from an amusing hobby to a platform for delivering important content. The content delivered by websites is being used to make important decisions. It is therefore very important to ensure that website content is securely delivered.]]></description><link>https://pakjiddat.netlify.app//posts/securing-websites-using-content-security-policy-and-x-frame-options</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/securing-websites-using-content-security-policy-and-x-frame-options</guid><pubDate>Wed, 02 Oct 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Websites are playing an increasingly important role in society. They are no longer used casually. Over the last few years websites have evolved from an amusing hobby to a platform for delivering important content. The content delivered by websites is being used to make important decisions. It is therefore very important to ensure that website content is securely delivered.&lt;/p&gt;
&lt;p&gt;Ensuring the security of website content is no easy task. To secure a website we need to secure the back-end as well as the front-end of the website. There are many options for securing websites. The website security options that I will describe in this article are X-Frame-Options and Content-Security-Policy. X-Frame-Options and Content-Security-Policy are both HTTP response headers which are sent by the server to the web browser. They are mostly used to specify which domains are allowed to show content on the website.&lt;/p&gt;
&lt;h3 id=&quot;x-frame-options&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#x-frame-options&quot; aria-label=&quot;x frame options permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;X-Frame-Options&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;X-Frame-Options&lt;/a&gt; is a HTTP response header. The web server which sends this header indicates to the browser the domains that are allowed to embed content served by the web server. It can be used to prevent unauthorized websites from embedding content in iframes. The “allow-from” value of this header indicates the specific domain which is allowed to embed content in iframe.&lt;/p&gt;
&lt;p&gt;Unfortunately we can only specify one domain name with the “allow-from”. A work around to this limitation is mentioned in the &lt;a href=&quot;https://tools.ietf.org/html/rfc7034#section-2.3.2.3&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RFC for X-Frame-Options&lt;/a&gt;. The workaround is to include the domain name in the iframe source url. The domain name is the name of the domain that has the iframe. The server that delivers the iframe content needs to check this domain value. If the domain is allowed to embed content, then the server can send the “allow-from” http response header containing the domain name.&lt;/p&gt;
&lt;p&gt;Before using this header, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options#Browser_compatibility.&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Browser compatibility of X-Frame-Options&lt;/a&gt;, should be checked. The “allow-from” is not supported by Google Chrome.&lt;/p&gt;
&lt;h3 id=&quot;content-security-policy-csp&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#content-security-policy-csp&quot; aria-label=&quot;content security policy csp permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Content-Security-Policy (CSP)&lt;/h3&gt;
&lt;p&gt;The X-Frame-Options HTTP response header is an old method of securing content. A newer method is the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;HTTP Content-Security-Policy (CSP)&lt;/a&gt;. It consists of HTTP headers that allow website administrators to control the resources that a browser is allowed to load for a give page. It prevents websites from displaying content from unauthorized domains. It helps to protect websites against Cross Site Scripting (XSS) attacks.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors.&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;frame-ancestors&lt;/a&gt; directive allows us to specify the domains that are allowed to embed content in iframes. It works similarly to X-Frame-Options allow-from, but it allows multiple domain names with wildcards to be specified. Unfortunately the frame-ancestors directive is not supported by Internet Explorer.&lt;/p&gt;
&lt;p&gt;The Content-Security-Policy header supports several other directives. Some of them are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;connect-src&lt;/a&gt;. Specifies the domains that are allowed to be used as script sources&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/font-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;font-src&lt;/a&gt;. Specifies the domains that are allowed to serve font files&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;frame-src&lt;/a&gt;. Specifies the domains that can be used as source for iframes&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/img-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;img-src&lt;/a&gt;. Specifies the domains from which images may be loaded&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/media-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;media-src&lt;/a&gt;. Specifies valid sources for loading media using the audio, video and track elements&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;script-src&lt;/a&gt;. Specifies valid sources for JavaScript. It includes inline JavaScript and event handlers&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;style-src&lt;/a&gt;. Specifies valid sources for CSS Stylesheets&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If a server sends both X-Frame-Options response header and the Content-Security-Policy response header, then the information in the Content-Security-Policy response header is given preference over X-Frame-Options.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Both X-Frame-Options and Content-Security-Policy response headers should be implemented. Using both headers will allow the content security policy to be enforced by all popular web browsers. Websites that implement a good content security policy are likely to have higher rankings in search results.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Recovering innodb data after accidental removal of log files]]></title><description><![CDATA[The role of Full Stack web developers is becoming increasingly popular. A Full Stack Web Developer is one who has a working knowledge of all components involved in website development. This includes front-end programming, back-end programming and server administration. ]]></description><link>https://pakjiddat.netlify.app//posts/recovering-innodb-data-after-accidental-removal-of-log-files</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/recovering-innodb-data-after-accidental-removal-of-log-files</guid><pubDate>Wed, 02 Oct 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The role of Full Stack web developers is becoming increasingly popular. A Full Stack Web Developer is one who has a working knowledge of all components involved in website development. This includes front-end programming, back-end programming and server administration.&lt;/p&gt;
&lt;p&gt;Server administration is a task that requires a lot of patience. Very often stressed out developers make the mistake of deleting important files. In this article I will describe my experience of restoring innodb database tables after accidentally removing innodb log files.&lt;/p&gt;
&lt;h3 id=&quot;innodb-database-table-recovery&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#innodb-database-table-recovery&quot; aria-label=&quot;innodb database table recovery permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Innodb database table recovery&lt;/h3&gt;
&lt;p&gt;A server that I was in-charge of started crashing after every few hours. Initially the problem appeared to be caused by SQL injection attacks on a website. I was able to stop these attacks by configuring Fail2Ban. Even after configuring Fail2Ban, the server did not stop crashing.&lt;/p&gt;
&lt;p&gt;I checked the running processes. The list showed two instances of MySQL server. Also the MySQL error log file showed that several database tables had crashed. Unfortunately I panicked and made the wrong decision of deleting the log files used by MySQL database server.&lt;/p&gt;
&lt;h3 id=&quot;the-problem&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-problem&quot; aria-label=&quot;the problem permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The problem&lt;/h3&gt;
&lt;p&gt;I had deleted the &lt;strong&gt;innodb1&lt;/strong&gt;, &lt;strong&gt;ib_logfile0&lt;/strong&gt; and &lt;strong&gt;ib_logfile1&lt;/strong&gt; files. These files should not be removed as they are used by the innodb engine to store important table meta data. After removing the files all innodb database tables were inaccessible.&lt;/p&gt;
&lt;p&gt;Fortunately the &lt;strong&gt;innodb_file_per_table&lt;/strong&gt; option was enabled in MySQL server configuration. This option was enabled by default. When enabled, each innodb table uses one tablespace file with &lt;strong&gt;.ibd&lt;/strong&gt; extension and a table structure file with &lt;strong&gt;.frm&lt;/strong&gt; extension. innodb also uses a system table space, which is saved in the &lt;strong&gt;innodb1&lt;/strong&gt; file. I had removed the system tablespace, but fortunately, the tablespace files for each table were present.&lt;/p&gt;
&lt;h3 id=&quot;the-solution&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-solution&quot; aria-label=&quot;the solution permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The solution&lt;/h3&gt;
&lt;p&gt;Recovering crashed innodb tables is a common problem. The article &lt;a href=&quot;https://www.nullalo.com/en/recover-mysql-innodb-tables-without-ibdata1-file/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Recover MySQL InnoDB tables without ibdata1 file&lt;/a&gt;, is an excellant guide on how to recover crashed innodb tables.&lt;/p&gt;
&lt;p&gt;It was used as the main reference for this article. Other useful related articles are: &lt;a href=&quot;https://superuser.com/questions/675445/mysql-innodb-lost-tables-but-files-exist&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MySQL InnoDB lost tables but files exist&lt;/a&gt;, &lt;a href=&quot;https://www.chriscalender.com/tag/innodb-error-tablespace-id-in-file/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;InnoDB: Error: tablespace id in file&lt;/a&gt;, &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Troubleshooting InnoDB Data Dictionary Operations&lt;/a&gt; and &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.6/en/innodb-migration.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Moving or Copying InnoDB Tables&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;recovering-the-table-schema&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#recovering-the-table-schema&quot; aria-label=&quot;recovering the table schema permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Recovering the table schema&lt;/h4&gt;
&lt;p&gt;To recover the data, first the MySQL data directory which is &lt;strong&gt;/var/lib/mysql&lt;/strong&gt; had to be backed up. Next the table schema for each innodb table had to be recovered using the &lt;strong&gt;mysqlfrm tool&lt;/strong&gt;. This tool is provided by the &lt;a href=&quot;https://downloads.mysql.com/archives/utilities/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mysql-utilities&lt;/a&gt; package.&lt;/p&gt;
&lt;p&gt;The tool parses the &lt;strong&gt;.frm&lt;/strong&gt; file for the innodb table and displays the &lt;strong&gt;CREATE TABLE&lt;/strong&gt; statement to console. The &lt;strong&gt;CREATE TABLE&lt;/strong&gt; statement can be copied to a new database. In this way the structure for all the innodb tables can be copied to a new database. Once the schema for the table is recovered, the data for the table needs to be recovered.&lt;/p&gt;
&lt;h4 id=&quot;recovering-the-table-data&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#recovering-the-table-data&quot; aria-label=&quot;recovering the table data permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Recovering the table data&lt;/h4&gt;
&lt;p&gt;The data for the table is saved in a file with &lt;strong&gt;.ibd&lt;/strong&gt; extension. To recover the table data, first the tablespace of the table needs to be discarded using the SQL query: &lt;strong&gt;ALTER TABLE table-name DISCARD TABLESPACE&lt;/strong&gt;. Next the &lt;strong&gt;.ibd&lt;/strong&gt; files for the table needs to be copied from the backup folder to the folder of the database that will contain the recovered data. Once this is done, the data for the table needs to be imported using the SQL query: &lt;strong&gt;ALTER TABLE table-name IMPORT TABLESPACE&lt;/strong&gt;. Next issue the SQL query: &lt;strong&gt;SELECT * FROM table-name&lt;/strong&gt; should show the table data.&lt;/p&gt;
&lt;p&gt;The table can now be exported using &lt;strong&gt;mysqldump&lt;/strong&gt; tool or &lt;strong&gt;PhpMyAdmin&lt;/strong&gt;. The original database table, which is corrupted can be dropped and the new table can be imported. This needs to be done for each innodb table.&lt;/p&gt;
&lt;h4 id=&quot;automating-the-data-recovery&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#automating-the-data-recovery&quot; aria-label=&quot;automating the data recovery permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Automating the data recovery&lt;/h4&gt;
&lt;p&gt;To make the task for recovering the data easier, I wrote a PHP script which recovers all innodb tables in a given database.&lt;/p&gt;
&lt;p&gt;To use the script do the following:&lt;/p&gt;
&lt;p&gt;Download the script using the command: &lt;strong&gt;wget &lt;a href=&quot;https://gist.github.com/nadirlc/7bcf0fcc2b85e6fc15812b46525f51da&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://gist.github.com/nadirlc/7bcf0fcc2b85e6fc15812b46525f51da&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Rename the script to restore_innodb.php. To see the script options run: PHP restore_innodb.php&lt;/p&gt;
&lt;p&gt;Run the script with the correct options. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php restore_innodb&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;src&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;db&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;mysql&quot;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;backup&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;folder&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;/root/scripts/data-backup/&quot;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;mysql_data_dir&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;/var/lib/mysql&quot;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;log_file&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;/root/scripts/restore_innodb.log&quot;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;user&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;root&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;password&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;root-password&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;just replace the line: &lt;strong&gt;$src_db = “mysql”;&lt;/strong&gt;, with the name of the database that contains the crashed tables. Also replace the line:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;$backup_folder = &quot;/root/scripts/data-backup/&quot;;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;with the name of the folder that contains the backup data. The backup data should include the &lt;strong&gt;.frm&lt;/strong&gt; and &lt;strong&gt;.idb&lt;/strong&gt; files.&lt;/p&gt;
&lt;p&gt;The script will replace the corrupted table with the restored table. The script may not work for all cases, because the &lt;strong&gt;.ibd&lt;/strong&gt; files may be corrupt.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Innodb engine has some useful features. For example Innodb database engine supports transactions and row level locking. It is also ACID (Atomicity, Consistency, Integrity and Durability) compliant. It provides supports for foreign keys and also has faster write access than the MyISAM database engine.&lt;/p&gt;
&lt;p&gt;However Innodb tables can easily become corrupted because of improper database server shutdown. In most cases the Innodb engine can repair corrupt tables automatically using the Innodb log files, but in some cases the Database Administrator needs to recover the data manually.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Configuring the GamiPress WordPress plugin]]></title><description><![CDATA[GamiPress is a WordPress plugin that allows adding Gamification features to a WordPress website. It is free and open source. The main features of GamiPress are free but some of the addons, service plans and assets are priced.]]></description><link>https://pakjiddat.netlify.app//posts/configuring-the-gamipress-wordpress-plugin</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/configuring-the-gamipress-wordpress-plugin</guid><pubDate>Thu, 19 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/gamipress/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GamiPress&lt;/a&gt; is a WordPress plugin that allows adding &lt;a href=&quot;https://en.wikipedia.org/wiki/Gamification&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gamification&lt;/a&gt; features to a WordPress website. It is free and open source. The main features of GamiPress are free but some of the addons, service plans and assets are priced.&lt;/p&gt;
&lt;p&gt;GamiPress provides a system for awarding points based on actions taken on the WordPress website. GamiPress supports Points, Achievements and Ranks for awarding users. It also allows displaying reports on the points, ranks and achievements earned by the users.&lt;/p&gt;
&lt;p&gt;GamiPress provides integrations with a number of well known WordPress plugins such as Forminator, LearnDash, WP-PostRatings, BuddyPress and more. Most of these integrations are free. GamiPress also provides &lt;a href=&quot;https://gamipress.com/add-ons/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;add-ons&lt;/a&gt;, such as frontend reports, Conditional Emails, Extended REST API, Coupons and more.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://gamipress.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GamiPress website&lt;/a&gt; and the &lt;a href=&quot;https://gamipress.com/docs/getting-started/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GamiPress documentation&lt;/a&gt; allow easily getting started with GamiPress.&lt;/p&gt;
&lt;h3 id=&quot;installation-and-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation-and-configuration&quot; aria-label=&quot;installation and configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation and Configuration&lt;/h3&gt;
&lt;p&gt;GamiPress is installed normally like other WordPress plugins. It may be installed from the WordPress plugin manager or by uploading the plugin. Once installed it needs to be configured so it is integrated with the website. Configuring the plugin involves creating Point Types, Achievements and Ranks. To add more features, add-ons and assets may be configured.&lt;/p&gt;
&lt;h4 id=&quot;point-types&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#point-types&quot; aria-label=&quot;point types permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Point Types&lt;/h4&gt;
&lt;p&gt;GamiPress allows creating Point types. Point types are used to automatically award users based on their interaction with the website. Point types can have any name. For example coins, gems, credits, echoes, pulses, impact etc. When creating a point type, we need to specify the point type name, plural name and slug. We also need to specify how the points should be automatically awarded and deducted.&lt;/p&gt;
&lt;p&gt;Points for a point type are awarded and deducted in a similar way. We can specify how many points should be earned when a certain action has been taken by the user. We can also specify how many times the action should be taken by the user and also the time frame within which the action can be taken. We can specify the maximum number of times that points can be earned for this action. We can also specify a custom label for the action.&lt;/p&gt;
&lt;p&gt;For example, we can specify that when a user has commented on a post 4 times during a week, he should be awarded 10 points. Similarly for deducting points, we can specify that when a user deletes a post, 1 point should be deducted.&lt;/p&gt;
&lt;h4 id=&quot;achievement-types&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#achievement-types&quot; aria-label=&quot;achievement types permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Achievement Types&lt;/h4&gt;
&lt;p&gt;GamiPress allows creating Achievement Types and Achievements. Once an Achievement Type has been created, a sub menu item with the name of the Achievement Type is added under the Achievement menu. Clicking on this sub menu allows us to add the Achievement Types. For example we can create an Achievement type called Skills. We can then add skills such as Leadership Skills, Communication Skills, Computer Skills etc.&lt;/p&gt;
&lt;p&gt;When creating an instance of an Achievement type, for example when adding a new skill, we can specify the number of points to be awarded for achieving the skill. We can also specify how the skill can be earned. A skill may be earned by completing steps, by acquiring certain number of points of a certain point type, by reaching a rank or by awarding manually. we can also specify how many times the skill can be achieved. We can also specify that the skill can be earned by spending a certain number of points.&lt;/p&gt;
&lt;p&gt;If we choose to allow the skill to be earned by completing steps, then we can add the steps that need to be taken in order to achieve the skill. For example logging in to the website 5 times, creating a post 4 times, commenting on a post 2 times, getting comments on a post 10 times etc. We can also specify if the steps must be completed in sequence.&lt;/p&gt;
&lt;p&gt;When adding a new achievement for an achievement type, we can also specify the template that should be used for displaying the achievement. In this template we can choose whether to show list of users that have earned this achievement.&lt;/p&gt;
&lt;h4 id=&quot;rank-types&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rank-types&quot; aria-label=&quot;rank types permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Rank Types&lt;/h4&gt;
&lt;p&gt;GamiPress allows creating Rank Types and Ranks. Rank Types and Ranks are created similarly to Achievement Types and Achievements. We first need to create a Rank Type. For this Rank Type we can create ranks.&lt;/p&gt;
&lt;p&gt;When creating a rank, we need to specify the rank name, plural name and slug. We also need to specify how the rank should be earned. Ranks with the lowest priority do not have any requirements. Ranks with higher priorities need to be earned by completing steps. This is similar to the steps required for earning an achievement. We can also specify that the rank can be earned by spending certain number of points of a certain point type.&lt;/p&gt;
&lt;h4 id=&quot;events&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#events&quot; aria-label=&quot;events permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Events&lt;/h4&gt;
&lt;p&gt;An event is an action that needs to occur in order to complete an achievement step, rank requirement or award/deduct points. The main event types are: WordPress Events, Site interactions, Integrations and GamiPress events.&lt;/p&gt;
&lt;h5 id=&quot;wordpress-events&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wordpress-events&quot; aria-label=&quot;wordpress events permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;WordPress Events&lt;/h5&gt;
&lt;p&gt;WordPress events are events such as creating a new post, posting a comment, logging in to the website, deleting a post etc. These events are built in to GamiPress and are supported in the default GamiPress installation.&lt;/p&gt;
&lt;h5 id=&quot;site-interaction-events&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#site-interaction-events&quot; aria-label=&quot;site interaction events permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Site Interaction Events&lt;/h5&gt;
&lt;p&gt;Site interaction events include visiting the website, visiting a post, getting visits to a post etc.&lt;/p&gt;
&lt;h5 id=&quot;integrations-events&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#integrations-events&quot; aria-label=&quot;integrations events permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Integrations events&lt;/h5&gt;
&lt;p&gt;Integrations events are events supported in an integration of GamiPress. GamiPress integrations are basically WordPress plugins that allow Gamifying external plugins. For example the &lt;a href=&quot;https://wordpress.org/plugins/gamipress-forminator-integration/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GamiPress Forminator Integration&lt;/a&gt; allows awarding points to users based on their interactions with forms and quizzes, that have been created using the &lt;a href=&quot;https://wordpress.org/plugins/forminator/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Forminator WordPress plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This integration adds several events to GamiPress such as events related to forms, quizzes and polls. For example we can specify the number of points that should be awarded to a user when a certain form has been submitted with a certain field value by the user.&lt;/p&gt;
&lt;p&gt;GamiPress events include events such as unlocking a specific achievement type, earning a certain number of points, reaching a rank etc.&lt;/p&gt;
&lt;h4 id=&quot;blocks-shortcodes-and-widgets&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#blocks-shortcodes-and-widgets&quot; aria-label=&quot;blocks shortcodes and widgets permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Blocks, Shortcodes and Widgets&lt;/h4&gt;
&lt;p&gt;GamiPress blocks are provided in the Gutenberg WordPress editor. For example the User Points block allows displaying the current or specific user balance. The User Earnings block allows displaying list of user earnings. These blocks may be displayed anywhere where blocks are supported. Such as posts, pages, custom posts etc.&lt;/p&gt;
&lt;p&gt;GamiPress also provides short-codes for displaying information such as a single achievement, user ranks, user earnings etc. For example the short-code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[gamipress_achievement]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;renders a single achievement. Each short-code supports several attributes that allow customizing the short-code output. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[gamipress_achievement id=&quot;1&quot; title=&quot;yes&quot; link=&quot;yes&quot; thumbnail=&quot;yes&quot; excerpt=&quot;yes&quot; times_earned=&quot;yes&quot; steps=&quot;yes&quot; toggle=&quot;yes&quot; earners=&quot;no&quot; layout=&quot;left&quot;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A short-code button appears on the classic WordPress content editor. It allows customizing the short-code. The Gutenberg editor provides blocks for each short-code.&lt;/p&gt;
&lt;p&gt;GamiPress provides several widgets that allow displaying information such as the user earnings, user points, user achievements etc. Each widget supports several customization options.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;GamiPress is a comprehensive plugin that allows Gamifying WordPress websites. It has many features including integrations, add-ons and service plans. It is easy to configure and customize.&lt;/p&gt;
&lt;p&gt;It may be used to Gamify websites such as online education courses, job recruitment websites, e-commerce websites, support forums etc. It helps to  improve user engagement with websites.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Preventing SSH and SQL injection attacks using Fail2ban]]></title><description><![CDATA[Fail2Ban is an intrusion detection and prevention tool for Linux operating system. It is written in Python language. It works by checking log files using regular expressions. Entries that match the regular expression are banned by adding the IP address to the system firewall.]]></description><link>https://pakjiddat.netlify.app//posts/preventing-ssh-and-sql-injection-attacks-using-fail2ban</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/preventing-ssh-and-sql-injection-attacks-using-fail2ban</guid><pubDate>Tue, 10 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.fail2ban.org/wiki/index.php/Main_Page&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fail2Ban&lt;/a&gt; is an intrusion detection and prevention tool for Linux operating system. It is written in Python language. It works by checking log files using regular expressions. Entries that match the regular expression are banned by adding the IP address to the system firewall.&lt;/p&gt;
&lt;p&gt;Fail2Ban is usually used to prevent Brute force SSH attacks. It can also be used to prevent attacks on other services such as web server, ftp server, mail server or even a custom service.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Fail2Ban can be installed on Debian 9 (stretch) using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; fail2ban&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This configures fail2ban to automatically start on system boot. Fail2ban service can be controlled using the fail2ban-client command. For example the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;fail2ban-client start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;starts the Fail2Ban service. The command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;fail2ban-client status&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;lists the active Fail2Ban jails.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Fail2Ban uses the concept of filters, actions and jails. A filter defines the regular expression used to search for invalid entries in a log file. An action is taken to ban an IP address that matches a filter. The default action is to add the IP address to the system firewall.&lt;/p&gt;
&lt;p&gt;A jail defines the log file to be checked as well as other settings such as the &lt;strong&gt;maxretry&lt;/strong&gt;, &lt;strong&gt;bantime&lt;/strong&gt; and &lt;strong&gt;findtime&lt;/strong&gt;. maxretry defines the maximum number of times the server can be accessed from an IP address, before it is banned. findtime defines the time window within which login attempts are made. For example if 5 login attempts are made within a 10 min findtime value, then the IP address is banned.&lt;/p&gt;
&lt;p&gt;By default Fail2Ban is configured to ban failed SSH login attempts. Fail2Ban is pre-configured with jails for various services. However these jails need to be activated and customized if required.&lt;/p&gt;
&lt;p&gt;For example to activate and customize the &lt;strong&gt;nginx-botsearch&lt;/strong&gt; jail, we need to create the file: &lt;strong&gt;/etc/fail2ban/jail.local&lt;/strong&gt;. Alternately we can create this file in &lt;strong&gt;/etc/fail2ban/filter.d&lt;/strong&gt; folder. This file should have following contents:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[nginx-botsearch]

enabled  = true
logpath  = /var/log/nginx/access.log
filter   = filter-name
maxretry = 2
port     = http,https&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;enabled&lt;/strong&gt; line indicates that the filter should be active. &lt;strong&gt;logpath&lt;/strong&gt; is the path to the Nginx access log file. &lt;strong&gt;filter&lt;/strong&gt; indicates that the filter file, &lt;strong&gt;filter-name.conf&lt;/strong&gt; should be used. The filter file should be defined in &lt;strong&gt;/etc/fail2ban/filter.d&lt;/strong&gt; folder. The following is a sample filter file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;# Fail2Ban filter for WordPress
#
#

[Definition]

failregex = ^&amp;lt;HOST&gt; - - \[.*\] &quot;GET \/company\.php.*select count.* HTTP.*&quot;$&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;failregex&lt;/strong&gt; line indicates the regular expression to use to check for invalid entries in the Nginx access log file. Entries that match the regular expression are banned.&lt;/p&gt;
&lt;p&gt;After the filter and jail has been configured, we need to restart the Fail2Ban server using the command: &lt;strong&gt;fail2ban-client stop&lt;/strong&gt; followed by &lt;strong&gt;fail2ban-client start&lt;/strong&gt;. If the regular expression is working, then we should see some entries in the Fail2Ban log file which is: &lt;strong&gt;/var/log/fail2ban.log&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Since it can be difficult to develop and test a regular expression for a certain log entry, we can use the &lt;strong&gt;fail2ban-regex&lt;/strong&gt; command for testing our regular expression.&lt;/p&gt;
&lt;p&gt;The command takes two arguments. The first one is the log file entry. The second argument is the regular expression. The following example shows how to test that a regular expression correctly matches a given log entry. Note that the code should be entered on one line.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;fail2ban-regex &apos;162.144.34.147 - - [09/Sep/2019:10:02:55 +0000]
 &quot;GET /company.php?id=1019999999999 or
 (select count(*)from(select 1 union select 2 union select 3)x
group by concat(mid((select vErsion()
  limit 0,1),1,0),floor(rand(0)*2))) -- x=x HTTP/1.1&quot; 301 169 &quot;-&quot; &quot;-&quot; &quot;-&quot;&apos;
&apos;^&amp;lt;HOST&gt; - - \[.*\] &quot;GET \/company\.php.*select count.* HTTP.*&quot;$&apos;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Fail2Ban is a very useful tool for preventing server intrusions over a network. It works by checking log files and banning IP addresses that produce invalid entries in the log file. It can also be used to secure network based custom services and applications.&lt;/p&gt;
&lt;p&gt;The guide &lt;a href=&quot;https://www.linode.com/docs/security/using-fail2ban-for-security/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Use Fail2ban to Secure Your Server&lt;/a&gt; was used as reference for writing this article. It is an excellent resource on how to install and configure Fail2Ban.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Running Graphical applications within LXD containers]]></title><description><![CDATA[LXD containers provide an isolated environment, which is separate from the main host. Sometimes we may need to run GUI apps from the container. For example during development of desktop applications.]]></description><link>https://pakjiddat.netlify.app//posts/running-graphical-applications-within-lxd-containers</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/running-graphical-applications-within-lxd-containers</guid><pubDate>Wed, 21 Aug 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;LXD containers provide an isolated environment, which is separate from the main host. Sometimes we may need to run GUI apps from the container. For example during development of desktop applications.&lt;/p&gt;
&lt;p&gt;In the article I will describe how to run GUI apps from within LXD containers. The code for the app is installed on the container, but the app itself runs on the host using the display server of the host. The article &lt;a href=&quot;https://blog.simos.info/how-to-run-graphics-accelerated-gui-apps-in-lxd-containers-on-your-ubuntu-desktop/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to run graphics-accelerated GUI apps in LXD containers on your Ubuntu desktop&lt;/a&gt; was used for reference.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Configuring a LXD container so it runs GUI apps requires sharing the host display device with the container and adding a GPU device to the container. Both steps require a mapping of user ids between the host and the container.&lt;/p&gt;
&lt;p&gt;The id of the user that will run the GUI apps on the container needs to be matched with the id of the user that is logged in to the host. To test the configuration we need to install a sample GUI app on the container. The sample app is called xclock and it displays a small analog clock in a window. The following configuration steps are involved:&lt;/p&gt;
&lt;h4 id=&quot;mapping-user-ids&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mapping-user-ids&quot; aria-label=&quot;mapping user ids permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Mapping user ids&lt;/h4&gt;
&lt;p&gt;This involves creating a mapping between a user on the container and a user on the host. First we need to define a mapping between the root user on the container and the user on the host. This can be done by running the following command on the host:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;root:&lt;span class=&quot;token environment constant&quot;&gt;$UID&lt;/span&gt;:1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-a&lt;/span&gt; /etc/subuid /etc/subgid&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command adds a mapping entry to the &lt;strong&gt;/etc/subuid&lt;/strong&gt; and &lt;strong&gt;/etc/subgid&lt;/strong&gt; files.&lt;/p&gt;
&lt;p&gt;Next we need to define a user id mapping for our container. Assuming our container is called Projects, the following command creates a mapping between user id $UID on the host and user id 1001 on the container:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; Projects raw.idmap &lt;span class=&quot;token string&quot;&gt;&quot;both &lt;span class=&quot;token environment constant&quot;&gt;$UID&lt;/span&gt; 1001&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command allows devices and files belonging to the host user to be used within the container. For the changes to take affect, we need to restart our container with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc restart Projects&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;User id 1001 should be replaced with the user id of the user that will run the GUI apps on the container. $UID is an environment variable that contains the user id of the user logged in to the host.&lt;/p&gt;
&lt;h4 id=&quot;share-display-device-socket-and-x11-authentication-file&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#share-display-device-socket-and-x11-authentication-file&quot; aria-label=&quot;share display device socket and x11 authentication file permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Share display device socket and X11 authentication file&lt;/h4&gt;
&lt;p&gt;Next we need to share the X11 display socket and X11 authentication file with the container. We can do this with the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; Projects X0 disk &lt;span class=&quot;token assign-left variable&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/tmp/.X11-unix/X0 &lt;span class=&quot;token assign-left variable&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/tmp/.X11-unix/X0
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; Projects Xauthority disk &lt;span class=&quot;token assign-left variable&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/home/nadir/.Xauthority &lt;span class=&quot;token assign-left variable&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;${&lt;span class=&quot;token environment constant&quot;&gt;XAUTHORITY&lt;/span&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After running the above commands, the container should be restarted. We should then be able to see the folder: &lt;strong&gt;/tmp/.X11-unix/X0&lt;/strong&gt; and the file: &lt;strong&gt;/home/nadir/.Xauthority&lt;/strong&gt; on the container. Both the folder and files should be owned by user id 1001 on the container.&lt;/p&gt;
&lt;h4 id=&quot;add-gpu-device-to-container&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#add-gpu-device-to-container&quot; aria-label=&quot;add gpu device to container permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add GPU device to container&lt;/h4&gt;
&lt;p&gt;The next step is to add a GPU device to the container. This can be done with the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; Projects gpu gpu
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; Projects gpu uid &lt;span class=&quot;token number&quot;&gt;1001&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; Projects gpu gid &lt;span class=&quot;token number&quot;&gt;1001&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;test-the-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#test-the-configuration&quot; aria-label=&quot;test the configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test the configuration&lt;/h4&gt;
&lt;p&gt;Next we need to run a sample GUI app on the container. To do this, we need to install the &lt;strong&gt;x11-apps&lt;/strong&gt; package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; x11-apps&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The x11-apps package contains the &lt;strong&gt;xclock&lt;/strong&gt; sample GUI app.&lt;/p&gt;
&lt;p&gt;Before running the sample app, we need to set the &lt;strong&gt;DISPLAY&lt;/strong&gt; environment variable on the container. It should be set to the same value as the &lt;strong&gt;DISPLAY&lt;/strong&gt; variable on the host. To get the value of the &lt;strong&gt;DISPLAY&lt;/strong&gt; variable on the host, run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token environment constant&quot;&gt;$DISPLAY&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on the host. The value of this variable is usually &lt;strong&gt;“:0”&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;DISPLAY&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;:0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on the container. It sets the &lt;strong&gt;DISPLAY&lt;/strong&gt; variable to &lt;strong&gt;“:0”&lt;/strong&gt;. Place the command in &lt;strong&gt;~/.bashrc&lt;/strong&gt; file so next time the user logs in the &lt;strong&gt;DISPLAY&lt;/strong&gt; variable is automatically set.&lt;/p&gt;
&lt;p&gt;Run the sample GUI app using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;xclock&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should open a small window containing an analog clock. The window will be opened on the host.&lt;/p&gt;
&lt;h3 id=&quot;running-android-emulator-within-lxd-container&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-android-emulator-within-lxd-container&quot; aria-label=&quot;running android emulator within lxd container permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running Android emulator within LXD container&lt;/h3&gt;
&lt;p&gt;To run an Android emulator within a LXD container, we need to first install the Android SDK on the container. See the article: &lt;a href=&quot;/posts/building-ionic-cordova-applications-for-android-on-debian-10-without-android-studio&quot;&gt;Building Ionic Cordova applications for Android on Debian 10 without Android Studio&lt;/a&gt; on how to install Android emulator.&lt;/p&gt;
&lt;p&gt;Once the Android SDK has been installed, enable KVM hardware virtualization on the LXD container. KVM hardware virtualization is required for running Android emulators. To enable the KVM support enter the following commands from the main host that is running the LXD container:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; ContainerName kvm unix-char &lt;span class=&quot;token assign-left variable&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/dev/kvm
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; ContainerName kvm uid &lt;span class=&quot;token environment constant&quot;&gt;UID&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc config device &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; ContainerName kvm gid GID&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first command will add the KVM device to your LXD container. The last two commands will set the user and group ids of the KVM device on the LXD container. Change the UID and GID to the user and group id of the user that will run the emulator on your container. After that shut down and start your LXD container. You should now be able to run Android emulator from your LXD container.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Developers often need working environments that are separated from their main computer. LXD containers provide a lightweight environment for development work. However LXD containers do not support running GUI apps by default. Fortunately there is a simple workaround that I have described in this article, which allows GUI apps to be run from LXD containers.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[5 Best JavaScript Editors: Developers Rank the Best Tools Worldwide]]></title><description><![CDATA[JavaScript has continued to grow in importance over the last decade. In fact, according to StackOverflow’s Insights, JavaScript has been the most popular programming language for the past 7 years, edging out popular languages including Python, C# and Java. The State of Javascript survey, which includes responses from over 20,000 developers, reveals that five JavaScript editors stand out accounting 95% of all usage!]]></description><link>https://pakjiddat.netlify.app//posts/5-best-javascript-editors--developers-rank-the-best-tools-worldwide</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/5-best-javascript-editors--developers-rank-the-best-tools-worldwide</guid><pubDate>Sun, 18 Aug 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;JavaScript has continued to grow in importance over the last decade. In fact, according to StackOverflow’s Insights, JavaScript has been the most popular programming language for the past 7 years, edging out popular languages including Python, C# and Java. The State of JavaScript survey, which includes responses from over 20,000 developers, reveals that five JavaScript editors stand out accounting 95% of all usage!&lt;/p&gt;
&lt;h3 id=&quot;editors&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#editors&quot; aria-label=&quot;editors permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Editors&lt;/h3&gt;
&lt;h4 id=&quot;1-visual-studio-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#1-visual-studio-code&quot; aria-label=&quot;1 visual studio code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Visual Studio Code&lt;/h4&gt;
&lt;p&gt;VSCode is the dominant leader in online JavaScript editors. Featuring cross platform support on Linux, macOS and Windows, VSCode has built in code completion for your node.js modules and JavaScript code. As expected with Microsoft, Typescript is a first class citizen. Git is seamlessly integrated, meaning you can make commits, reviews diffs and more in real-time all without leaving the editor. Visual Studio Code is a lightweight code editor that was built from the ground up for speed. Auto-completion goes beyond function completion and also offers documentation and function argument information as you develop. Microsoft has done an excellent job with community engagement and VSCode has a vibrant developer community creating powerful extensions which save additional time. Sought after features such as live preview and chrome debugging with devtools are easily accessible through the Visual Studio Marketplace. In addition, if you really want to get under the covers, the entire text editor source code is hosted on GitHub as open source software.&lt;/p&gt;
&lt;h4 id=&quot;2-sublime-text&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#2-sublime-text&quot; aria-label=&quot;2 sublime text permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Sublime Text&lt;/h4&gt;
&lt;p&gt;A commercial editor with a large user base, developers find the $80 fee for Sublime Text well worthwhile due to its speed (in part derived from it being written in C++). As with VSCode, there is a great developer and plugin community that has filled in the gaps creating a powerful editor environment for JavaScript. Often referred to as a midpoint between bloated IDE and lean editors such as VIM, Sublime opens files fast and leans on plugins via package control to make it a great experience for JS development. Leveraging Babel for intelligent syntax highlighting /smart code completion and gitgutter for diffs and pushes, Sublimelinter for seamless ESlint and JShint tie-ins makes Sublime a fast, capable and lightweight JavaScript editor.&lt;/p&gt;
&lt;h4 id=&quot;3-vim&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#3-vim&quot; aria-label=&quot;3 vim permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. VIM&lt;/h4&gt;
&lt;p&gt;One of the earliest and still very popular text editors, VIM is highly customizable and configurable with exceptional keyboard shortcut support. It’s long history and keyboard dominated interface have produced a developer community with must have plugins like prettier, ALE and powerful command line support enabling you to leverage ESLint and Flow. VIM is incredibly customizable and no two JavaScript developers use it in the same way. If you started early with VIM, you may be very productive in it, but for those new to JavaScript development, VSCode, Sublime Text or Jetbrains WebStorm is a better choice.&lt;/p&gt;
&lt;h4 id=&quot;4-webstorm&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#4-webstorm&quot; aria-label=&quot;4 webstorm permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. WebStorm&lt;/h4&gt;
&lt;p&gt;Jetbrains popular WebStorm is a paid editor that has a loyal following and is regularly updated. Branded, “the smartest JavaScript IDE,” WebStorm lives up to the marketing by offering coding assistance across Node.js, HTML and CSS. It also supports built in assistance with popular JavaScript frameworks including Meteor, Angular, React, jQuery, vue.js and electron. GitHub support is integrated within the IDE and other version control options are supported through official plugins including git integration, Mercurial, Perforce, and Subversion. A built in debugger for Node.js with test integration, tracing and profiling along with seamless command line tool integration round out this IDE. Attention to detail and workflow optimization including automatic saving of file changes is a hallmark of WebStorm. Regular updates with new features and a Early Access Program make the paid subscription worthwhile for many developers.&lt;/p&gt;
&lt;h4 id=&quot;5-atom&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#5-atom&quot; aria-label=&quot;5 atom permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Atom&lt;/h4&gt;
&lt;p&gt;Marketed as a hack-able text editor for the 21st century, Atom has been growing in popularity. Atom has already established a loyal following and vibrant developer community. Packages give advanced integration options offering real-time collaboration and pair coding, git and GitHub integration and more. A cross platform editor with OS X, Windows and Linux support, Atom runs on Electron and enables deep customization and styling. As a JavaScript developer you can customize Atom using JavaScript, HTML, CSS and Node.js.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Developers are a unique breed, creating thousands of diverse solutions to meet every specific need or niche. Modern editors and IDEs have embraced plugin architectures which allow quick customization and leverage community contributions making it possible for generalized editors such as VSCode to meet more developer’s unique needs. This enables seasoned developers to focus on their JavaScript projects rather than hacking their dev environment while allowing new developers to hit the ground running.&lt;/p&gt;
&lt;p&gt;This article was originally published on &lt;a href=&quot;https://jscharting.com/blog/js-editors/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JSCharting&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Online Collaboration with Slack]]></title><description><![CDATA[Slack is a popular online collaboration platform that is widely used by professionals from different fields. It allows instant messaging, voice and video conferencing, file sharing, integration with applications and more.]]></description><link>https://pakjiddat.netlify.app//posts/online-collaboration-with-slack</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/online-collaboration-with-slack</guid><pubDate>Sat, 17 Aug 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Slack is a popular online collaboration platform that is widely used by professionals from different fields. It allows instant messaging, voice and video conferencing, file sharing, integration with applications and more.&lt;/p&gt;
&lt;p&gt;Slack provides customized solutions for Customer Support, Engineering, IT, Human Resources, Marketing, Project Management, Sales and Task Management. Slack not only connects people and teams but also allows integration of tools and services.&lt;/p&gt;
&lt;p&gt;Slack implements a client server model, where the server is hosted by Slack and provided under different pricing options. Slack provides client apps for Windows, Linux and Mac Os. It also has apps for Android and Iphone.&lt;/p&gt;
&lt;p&gt;Slack provides a Free Plan, Standard Plan, Plus Plan and Enterprise Grid plan. Slack provides accessing using workspace. A workspace is basically a Slack account with a unique name. Each workspace has its own unique URL. For example if we create a workspace called chat, we get the URL chat.slack.com. From this URL, we can change the workspace settings and also access the web based Slack client.&lt;/p&gt;
&lt;p&gt;An open source alternative to Slack is &lt;a href=&quot;/posts/installing-rocket-chat-and-wekan-on-ubuntu-server&quot;&gt;Rocket Chat&lt;/a&gt;, which allows hosting the server for free.&lt;/p&gt;
&lt;h3 id=&quot;integrations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#integrations&quot; aria-label=&quot;integrations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Integrations&lt;/h3&gt;
&lt;p&gt;Slack provides integrations with numerous tools and services. The integrations basically allow external tools and services to automatically post messages to Slack channels. They also allow messages posted using Slack clients to be sent to external tools and services.&lt;/p&gt;
&lt;h4 id=&quot;buddyslack&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#buddyslack&quot; aria-label=&quot;buddyslack permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;BuddySlack&lt;/h4&gt;
&lt;p&gt;Slack can be integrated with WordPress in different ways. For example, the &lt;a href=&quot;https://wordpress.org/plugins/buddyslack/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;BuddySlack&lt;/a&gt; WordPress plugin allows automatically posting user activities to Slack channels. The BuddySlack plugin is easy to configure. We need to first create an incoming WebHook for our Slack WorkSpace. The incoming WebHook has a channel to which the user activities are posted. It also has a URL, which we need to copy and paste to the plugin configuration. After that all user  activities related to BuddyPress should be automatically posted to the Slack channel.&lt;/p&gt;
&lt;h4 id=&quot;hybridchat&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#hybridchat&quot; aria-label=&quot;hybridchat permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Hybrid.Chat&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://hybrid.chat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Hybrid.Chat&lt;/a&gt; is a separate service that provides ChatBots and API integrations. The service allows creating ChatBots using a simple three step wizard. The wizard provides HTML/JavaScript code which creates a Chat widget.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://wordpress.org/plugins/hybrid-chat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Hybrid.Chat&lt;/a&gt; WordPress plugin provides a Chat widget. The widget allows website users to chat. The Chat widget may be integrated with Slack. This allows the website visitors to chat with users on a Slack channel. The messages entered by the website user appear in a Slack channel. Replies may be posted using a Slack client.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Slack is a useful online collaboration platform that is easy to use and integrate. It connects people and also enables integration of tools and services.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Building online communities with Discourse]]></title><description><![CDATA[Discourse is a popular discussion application that allows users to discuss topics. It is one of the most popular discussion applications with lots of features and a user friendly interface. To try out the features provided by Discourse, see the Discourse Demo.]]></description><link>https://pakjiddat.netlify.app//posts/building-online-communities-with-discourse</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/building-online-communities-with-discourse</guid><pubDate>Fri, 19 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.discourse.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse&lt;/a&gt; is a popular discussion application that allows users to discuss topics. It is one of the most popular discussion applications with lots of features and a user friendly interface. To try out the features provided by Discourse, see the &lt;a href=&quot;https://try.discourse.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse Demo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Discourse has a standard, business and enterprise edition. These editions are non free. There is also an open source edition that is free to use. Discourse is a useful platform for building communities. In this article, I will describe the features provided by Discourse and also how to install Discourse on a Linux server.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;Discourse has the following features:&lt;/p&gt;
&lt;h4 id=&quot;main-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#main-features&quot; aria-label=&quot;main features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Main Features&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.discourse.org/features&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;main feature of Discourse&lt;/a&gt; is a forum system. It allows users to post topics. Users can discuss the topics by posting replies. The replies can be moderated by special users. Dynamic notifications allow users to receive email alerts when someone has replied to their post or has mentioned them in a reply.&lt;/p&gt;
&lt;p&gt;Discourse is a simple forum, in which replies flow down a single page. No need to click through pages to view replies. The context of a post can be viewed by clicking at the top and bottom of the post. The context reveals the full post conversation. Links in a post automatically expand to reveal additional information without requiring the user to click the link.&lt;/p&gt;
&lt;p&gt;Discourse also provides &lt;a href=&quot;https://github.com/discourse/DiscourseMobile&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;open source mobile applications&lt;/a&gt; for IOS and Android.&lt;/p&gt;
&lt;h4 id=&quot;api-plugins-and-theme-components&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-plugins-and-theme-components&quot; aria-label=&quot;api plugins and theme components permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;API, Plugins and Theme components&lt;/h4&gt;
&lt;p&gt;Discourse can be extended with &lt;a href=&quot;https://www.discourse.org/plugins&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;plugins&lt;/a&gt; that enhance the basic functionality of Discourse. There are standard plugins that are provided with all hosting plans. These include a chat plugin, plugins for preventing spam, advertising, displaying mathematical notation in posts and more. The Business and Enterprise plugins include a data explorer which allows running SQL queries against databases, a Sitemap plugin, a topic voting plugin and more.&lt;/p&gt;
&lt;p&gt;To install a Discourse plugin, we need to edit the &lt;strong&gt;containers/app.yml&lt;/strong&gt; configuration file and enter the text: &lt;strong&gt;“git clone [plugin-repository-url]”&lt;/strong&gt;. Next we need to rebuild the container using the command: &lt;strong&gt;./launcher rebuild app&lt;/strong&gt;. The plugin should now show on the plugins list page. The article, &lt;a href=&quot;https://meta.discourse.org/t/install-plugins-in-discourse/19157&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Install Plugins in Discourse&lt;/a&gt; on the Discourse forums describes how to install plugins.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://docs.discourse.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse API&lt;/a&gt; allows access to Discourse data. It also allows posting topics and replies, managing users and more.&lt;/p&gt;
&lt;p&gt;Theme components enhance the functionality of themes. For example the &lt;a href=&quot;https://meta.discourse.org/t/social-share-component/89980&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Social Share Component&lt;/a&gt;, allows adding custom social share links to the post share form.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://meta.discourse.org/t/brand-header-theme-component/77977&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Brand header theme component&lt;/a&gt;, allows adding a header to the Discourse with custom links. It can be used to brand the Discourse so it looks like the company website.&lt;/p&gt;
&lt;p&gt;To install a theme component, we need to go to the theme component admin page and enter the Git Repository URL of the component. We can also choose from a list of popular theme components. Next we need to add the theme component to the current theme. This last step is very important and sometimes missed by users not familiar with Discourse.&lt;/p&gt;
&lt;h3 id=&quot;integrations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#integrations&quot; aria-label=&quot;integrations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Integrations&lt;/h3&gt;
&lt;p&gt;Discourse provides useful &lt;a href=&quot;https://www.discourse.org/integrations&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;integration options&lt;/a&gt;. It supports Social Login with Facebook, LinkedIn, Twitter, Yahoo, GitHub and more. It also provides Custom Oauth2 and SAML. These allow Discourse to be used as a single sign on provider for websites.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Discourse also supports integrations with Chat providers including Rocket Chat, Slack, MatterMost, Gitter and more. The Chat Integrations allow Discourse to notify chat providers about new posts and replies. It also allows chat transcripts to be posted in topic replies.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discourse has some useful Advertising and Monetizing options. The &lt;a href=&quot;https://github.com/discourse/discourse-adplugin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse Advertizing plugin&lt;/a&gt; allows displaying ads above, below and between content. It supports, Google Adsense, Google Ads, Amazon and Code Fund&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discourse supports integration with Analytics providers such as Google Analytics, Motomo and Adobe Analytics Cloud. The Analytics integration allows Discourse admins to view user statistics.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discourse also integrates with Crowd Funding providers such as &lt;a href=&quot;https://github.com/discourse/discourse-patreon&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Patreon&lt;/a&gt; and &lt;a href=&quot;https://memberful.com/help/third-party-integrations/discourse/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Memberful&lt;/a&gt;. This allows Discourse to be used as a contributor only community. For example it allows Discourse website managers to sell memberships.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Discourse GitHub integration is provided by the &lt;a href=&quot;https://meta.discourse.org/t/discourse-code-review/103142&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse Code Review plugin&lt;/a&gt;. It allows 2 way integration between GitHub and Discourse. It allows new topics on Discourse to be created from GitHub Commits. It also allows Discourse replies to be posted back to GitHub. For example commits for reviews, follow ups and more.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&quot;https://meta.discourse.org/t/discourse-zendesk-plugin/68005&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse ZenDesk plugin&lt;/a&gt; integrates ZendDesk with Discourse. It allows Discourse topics to be converted to ZenDesk tickets. It also allows syncing comments between ZenDesk and Discourse.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&quot;https://meta.discourse.org/t/google-perspective-api-plugin/98733&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Perspective API plugin&lt;/a&gt;, allows automatically monitoring the sentiment of the community. It allows warning users before they post potentially offensive content. It also allows scanning posts for abuse. It uses &lt;a href=&quot;https://www.perspectiveapi.com/#/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google’s Perspective Machine Learning API&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&quot;https://meta.discourse.org/t/discourse-translator/32630&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse Translator Plugin&lt;/a&gt; allows translating posts to different languages using Google Translate or Microsoft Translator.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&quot;https://wordpress.org/plugins/wp-discourse/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WP Discourse Plugin&lt;/a&gt; allows integrating Discourse with WordPress. It allows automatically creating a new Discourse Discussion for new WordPress posts. It allows embedding Discourse Discussions in WordPress. It also allows using Discourse as an authentication provider for WordPress or using WordPress as the authentication provider for Discourse.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discourse’s &lt;a href=&quot;https://github.com/discourse/discourse-akismet&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Akismet Integration&lt;/a&gt; allows stopping Spam. The &lt;a href=&quot;https://meta.discourse.org/t/add-algolia-search-to-your-discourse/73517&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Algolia Integration&lt;/a&gt; allows integrating intelligent search. Discourse’s Web Hooks allow integration with hundreds of services provided by &lt;a href=&quot;https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Zapier&lt;/a&gt; or &lt;a href=&quot;https://meta.discourse.org/t/generate-new-topics-posts-and-pm-via-ifttt/61336&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;IFTT&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Discourse is based on RubyOnRails platform. It uses PostgreSQL database. The recommended method for running the open source version of Discourse is with Docker. The &lt;a href=&quot;https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Discourse Installation Guide for Cloud Platforms&lt;/a&gt; describes how to install Discourse on Digital Ocean or on personal servers. Since the Discourse is run within a Docker container, the installation guide applies to all platforms that support Docker.&lt;/p&gt;
&lt;p&gt;We first need to install Docker on the server. See the &lt;a href=&quot;https://docs.docker.com/installation/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Docker installation guide&lt;/a&gt; for how to install Docker on different operating systems. Next we need to create the folder: &lt;strong&gt;/var/discourse&lt;/strong&gt; and download the Discourse Docker source code to the folder. This can be done with the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; /var/discourse
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; /var/discourse
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/discourse/discourse_docker.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to run the Discourse setup tool using the command: &lt;strong&gt;./discourse-setup&lt;/strong&gt;. The setup script will ask for the Discourse hostname, email settings, and Lets Encrypt account email. I chose to skip the Lets Encrypt setup, since my installation of Discourse does not require https. The setup script will generate the &lt;strong&gt;containers/app.yml&lt;/strong&gt; Docker configuration file. It will also start the boostrap. The bootstrap process builds the Discourse Docker image and downloads it to the server. It also starts a container from the downloaded image. It takes about 2-8 minutes to complete.&lt;/p&gt;
&lt;p&gt;Once bootstrapping has completed, we should be able to access the Discourse from a browser using the host name that we mentioned during the setup. We will then be asked to register an Admin user account. Next we should be able to login to our Discourse instance using the admin user account.&lt;/p&gt;
&lt;h4 id=&quot;running-discourse-with-other-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-discourse-with-other-websites&quot; aria-label=&quot;running discourse with other websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running Discourse with other websites&lt;/h4&gt;
&lt;p&gt;If your server hosts other websites on port 80, then you will have to edit the Discourse Docker configuration, so that the Discourse instance can be accessed from a proxy web server, such as Nginx. When accessed through a proxy server, the Discourse server will be accessed over a socket instead of a port.&lt;/p&gt;
&lt;p&gt;This configuration is described in the article &lt;a href=&quot;https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running other websites on the same machine as Discourse&lt;/a&gt;. For example to access Discourse through Nginx, we need to first stop the Discourse using the command: &lt;strong&gt;./launcher stop app&lt;/strong&gt;. Next we need to change the container definition given in &lt;strong&gt;containers/app.yml&lt;/strong&gt;. After that we need to create a Nginx virtual host. The virtual host should forward requests to the Discourse instance over a socket.&lt;/p&gt;
&lt;p&gt;Next we can restart the Nginx server with the command: &lt;strong&gt;service nginx restart&lt;/strong&gt;. We can then start the Discourse using the command: &lt;strong&gt;launcher rebuild app&lt;/strong&gt;. We will then be able to access the Discourse from a browser. Other websites running on the same server should also be working.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Discourse is an excellent platform for building online communities. It supports integrations with well known platforms and provides many features out of the box. Its installation is simple and well documented. Discourse is supported by a large open source community and is widely used.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Linux Server Security - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Linux Server Security:]]></description><link>https://pakjiddat.netlify.app//posts/linux-server-security---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/linux-server-security---quick-tips</guid><pubDate>Tue, 16 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Linux Server Security:&lt;/p&gt;
&lt;h4 id=&quot;whitelisting-devices-and-files-for-rootkit-hunter&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#whitelisting-devices-and-files-for-rootkit-hunter&quot; aria-label=&quot;whitelisting devices and files for rootkit hunter permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://mmcgrath.fedorapeople.org/rkhunter.conf&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Whitelisting devices and files for Rootkit Hunter&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Some programs like postgresql create virtual memory devices under /dev/. Rootkit Hunter may raise warnings for these devices. To whitelist a device under dev the ALLOWDEVFILE directive can be used. This value of this directive is a single device path. Wildcard (*) may be used inside the device path. Multiple instances of the ALLOWDEVFILE directive are allowed.&lt;/p&gt;
&lt;p&gt;Some programs such as Odoo ERP can update your &lt;strong&gt;/etc/passwd&lt;/strong&gt; and &lt;strong&gt;/etc/group files&lt;/strong&gt;. RKhuRootkit Hunter may report a warning for these file changes. To whitelist the file the &lt;strong&gt;RTKT_FILE_WHITELIST&lt;/strong&gt; directive can be used. The value of this directive is the full path to the file to be whitelisted. If certain strings within the file need to be whitelisted, then the string name can be appended to the file path, with a colon before the string. e.g &lt;strong&gt;RTKT_FILE_WHITELIST=/etc/passwd:postgres&lt;/strong&gt; will whitelist the postgres user entry inside &lt;strong&gt;/etc/passwd file&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;nodejs-permission-denied-error&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#nodejs-permission-denied-error&quot; aria-label=&quot;nodejs permission denied error permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://sourcode.net/sh-1-node-permission-denied/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NodeJs permission denied error&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The error: sh: 1: node: Permission denied, usually occurs because the node binary does not allow execution with root privileges. To correct the error we need to run the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; config &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; user &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; config &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; unsafe-perm &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-g&lt;/span&gt; sm&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;configuring-sftp-and-ssh-access-for-lxc-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-sftp-and-ssh-access-for-lxc-containers&quot; aria-label=&quot;configuring sftp and ssh access for lxc containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linux.die.net/man/1/redir&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Configuring SFTP and SSH access for LXC Containers&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;Redir&lt;/strong&gt; command allows redirecting TCP connections. It takes as argument, the listen address and port and the connect address and port. The listen address and port are the IP address and port at which the redir script will listen on. The connect IP address and port are the IP address and port that the redir command will connect to and forward the incoming TCP connection.&lt;/p&gt;
&lt;p&gt;The redir command is very useful for forwarding ports. For example it can be used to forward SSH connections to a container running inside a server. The server needs to run the redir command which will forward the SSH connection to the SSH server running on the container.&lt;/p&gt;
&lt;p&gt;The following command may be used: &lt;strong&gt;redir —laddr=0.0.0.0  —lport=1001 —caddr=192.168.1.10 —cport=22 &amp;#x26;.&lt;/strong&gt; The ’&amp;#x26;’ at the end causes the redir command to run in the background. It listens on port &lt;strong&gt;1001&lt;/strong&gt; and all available IP addresses on the server. It redirects the TCP connection to IP address &lt;strong&gt;192.168.1.10&lt;/strong&gt; and port &lt;strong&gt;22&lt;/strong&gt;, which is the standard SSH port. The SFTP/SSH client would need to establish a connection on port 1001 and IP address of the server.&lt;/p&gt;
&lt;h4 id=&quot;privatetmp-systemd-option-prevents-access-to-tmp-folder&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#privatetmp-systemd-option-prevents-access-to-tmp-folder&quot; aria-label=&quot;privatetmp systemd option prevents access to tmp folder permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://serverfault.com/a/786213/375645&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PrivateTmp systemd option prevents access to tmp folder&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Systemd startup configuration files use the option &lt;strong&gt;PrivateTmp&lt;/strong&gt; to prevent processes from sharing &lt;strong&gt;tmp&lt;/strong&gt; folder.
When this option is set to true, a private tmp folder is created for each process. So if a process attempts to write to the /tmp or /var/tmp folder, the changes will be made only to the process’s private tmp folder and not the system wide /tmp and /var/tmp folders. This option may be set to true in the system startup file for Apache web server on Ubuntu and Linux Mint. For example in: &lt;strong&gt;/lib/systemd/system/apache2.service&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;fixing-rootkit-hunter-lwp-request-warning&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fixing-rootkit-hunter-lwp-request-warning&quot; aria-label=&quot;fixing rootkit hunter lwp request warning permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://mmcgrath.fedorapeople.org/rkhunter.conf&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fixing Rootkit Hunter lwp-request warning&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;RKhunter may give the following error about &lt;strong&gt;lwp-request&lt;/strong&gt; script:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;Warning: The &lt;span class=&quot;token builtin class-name&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/usr/bin/lwp-request&apos;&lt;/span&gt; has been replaced by a script: /usr/bin/lwp-request: Perl script text executable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This warning may be ignored because lwp-request is a valid Perl script. It can downloaded from the &lt;a href=&quot;https://metacpan.org/pod/lwp-request&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;lwp-request page on CPAN&lt;/a&gt;. To supress the warning we need to whitelist the &lt;strong&gt;lwp-request&lt;/strong&gt; file. We can do this by adding the following configuration option to &lt;strong&gt;/etc/rkhunter.conf&lt;/strong&gt;. &lt;strong&gt;SCRIPTWHITELIST=/usr/bin/lwp-request&lt;/strong&gt;. This was suggested in an answer to the question: &lt;a href=&quot;https://unix.stackexchange.com/questions/373718/rkhunter-gives-me-a-warning-for-usr-bin-lwp-request-what-should-i-do-debi&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;rkhunter gives me a warning for “/usr/bin/lwp-request” - what should I do? [Debian 9]&lt;/a&gt; on unix.stackexchange. It was orginally suggested in the article &lt;a href=&quot;https://forums.linuxmint.com/viewtopic.php?t=238110&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;rkhunter warning [SOLVED]&lt;/a&gt; on the Linux Mint forums.&lt;/p&gt;
&lt;h4 id=&quot;rootkit-hunter-ssh-version-warning&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rootkit-hunter-ssh-version-warning&quot; aria-label=&quot;rootkit hunter ssh version warning permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://unix.stackexchange.com/questions/194087/rkhunter-warning-about-ssh-root-access-when-that-access-is-not-allowed-on-the-sy&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rootkit Hunter SSH version warning&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Rootkit Hunter may give the following error related to root user login configuration:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;Warning: The SSH and rkhunter configuration options should be the same:
         SSH configuration option &lt;span class=&quot;token string&quot;&gt;&apos;PermitRootLogin&apos;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;:&lt;/span&gt; prohibit-password
         Rkhunter configuration option &lt;span class=&quot;token string&quot;&gt;&apos;ALLOW_SSH_ROOT_USER&apos;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;:&lt;/span&gt; no&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This warning is given, when the root user configuration in the SSHD server configuration is different from the root user configuration in &lt;strong&gt;/etc/rkhunter.conf&lt;/strong&gt; or &lt;strong&gt;/etc/rkhunter.local.conf&lt;/strong&gt;. To suppress this error, we need to set the &lt;strong&gt;ALLOW_SSH_ROOT_USER&lt;/strong&gt; in the Rootkit Hunter configuration to the same value that we set for the &lt;strong&gt;PermitRootLogin&lt;/strong&gt; configuration in &lt;strong&gt;/etc/ssh/sshd_config&lt;/strong&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Preventing WordPress Spam]]></title><description><![CDATA[WordPress is a very popular platform for publishing websites. Almost all features that one can expect from a website are provided in the form of open source plugins and themes. Adding new features to a website is as easy as installing a plugin and configuring it.]]></description><link>https://pakjiddat.netlify.app//posts/preventing-wordpress-spam</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/preventing-wordpress-spam</guid><pubDate>Tue, 16 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;WordPress is a very popular platform for publishing websites. Almost all features that one can expect from a website are provided in the form of open source plugins and themes. Adding new features to a website is as easy as installing a plugin and configuring it. Highly complex websites based on WordPress can be constructed by installing and configuring the correct plugins and themes.&lt;/p&gt;
&lt;p&gt;Given the wide range of available plugins, developing complex web sites based on WordPress may seem like an easy task. But the fact is that developing a complex website is never easy. Without proper planning and attention to detail, an application cannot achieve its required purpose. Very often, Web Developers tend to focus on the features of a website and overlook other important aspects of a website such as its performance and security. Website security is a critical issue. One that is often overlooked by the people who plan and develop the website. Recently I contributed to the development of a website based on WordPress. The website had numerous features, but was not well secured. The security problems with the website affected the entire server and caused big problems for the server administrator. I will share my experience in this article.&lt;/p&gt;
&lt;h3 id=&quot;purpose-for-developing-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#purpose-for-developing-websites&quot; aria-label=&quot;purpose for developing websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Purpose for developing websites&lt;/h3&gt;
&lt;p&gt;A website can serve many purposes. It can be used as an intranet, as a platform for spreading information about a topic. It can be used as a source of entertainment etc. The point is that a website needs to have a purpose. And it should always be achieving the purpose for which it was built. If a website is not achieving its purpose, it should be brought down. It should not be left accessible to everyone on the internet. An indication that a website is not achieving its purpose is that it is not being updated or being accessed. A website that is not being maintained can develop security problems. This is because the environment in which the website exists, which is the server and the internet are constantly changing.&lt;/p&gt;
&lt;h3 id=&quot;problems-with-neglected-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-with-neglected-websites&quot; aria-label=&quot;problems with neglected websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems with neglected websites&lt;/h3&gt;
&lt;p&gt;Websites that are not achieving any real purpose are a problem for the company and for the system administrators. The main reason why such websites exist is usually a lack of cooperation between system administrators, website developers and managers. The website that I worked with was based on WordPress. It had the latest commercial plugins that provided, forum, blog, learning system, job management, resume builder etc. The website was developed without proper consultation between managers, developers and designers. As a result due consideration was not given to the security of the website. The website was abandoned shortly after its development. For months it was not updated or even checked by the system administrators and manger.&lt;/p&gt;
&lt;h3 id=&quot;problems-caused-by-open-user-registration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-caused-by-open-user-registration&quot; aria-label=&quot;problems caused by open user registration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems caused by open user registration&lt;/h3&gt;
&lt;p&gt;A major security problem with the website was that it allowed anyone to register. While this feature is present in many websites, it needs to be carefully implemented. Of course we do not want anyone to register on our website. We do not want bots, scripts and spam users to register. Unfortunately this is what happened with the website. It was attacked with spam user registrations. Within a spam of a few weeks, over 28,000 spam users and over 45,000 spam Buddy Press groups had registered on the website.&lt;/p&gt;
&lt;h4 id=&quot;server-monitoring&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#server-monitoring&quot; aria-label=&quot;server monitoring permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Server monitoring&lt;/h4&gt;
&lt;p&gt;We would never even have known about the problem. The first sign we had of a problem was high CPU usage on our server which was hosted on Google Cloud Platform (GCP). At first we thought this was because of too many applications and insufficient CPU. So we tried to fix the problem by increasing the CPU from 2 to 4. We also removed unused applications based on Node.Js and Docker which are known to consume server resources. However this did not fix the problem and the server consistently had 100% CPU usage. This was a big problem because important company websites were hosted on this server.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;htop&lt;/strong&gt; command showed high CPU usage by the MySQL and Apache processes. Running the &lt;strong&gt;show processlist&lt;/strong&gt; command from the MySQL prompt showed over 20 SQL queries being run on a certain database constantly. The web server access log showed almost non stop access to a certain website. The overused website was using the overused database. A quick look at the database table showed a large number of users and groups.&lt;/p&gt;
&lt;h4 id=&quot;removing-spam-users&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#removing-spam-users&quot; aria-label=&quot;removing spam users permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Removing Spam users&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://wordpress.org/plugins/bulk-delete/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bulk Delete&lt;/a&gt; WordPress plugin allows deleting multiple users at once. I used this plugin to delete the Spam users. However the plugin did not work as expected and gave an error. The web server error log showed the following error:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;2019-04-09T15:17:11.259450Z 123 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name. Please run mysql_upgrade

[Tue Apr 09 11:32:17.015235 2019] [:error] [pid 3182] [client 192.168.1.1:43080] WordPress database error Table &apos;performance_schema.session_variables&apos; doesn&apos;t exist for
query show variables like &apos;max_allowed_packet&apos; made by do_action(&apos;wp_ajax_nopriv_wordfence_doScan&apos;), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, wordfence::ajax_doScan_c
allback, wfScan::wfScanMain, wfScanEngine-&gt;go, wfScanEngine-&gt;doScan, wfScanEngine-&gt;scan_knownFiles_main, wordfenceHash-&gt;run, wordfenceHash-&gt;processFile, wfScanner-&gt;incre
mentSummaryItem, wfScanner-&gt;_maybeSaveSummaryItems, wfScanner-&gt;_saveSummaryItems, wfConfig::set_ser, wfDB-&gt;getMaxAllowedPacketBytes, wfDB-&gt;querySingleRec&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;database-server-problems&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#database-server-problems&quot; aria-label=&quot;database server problems permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Database server problems&lt;/h4&gt;
&lt;p&gt;I tried to run the &lt;strong&gt;mysql_upgrade&lt;/strong&gt; command as suggested by the article &lt;a href=&quot;https://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Table ‘performance_schema.session_variables’ doesn’t exist&lt;/a&gt;. But the command would give a “Server has gone away” error. It seemed the performance_schema table in the default MySQL database had become corrupted. We were able to fix the problem by exporting all databases hosted by the MySQL server one by one using &lt;strong&gt;mysqldump&lt;/strong&gt; command. Next we completely removed the database server using the command: &lt;strong&gt;apt-get purge mariadb-client-10.1 mariadb-common mariadb-server-10.1&lt;/strong&gt;. This command removed the database binary files, configuration and data. Before removing the database server we took a snapshot of our GCP instance. We then reinstalled the database server and re-imported the databases from backup. Once database at a time. That fixed the problem with the database server. Next we removed all unused databases.&lt;/p&gt;
&lt;p&gt;After that we are able to delete the Spam users from database using the WordPress plugin. The user deletion was taking a long time, so the plugin gave timeout errors. We got passed this problem by removing 2,000 users at a time. Unfortunately we could not find a similar plugin for removing the Spam BuddyPress groups. We had to simply empty all the BuddyPress database tables as described on &lt;a href=&quot;https://buddypress.org/support/topic/how-to-completely-delete-reset-or-reinstall-buddypress-please/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to COMPLETELY delete, reset or reinstall BuddyPress, please!&lt;/a&gt;. This was not a big problem since the website did not have any real users and groups. It had some demo data that could always be imported back if needed. We could not simply redevelop the entire website since a lot of work had gone in to customizing the website theme and layout.&lt;/p&gt;
&lt;h4 id=&quot;stopping-spam-with-modsecurity-and-recaptcha&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#stopping-spam-with-modsecurity-and-recaptcha&quot; aria-label=&quot;stopping spam with modsecurity and recaptcha permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Stopping Spam with ModSecurity and ReCaptcha&lt;/h4&gt;
&lt;p&gt;We managed to reduce the number of Spam users and groups by installing and configuring ModSecurity. In my article &lt;a href=&quot;/posts/integrating-modsecurity-with-nginx-on-debian-9&quot;&gt;Integrating ModSecurity with Nginx on Debian 9&lt;/a&gt;, I describe how to install and configure ModSecurity with our Nginx web server. We configured the ModSecurity in active mode, which means that the suspicious requests were both blocked and logged. The rate at which Spam users and groups were being created decreased a lot. But the users and groups were still being added.&lt;/p&gt;
&lt;p&gt;The article &lt;a href=&quot;https://www.elegantthemes.com/blog/tips-tricks/how-to-defeat-wordpress-spam-users-identify-delete-and-prevent-future-registrations&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to Defeat WordPress Spam Users: Identify, Delete, and Prevent Future Registrations&lt;/a&gt;, gives excellent advice on how to detect and prevent Spam users on WordPress. The article suggested using Captcha to protect the registration and signup forms. We installed the &lt;a href=&quot;https://wordpress.org/plugins/google-captcha/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Captcha (reCAPTCHA) by BestWebSoft&lt;/a&gt; plugin and used it to protect all forms on our website including the registration and signup forms.&lt;/p&gt;
&lt;p&gt;Captcha’s are commonly used to protect forms from bots and scripts. They usually require the user to answer a simple question, enter the letters shown in an image or select items shown on an image. Bots and Scripts are usually not able to pass a Captcha. However these Captcha’s are inconvenient for the user and affect the usability of the website.&lt;/p&gt;
&lt;p&gt;Google’s new &lt;a href=&quot;https://www.google.com/recaptcha/intro/v3.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ReCaptcha v3&lt;/a&gt; solves this problem. It does not require any user interaction. It just shows an image to the user which shows at the bottom right. The image scrolls with the users scrolling. It shows a link to the privacy policy of the ReCaptcha. The ReCaptcha works by assigning a score to the user based on the users interaction with the website. This score is calculated using different factors. The maximum score that indicates a human user can be configured in the ReCaptcha settings. The ReCaptcha settings also how statistics on the form submissions that were blocked.&lt;/p&gt;
&lt;p&gt;To use the ReCaptcha v3 with WordPress we need to first sign up on the &lt;a href=&quot;https://www.google.com/recaptcha/intro/v3.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ReCaptcha website&lt;/a&gt;. Next we need to copy the access and secret keys. After that we can install a WordPress plugin for the ReCaptcha and configure it with the ReCaptcha keys.&lt;/p&gt;
&lt;h4 id=&quot;preventing-spam-with-a-wordpress-security-plugin&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#preventing-spam-with-a-wordpress-security-plugin&quot; aria-label=&quot;preventing spam with a wordpress security plugin permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Preventing Spam with a WordPress security plugin&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://wordpress.org/plugins/all-in-one-wp-security-and-firewall&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;All in one WP Security and Firewall&lt;/a&gt; is a useful security plugin which provides several security related features. It provides a dashboard page that lists the security score of the website. The score is calculated based on configuration of the security options. The plugin allows disabling XML-RPC requests, protecting .htaccess file, wp-config file, blocking and white-listing IP addresses, showing list of users logged in and more.&lt;/p&gt;
&lt;p&gt;Even after installing and configuring the plugin, the Spam users were still being added to the website. The only possible explanation is that the plugins installed on the website, which process the registration requests do not apply security checks to the form submission. The only solution was to completely block user registrations using &lt;strong&gt;.htaccess&lt;/strong&gt; file. We used the following code in &lt;strong&gt;.htaccess&lt;/strong&gt; file to achieve this:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;amp;#x3C;IfModule mod_rewrite.c&amp;amp;#x3E;
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^POST [NC]
RewriteCond %{REQUEST_URI} ^.*/register/$
RewriteRule .* http://127.0.0.1 [L]
&amp;amp;#x3C;/IfModule&amp;amp;#x3E;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code allowed the registration page to be accessible, but when the register form was submitted, the user was redirected to the URL: &lt;a href=&quot;http://127.0.0.1&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://127.0.0.1&lt;/a&gt;. This completely stopped the Spam user registrations. We also changed the password for all admin users. After that our problems were solved. The Spam users and groups were not being added and the CPU usage was back to normal.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;WordPress is an excellent platform for developing websites. However the WordPress developers and the developers of WordPress plugins and themes, need to pay more attention to security. A website may have great features, but if it is not secure, then it is useless.&lt;/p&gt;
&lt;p&gt;Developers of websites and managers who supervise the development of the websites should work together to ensure that the website is secure and is achieving the goal for which it was developed.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Integrating ModSecurity with Nginx on Debian 9]]></title><description><![CDATA[ModSecurity is a an open source Web Application Firewall (WAF). It can detect as well as prevent attacks to web applications. Initially released as an Apache web server module, ModSecurity now supports all major Web Servers including IIS, Nginx and Apache.]]></description><link>https://pakjiddat.netlify.app//posts/integrating-modsecurity-with-nginx-on-debian-9</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/integrating-modsecurity-with-nginx-on-debian-9</guid><pubDate>Sat, 13 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.modsecurity.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity&lt;/a&gt; is a an open source Web Application Firewall (WAF). It can detect as well as prevent attacks to web applications. Initiallly released as an Apache web server module, ModSecurity now supports all major Web Servers including IIS, Nginx and Apache.&lt;/p&gt;
&lt;p&gt;It also provides a standalone library called &lt;a href=&quot;https://github.com/SpiderLabs/ModSecurity&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Libmodsecurity&lt;/a&gt; that can be used in external applications. Connectors are used to allow external applications to use the Libmodsecurity library. The connectors serve as interfaces between external applications and Libmodsecurity. For example Nginx uses Libmodsecurity through the ModSecurity-nginx connector. In this article I will describe how to install ModSecurity and integrate it with Nginx on Debian Stretch using the ModSecurity-nginx connector.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;ModSecurity can be integrated with Nginx web server using the &lt;a href=&quot;https://github.com/SpiderLabs/ModSecurity-nginx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity-nginx connector&lt;/a&gt;. The ModSecurity-nginx connector is a Nginx module which uses the Libmodsecurity library. ModSecurity can be enabled for the following contexts: &lt;strong&gt;server, http and location&lt;/strong&gt;. the main Nginx directives provided by the ModSecurity are: &lt;strong&gt;modsecurity on | off&lt;/strong&gt; and &lt;strong&gt;modsecurity_rules_file [path to rules file]&lt;/strong&gt;. Once enabled it checks each request and compares it with the &lt;a href=&quot;https://coreruleset.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;OWASP ModSecurity Core Rule Set (CRS)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The OWASP ModSecurity Core Rule Set (CRS) is a set of attack detection rules which aims to protect Web Applications from a wide range of attacks including the &lt;a href=&quot;https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;OWASP Top Ten list&lt;/a&gt;. The CRS is intended for ModSecurity but may be used by other applications.&lt;/p&gt;
&lt;p&gt;ModSecurity may be configured in detection mode or in prevention mode. In detection mode, ModSecurity simply logs the error message to a log file. In prevention mode, the error is not only logged, but the request is blocked and an error response is sent to the sender of the request.&lt;/p&gt;
&lt;p&gt;I followed the steps given in the article: &lt;a href=&quot;https://www.linuxjournal.com/content/modsecurity-and-nginx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity and nginx&lt;/a&gt;. The article is useful and covers all the steps, but has some short commings. The guide: &lt;a href=&quot;https://www.nginx.com/resources/library/modsecurity-3-nginx-quick-start-guide/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity 3.0 and NGINX: Quick Start Guide&lt;/a&gt;, provided by the Nginx website is a comprehensive guide which may be regarded as the official documentation for integrating ModSecurity with Nginx. The main steps involved in integrating ModSecurity with Nginx are on Debian 9 (Stretch) are:&lt;/p&gt;
&lt;h4 id=&quot;install-nginx&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#install-nginx&quot; aria-label=&quot;install nginx permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Nginx&lt;/h4&gt;
&lt;p&gt;The installation of Nginx on Debian is documented on the &lt;a href=&quot;http://nginx.org/en/linux_packages.html#Debian&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Nginx website&lt;/a&gt;. The main steps are:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Add the repository url to the apt sources list&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;deb http://nginx.org/packages/debian &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;`&lt;/span&gt;lsb_release &lt;span class=&quot;token parameter variable&quot;&gt;-cs&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;`&lt;/span&gt;&lt;/span&gt; nginx&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt; /etc/apt/sources.list.d/nginx.list
&lt;span class=&quot;token comment&quot;&gt;# Add the package signing key&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-fsSL&lt;/span&gt; https://nginx.org/keys/nginx_signing.key &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; apt-key &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; -
&lt;span class=&quot;token comment&quot;&gt;# Verify the package signing key&lt;/span&gt;
apt-key fingerprint ABF5BD827BD9BF62
&lt;span class=&quot;token comment&quot;&gt;# Update system package list&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update
&lt;span class=&quot;token comment&quot;&gt;# Install Nginx&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; nginx
&lt;span class=&quot;token comment&quot;&gt;# Verify the Nginx version&lt;/span&gt;
nginx &lt;span class=&quot;token parameter variable&quot;&gt;-v&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;compile-the-libmodsecurity&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#compile-the-libmodsecurity&quot; aria-label=&quot;compile the libmodsecurity permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Compile the Libmodsecurity&lt;/h4&gt;
&lt;p&gt;To compile the Libmodsecurity library, we need to first install the dependencies. Next we need to download and compile the Libmodsecurity source code.&lt;/p&gt;
&lt;h5 id=&quot;install-the-dependencies&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#install-the-dependencies&quot; aria-label=&quot;install the dependencies permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install the dependencies&lt;/h5&gt;
&lt;p&gt;Use the following command to install the packages required by Libmodsecurity library:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; libtool autoconf build-essential libpcre3-dev zlib1g-dev libssl-dev libxml2-dev libgeoip-dev liblmdb-dev libyajl-dev libcurl4-openssl-dev libpcre++-dev pkgconf libxslt1-dev libgd-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h5 id=&quot;download-the-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#download-the-code&quot; aria-label=&quot;download the code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Download the code&lt;/h5&gt;
&lt;p&gt;Use the following commands to download the correct version of Libmodsecurity source code. Note that the command given in the &lt;a href=&quot;https://www.linuxjournal.com/content/modsecurity-and-nginx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity and nginx&lt;/a&gt; article mentions the old source code. Use the command which is mentioned in the &lt;a href=&quot;https://www.nginx.com/resources/library/modsecurity-3-nginx-quick-start-guide/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity 3.0 and NGINX: Quick Start Guide&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; /opt/
&lt;span class=&quot;token comment&quot;&gt;# The correct command for downloading the latest Libmodsecurity source code&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone &lt;span class=&quot;token parameter variable&quot;&gt;--depth&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; v3/master --single-branch https://github.com/SpiderLabs/ModSecurity
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; ModSecurity
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; submodule init
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; submodule update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h5 id=&quot;compile-the-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#compile-the-code&quot; aria-label=&quot;compile the code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Compile the code&lt;/h5&gt;
&lt;p&gt;Use the following command to compile the Libmodsecurity source code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Generate configure file&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sh&lt;/span&gt; build.sh
&lt;span class=&quot;token comment&quot;&gt;# Pre compilation step. Checks for dependencies&lt;/span&gt;
./configure
&lt;span class=&quot;token comment&quot;&gt;# Compiles the source code&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Installs the Libmodsecurity to **/usr/local/modsecurity/lib/libmodsecurity.so**&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;compile-the-connector&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#compile-the-connector&quot; aria-label=&quot;compile the connector permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Compile the connector&lt;/h4&gt;
&lt;p&gt;It requires downloading the Nginx source code and the source code for ModSecurity-nginx connector. When downloading the Nginx source code, make sure the version matches the currently installed Nginx version. Even though we just need to compile the ModSecurity-nginx connector, we need the Nginx source code. The following steps are involved:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Fetch the Nginx source code. See the directory: **http://nginx.org/download/** for all versions of Nginx&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;wget&lt;/span&gt; http://nginx.org/download/nginx-1.14.2.tar.gz
&lt;span class=&quot;token comment&quot;&gt;# Extract the downloaded source code&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-xvzf&lt;/span&gt; nginx-1.14.2.tar.gz        
&lt;span class=&quot;token comment&quot;&gt;# Fetch the source code for ModSecurity-nginx connector&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/SpiderLabs/ModSecurity-nginx
&lt;span class=&quot;token comment&quot;&gt;# Change directory to the Nginx source code&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; nginx-1.14.2/
&lt;span class=&quot;token comment&quot;&gt;# Note the compile time flags used to generate the current Nginx binary&lt;/span&gt;
nginx &lt;span class=&quot;token parameter variable&quot;&gt;-V&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Compile the Nginx using the compile time flags noted above. Exclude the **add-dynamic-module** options since we only need to compile the ModSecurity-nginx module&lt;/span&gt;
./configure &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;your-compile-time-options noted above&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; --add-dynamic-module&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;path-to-ModSecurity-nginx connector &lt;span class=&quot;token builtin class-name&quot;&gt;source&lt;/span&gt; code&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Generate the module&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt; modules
&lt;span class=&quot;token comment&quot;&gt;# Copy the module to the Nginx module directory&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;cp&lt;/span&gt; objs/ngx_http_modsecurity_module.so /etc/nginx/modules/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;configure-the-connector&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configure-the-connector&quot; aria-label=&quot;configure the connector permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configure the connector&lt;/h4&gt;
&lt;p&gt;To configure and enable the ModSecurity-nginx connector, we need to first load the ModSecurity Nginx module. Next we need to download the ModSecurity rules. After that we need to configure the ModSecurity-nginx connector.&lt;/p&gt;
&lt;h5 id=&quot;load-the-module&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#load-the-module&quot; aria-label=&quot;load the module permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Load the module&lt;/h5&gt;
&lt;p&gt;Add following line to &lt;strong&gt;/etc/nginx/nginx.conf&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;load_module modules/ngx_http_modsecurity_module.so&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h5 id=&quot;download-the-rules&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#download-the-rules&quot; aria-label=&quot;download the rules permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Download the rules&lt;/h5&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Create the modsec folder in the Nginx configuration folder. It will contain the ModSec rules&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; /etc/nginx/modsec
&lt;span class=&quot;token comment&quot;&gt;# Change directory&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; /etc/nginx/modsec
&lt;span class=&quot;token comment&quot;&gt;# Download the rules&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
&lt;span class=&quot;token comment&quot;&gt;# Rename the default ModSecurity rules configuration file&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt; /etc/nginx/modsec/owasp-modsecurity-crs/crs-setup.conf.example /etc/nginx/modsec/owasp-modsecurity-crs/crs-setup.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h5 id=&quot;configure-the-connector-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configure-the-connector-1&quot; aria-label=&quot;configure the connector 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configure the connector&lt;/h5&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Copy the default ModSecurity configuration file to the modesec folder&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;cp&lt;/span&gt; /opt/ModSecurity/modsecurity.conf-recommended /etc/nginx/modsec/modsecurity.conf
&lt;span class=&quot;token comment&quot;&gt;# Create a configuration file that will be loaded by Nginx. This file will load the ModSec rules configuration file and the ModSec configuration file&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;vi&lt;/span&gt; /etc/nginx/modsec/main.conf
&lt;span class=&quot;token comment&quot;&gt;# Add following lines to the file&lt;/span&gt;
Include /etc/nginx/modsec/modsecurity.conf
Include /etc/nginx/modsec/owasp-modsecurity-crs/crs-setup.conf
Include /etc/nginx/modsec/owasp-modsecurity-crs/rules/*.conf
&lt;span class=&quot;token comment&quot;&gt;# Restart Nginx&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt; nginx restart
&lt;span class=&quot;token comment&quot;&gt;# If you see an error that mentions missing **unicode.mapping** file, then copy the file to the mod sec folder&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;cp&lt;/span&gt; /opt/ModSecurity/unicode.mapping /etc/nginx/modsec            &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;testing-the-modsecurity&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#testing-the-modsecurity&quot; aria-label=&quot;testing the modsecurity permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Testing the ModSecurity&lt;/h4&gt;
&lt;p&gt;To test the ModSecurity Nginx integration, we need to enable the Nginx ModSecurity module for the default virtual host. Add the following 2 lines to &lt;strong&gt;/etc/nginx/conf.d/default.conf&lt;/strong&gt;. The lines should be added under the &lt;strong&gt;server_name&lt;/strong&gt; line:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to restart the Nginx server using &lt;strong&gt;service nginx restart&lt;/strong&gt;. We can test the ModSecurity by sending a suspicious request to the Nginx web server. The following command sends a curl request containing a banned user agent:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;User-Agent: masscan&quot;&lt;/span&gt; http://localhost/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following should be logged to the ModSecurity log file which is &lt;strong&gt;/var/log/modsec_audit.log&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;ModSecurity: Warning. Matched &quot;Operator `PmFromFile&apos; with parameter `scanners-user-agents.data&apos; against &amp;amp;amp;rarrhkk;variable `REQUEST_HEADERS:User-Agent&apos; (Value: `masscan&apos; )&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This indicates that ModSecurity successfully detected the suspicious request. However the request was allowed to pass through to Nginx. This is because ModSecurity operations in detection mode by default, which means it only logs the suspicious requests. To enable ModSecurity to block requests, we need to edit the ModSecurity configuration file: &lt;strong&gt;/etc/nginx/modsec/modsecurity.conf&lt;/strong&gt; and change: &lt;strong&gt;SecRuleEngine DetectionOnly&lt;/strong&gt; to &lt;strong&gt;SecRuleEngine On&lt;/strong&gt;. Next we need to restart Nginx. After that the previous curl command should fail with a &lt;strong&gt;403&lt;/strong&gt; error message, indicating that ModSecurity has successfully intercepted and blocked the request. The blocked request will also be logged.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;ModSecurity is a very useful tool which allows protecting web applications from malicious attacks. Although it can stop most attacks, it cannot stop attacks that resemble normal user requests. For example spam attacks on WordPress websites may not be stopped by ModSecurity alone. To stop such attacks we can use a tool such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Fail2ban&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fail2Ban&lt;/a&gt; or a WordPress security plugin like the &lt;a href=&quot;https://wordpress.org/plugins/all-in-one-wp-security-and-firewall&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;All In One WP Security &amp;#x26; Firewall&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For more information about Internet security, read &lt;a href=&quot;https://www.allconnect.com/blog/internet-security-threats&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Different types of Internet security threats to think about in 2023&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Graphics - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Graphics:]]></description><link>https://pakjiddat.netlify.app//posts/graphics---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/graphics---quick-tips</guid><pubDate>Fri, 05 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Graphics:&lt;/p&gt;
&lt;h4 id=&quot;adding-transparent-background-to-images-using-gimp&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-transparent-background-to-images-using-gimp&quot; aria-label=&quot;adding transparent background to images using gimp permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikihow.com/Make-a-Transparent-Image-Using-Gimp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Adding transparent background to images using GIMP&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To make the background of an image transparent using GIMP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First open the image using GIMP&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Layers -&gt; Transparency -&gt; Add Alpha Channel&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Tools -&gt; Selection Tools -&gt; Fuzzy Select&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Click on the part of the image that should be transparent. This will highlight a section of the image. Next press &lt;strong&gt;delete&lt;/strong&gt;. This will make the selected portion of the image transparent&lt;/li&gt;
&lt;li&gt;After that click on &lt;strong&gt;File -&gt; Export As&lt;/strong&gt;. Next save the image&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;drawing-rectangles-in-an-image-using-gimp&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#drawing-rectangles-in-an-image-using-gimp&quot; aria-label=&quot;drawing rectangles in an image using gimp permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://ubuntuforums.org/showthread.php?t=444294&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Drawing rectangles in an image using GIMP&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To make the background of an image transparent using GIMP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Windows -&gt; Dockable Dialogs -&gt; Colors&lt;/strong&gt;, then select a color&lt;/li&gt;
&lt;li&gt;Next go to &lt;strong&gt;Tools -&gt; Selection Tools -&gt; Rectangle Select&lt;/strong&gt;. Next select the rectangular area&lt;/li&gt;
&lt;li&gt;Next go to &lt;strong&gt;Edit -&gt; Stroke Selection&lt;/strong&gt;. After that press &lt;strong&gt;Enter&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Apache and Nginx - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Apache and Nginx Web Servers:]]></description><link>https://pakjiddat.netlify.app//posts/apache-nginx---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/apache-nginx---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Apache and Nginx Web Servers:&lt;/p&gt;
&lt;h4 id=&quot;apache-multi-processing-modules-mpms&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#apache-multi-processing-modules-mpms&quot; aria-label=&quot;apache multi processing modules mpms permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.liquidweb.com/kb/apache-mpms-explained/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Multi Processing Modules (MPMs)&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The Apache web server supports Multi Processing Modules (MPM) since version 2. An Apache MPM is a module that determines how Apache manages networking connections and output. Apache supports several MPM for different operating systems. The most commonly used MPMs are Prefork, Worker and Event MPMs.&lt;/p&gt;
&lt;p&gt;The Prefork MPM is single threaded, which means it only allows one thread per child process. This is not efficient and is not suitable for busy web sites.&lt;/p&gt;
&lt;p&gt;The Worker MPM allows multiple threads per child process. It is much more efficient than Prefork MPM.
The Event MPM is similar to the Worker MPM. It is more efficient than the Worker MPM since it allows a thread to perform more than one task. It has the lowest resource usage but is considered as experimental for Apache versions before 2.4. For Apache 2.4 and above, the Event MPM seems to be the most suitable MPM.&lt;/p&gt;
&lt;h4 id=&quot;calculating-the-number-of-simultaneous-connections-supported-by-apache&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#calculating-the-number-of-simultaneous-connections-supported-by-apache&quot; aria-label=&quot;calculating the number of simultaneous connections supported by apache permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/3389496/how-do-you-increase-the-max-number-of-concurrent-connections-in-apache&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Calculating the number of simultaneous connections supported by Apache&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Modern web browsers make 6 to 8 simultaneous connections to the web server.
The number of simultaneous connections supported by Apache web server is determined by the configuration of the MPM  that is used.&lt;/p&gt;
&lt;p&gt;Generally the maximum number of users that can access a website served by Apache is equal to &lt;strong&gt;ServerLimit * ThreadsPerChild.&lt;/strong&gt; The ServerLimit is the maximum number of processes that are allowed to be created by Apache. The ThreadsPerChild is the number of threads created per child process.&lt;/p&gt;
&lt;h4 id=&quot;generate-certificate-signing-request-csr-for-ssl-certificates&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generate-certificate-signing-request-csr-for-ssl-certificates&quot; aria-label=&quot;generate certificate signing request csr for ssl certificates permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://pk.godaddy.com/help/apache-generate-csr-certificate-signing-request-5269&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Generate Certificate Signing Request (CSR) for ssl certificates&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;In order to purchase a SSL certificate, we need to generate a Certificate Signing Request (CSR). The CSR contains information on the domain to be secured and the owner of the domain. To generate a CSR, we can use openssl command.
For example the command: &lt;strong&gt;openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr&lt;/strong&gt;, will generate a CSR file and a private key file for the domain yourdomain.com. The CSR file needs to be sent to the certificate authority that will supply the SSL certificate. The private key file should be kept securely, as it will be used by the web server.&lt;/p&gt;
&lt;h4 id=&quot;using-flags-with-rewrite-rule&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-flags-with-rewrite-rule&quot; aria-label=&quot;using flags with rewrite rule permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://httpd.apache.org/docs/current/rewrite/flags.html#flag_t&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using flags with rewrite rule&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The behavior of Rewrite commands can be modified using flags. Some of these flags take arguments. Rewrite supports several flags. The &lt;strong&gt;[R]&lt;/strong&gt; flag causes an external redirection. It means the URL in the browser changes when the &lt;strong&gt;[R]&lt;/strong&gt; flag is used. The &lt;strong&gt;[R]&lt;/strong&gt; flag takes an argument with a default value of &lt;strong&gt;302&lt;/strong&gt;. This argument is the status code of the HTTP response.&lt;/p&gt;
&lt;p&gt;The default behavior of the RewriteRule is to cause an internal redirection to the target path. It means the URL in the browser does not change. The target path is the file system path but it may be given as a URL
The &lt;strong&gt;[L]&lt;/strong&gt; flag signals that the processing of the mod_rewrite commands should stop.&lt;/p&gt;
&lt;h4 id=&quot;creating-and-installing-apache-self-signed-certificate&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-and-installing-apache-self-signed-certificate&quot; aria-label=&quot;creating and installing apache self signed certificate permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.sslshopper.com/article-how-to-create-and-install-an-apache-self-signed-certificate.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Creating and Installing Apache Self Signed Certificate&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To generate an Apache self signed certificate, we need to issue the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;openssl req &lt;span class=&quot;token parameter variable&quot;&gt;-x509&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-nodes&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-days&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;365&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-newkey&lt;/span&gt; rsa:2048 &lt;span class=&quot;token parameter variable&quot;&gt;-keyout&lt;/span&gt; mysitename.key &lt;span class=&quot;token parameter variable&quot;&gt;-out&lt;/span&gt; mysitename.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will generate a SSL certificate called &lt;strong&gt;mysitename.crt&lt;/strong&gt; and a private key file called &lt;strong&gt;mysitename.key&lt;/strong&gt;. The path to these files can be added to the Apache virtual host configuration.&lt;/p&gt;
&lt;h4 id=&quot;redirect-http-to-https-with-apache&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#redirect-http-to-https-with-apache&quot; aria-label=&quot;redirect http to https with apache permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wiki.apache.org/httpd/RewriteHTTPToHTTPS&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redirect http to https with Apache&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To redirect http urls to https, we need to add the following directives to .htaccess file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;RewriteEngine On
# This will enable the Rewrite capabilities

RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;port-forwarding-with-nginx&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#port-forwarding-with-nginx&quot; aria-label=&quot;port forwarding with nginx permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/24861311/forwarding-port-80-to-8080-using-nginx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Port forwarding with Nginx&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To run a website on a different port, port forwarding can be used. For example if a website runs over port 8080, but it needs to be accessed over port 80, then port forwarding can be used. To implement port forwarding in Nginx, the following server block needs to be added to the website configuration file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;server {
    listen 80;
    server_name example.com;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         &quot;http://127.0.0.1:8080&quot;;
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the above configuration, Nginx will listen on port 80, but will forward all requests to port 8080 on localhost.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Converting MySQL database to SQlite3 format]]></title><description><![CDATA[SQlite3 is a lightweight relational database that can be used in place of relational database servers such as MySQL and PostgreSQL. SQLite3 databases are commonly used in Mobile applications. In contrast to most relational databases, a SQLite3 database is a single independent file. The file has a .db extension. Most programming languages such as Python and PHP provide libraries for accessing SQLite3 databases.]]></description><link>https://pakjiddat.netlify.app//posts/converting-mysql-database-to-sqlite3-format</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/converting-mysql-database-to-sqlite3-format</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;SQlite3 is a lightweight relational database that can be used in place of relational database servers such as MySQL and PostgreSQL. SQLite3 databases are commonly used in Mobile applications. In contrast to most relational databases, a SQLite3 database is a single independent file. The file has a &lt;strong&gt;.db&lt;/strong&gt; extension. Most programming languages such as Python and PHP provide libraries for accessing SQLite3 databases.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/dumblob/mysql2sqlite&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mysql2sqlite&lt;/a&gt; is a free and open source script that allows converting MySQL databases to SQLite3 format.&lt;/p&gt;
&lt;p&gt;To convert a MySQL database to SQLite3, we need to first export the database using PhpMyAdmin or mysqldump. Next we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;./mysql2sqlite dump_mysql.sql &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; sqlite3 mysqlite3.db&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command converts the sql file mysql.sql to mysqlite3.db. The SQLite database can then be accessed from programming languages such as Python and PHP.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Cron Jobs - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Cron Jobs:]]></description><link>https://pakjiddat.netlify.app//posts/cron-jobs---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/cron-jobs---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Cron Jobs:&lt;/p&gt;
&lt;h4 id=&quot;format-of-crontab-file&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#format-of-crontab-file&quot; aria-label=&quot;format of crontab file permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.freebsd.org/cgi/man.cgi?crontab(5)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Format of crontab file&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;A cron tab entry has 5 fields. These are: &lt;strong&gt;minute, hour, day of month, month and day of week&lt;/strong&gt;. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;*/30 * * * 1,3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above entry will run every 30 minutes on Mondays and Wednesdays&lt;/p&gt;
&lt;h4 id=&quot;running-cron-jobs-at-random-intervals&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-cron-jobs-at-random-intervals&quot; aria-label=&quot;running cron jobs at random intervals permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/a/16289693/4508593&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running Cron Jobs at random intervals&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To run a Cron Job at random intervals we need to prefix the Cron Job command with the &lt;strong&gt;sleep&lt;/strong&gt; bash command. For example to run a Cron Job every 5 to 7 hours at random intervals, we can use the following:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;0 */5 * * * sleep $[RANDOM\%120]m; path-to-script&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above code, the ’%’ has to be escaped. The code: &lt;strong&gt;$[RANDOM%120]&lt;/strong&gt; generates a random number between 0 and 120. This is the number of minutes that script will pause. The script will run at the times: 05:00+(rand(0, 120)), 10:00+(rand(0, 120)), 15:00+(rand(0, 120)), 20:00+(rand(0, 120)) and 00:00+(rand(0, 120))&lt;/p&gt;
&lt;h4 id=&quot;running-cron-jobs-on-first-weekday-of-month&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-cron-jobs-on-first-weekday-of-month&quot; aria-label=&quot;running cron jobs on first weekday of month permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://sysadminspot.com/linux/cron-to-run-on-first-specified-day-of-the-month/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running cron jobs on first weekday of month&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To run a cron job on the first weekday of every month for example first Wednesday of each month, the following cron job entry can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;0 0 * * Wed [ `date +\%d` -le 7 ] &amp;amp;&amp;amp; command-to-run&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above cron job will be run on first Wednesday of each month&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Database Management - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Database Management:]]></description><link>https://pakjiddat.netlify.app//posts/database-management---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/database-management---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Database Management:&lt;/p&gt;
&lt;h4 id=&quot;ignoring-errors-during-mysql-import&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#ignoring-errors-during-mysql-import&quot; aria-label=&quot;ignoring errors during mysql import permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/11263018/mysql-ignore-errors-when-importing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ignoring errors during MySQL import&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;While importing large database backups we may come across errors such as duplicate indexes. It would be useful to ignore such minor errors. The &lt;strong&gt;mysql&lt;/strong&gt; command provides the —force switch which allows us to ignore the errors. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; mysql &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;mysql_user&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--force&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;sql_file&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;list-all-databases-for-postgresql&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#list-all-databases-for-postgresql&quot; aria-label=&quot;list all databases for postgresql permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://dba.stackexchange.com/questions/1285/how-do-i-list-all-databases-and-tables-using-psql&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;List all databases for Postgresql&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To list all PostgreSQL databases, we need to first switch to user postgres using the command &lt;strong&gt;su psql&lt;/strong&gt;. Next we need to login to the PostgreSQL console using the command PSQL. After that run the command \list. This will list all databases. To run queries on the database fist run the command \connect database_name. Then run your query.&lt;/p&gt;
&lt;h4 id=&quot;restoring-a-database-backup-in-plesk&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#restoring-a-database-backup-in-plesk&quot; aria-label=&quot;restoring a database backup in plesk permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://support.plesk.com/hc/en-us/articles/213904125&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Restoring a database backup in Plesk&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If your Plesk settings are messed up then it may be useful to restore the backup of the Plesk databases. Plesk automatically backups up the following databases every day: psa, horde and mysql. For example the psa database can be restored with following command: &lt;strong&gt;plesk db psa &amp;#x3C; psa.sql&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;how-to-login-to-mysql-server-as-root-user-on-plesk&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-to-login-to-mysql-server-as-root-user-on-plesk&quot; aria-label=&quot;how to login to mysql server as root user on plesk permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://support.plesk.com/hc/en-us/articles/213909425&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to login to MySQL server as root user on Plesk&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To login to MySQL server as root privileges on a Plesk server we can use the following command: ** MYSQL_PWD=&lt;code class=&quot;language-text&quot;&gt;cat /etc/psa/.psa.shadow&lt;/code&gt; mysql -u admin**&lt;/p&gt;
&lt;h4 id=&quot;deleting-a-mongo-db-database&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deleting-a-mongo-db-database&quot; aria-label=&quot;deleting a mongo db database permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/drop/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Deleting a Mongo Db database&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To delete a Mongo Db database called test, enter the command: &lt;strong&gt;mongo&lt;/strong&gt;. This will take you to the Mongo Db shell. Then enter the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;use test&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
db&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;runCommand&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;dropDatabase&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;create-backup-of-mongo-db-database&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#create-backup-of-mongo-db-database&quot; aria-label=&quot;create backup of mongo db database permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/program/mongodump/#bin.mongodump&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Create backup of Mongo Db database&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To backup a Mongo Db database, we can use the command: &lt;strong&gt;mongodump —archive=test.gz —gzip —db test&lt;/strong&gt;. It will create a gzip backup of the test database&lt;/p&gt;
&lt;h4 id=&quot;troubleshooting-problems-with-mysql-server-using-mysql-tuner&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#troubleshooting-problems-with-mysql-server-using-mysql-tuner&quot; aria-label=&quot;troubleshooting problems with mysql server using mysql tuner permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/major/MySQLTuner-perl&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Troubleshooting problems with MySQL server using MySQL Tuner&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The MySQL tuner is a Perl script that checks a MySQL server and gives suggestions on how to improve its performance
The script checks MySQL server log files and configuration and suggests optimal values for server configuration variables such as &lt;strong&gt;query_cache_size&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;mysql-server-out-of-resources&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mysql-server-out-of-resources&quot; aria-label=&quot;mysql server out of resources permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://support.plesk.com/hc/en-us/articles/213938885-Plesk-or-website-does-not-work-Unable-to-connect-to-database-MySQL-server-has-gone-away-Full-server-backup-is-created-with-warning-errno-24-Too-many-open-files?sort_by=votes&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MySQL server out of resources&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you get following error on your MySQL/MariaDB server: &lt;strong&gt;General error: 23 Out of resources&lt;/strong&gt;, then a possible solution is to increase the &lt;strong&gt;open_file_limit&lt;/strong&gt; mysql variable. On Centos 7, this can be done by first creating the folder: &lt;strong&gt;/etc/systemd/system/mariadb.service.d/&lt;/strong&gt;, then create a new file &lt;strong&gt;limits.conf&lt;/strong&gt; with the following contents:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[Service]
LimitNOFILE=20000&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that restart the MySQL/MariaDB service with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;systemctl daemon-reload
systemctl restart mariadb.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;sorting-a-mysql-string-column-as-a-number&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#sorting-a-mysql-string-column-as-a-number&quot; aria-label=&quot;sorting a mysql string column as a number permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/44829035/wordpress-sort-posts-containing-numbers-and-letters-alphabetically/44857800#44857800&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Sorting a MySQL string column as a number&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To sort a MySQL string column containing a number we can use the &lt;strong&gt;SUBSTRING&lt;/strong&gt; and &lt;strong&gt;CAST&lt;/strong&gt; functions. The &lt;strong&gt;SUBSTRING&lt;/strong&gt; function should extract the numbers inside the string. The CAST function will convert the extracted string to a number.&lt;/p&gt;
&lt;h4 id=&quot;mysql-user-password-not-being-set&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mysql-user-password-not-being-set&quot; aria-label=&quot;mysql user password not being set permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://superuser.com/questions/949496/cant-reset-mysql-mariadb-root-password&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MySQL user password not being set&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you have problems with setting the user password on MariaDB or MySQL, for example you set the user password and are not able to login with the new password, then the problem may be caused because the database user is configured to use the wrong authentication plugin. For example &lt;strong&gt;unix_socket&lt;/strong&gt; plugin instead of the default authentication scheme.&lt;/p&gt;
&lt;p&gt;The solution is to set the plugin field in the user table of the MySQL database to empty value. This will cause the MySQL/MariaDB server to authenticate the database user with the default authentication scheme.&lt;/p&gt;
&lt;h4 id=&quot;removing-only_full_group_by-sql-mode&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#removing-only_full_group_by-sql-mode&quot; aria-label=&quot;removing only_full_group_by sql mode permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://johnemb.blogspot.com/2014/09/adding-or-removing-individual-sql-modes.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Removing ONLY_FULL_GROUP_BY sql mode&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;In &lt;strong&gt;MySQL 5.7.5&lt;/strong&gt; the &lt;strong&gt;ONLY_FULL_GROUP_BY SQL mode&lt;/strong&gt; was introduced. In this mode, Non-deterministic grouping queries are rejected.&lt;/p&gt;
&lt;p&gt;Applications that use GROUP BY clause in SQL queries may start giving errors after an upgrade to the MySQL server. To allow the applications to continue working, we need to remove the ONLY_FULL_GROUP_BY option from the SQL mode variable.
This can be done by setting the SQL mode variable in &lt;strong&gt;/etc/mysql/mysql.conf.d/mysqld.cnf&lt;/strong&gt; without the ONLY_FULL_GROUP_BY option. After that the MySQL server should be restarted. To get the current value of the SQL mode variable go to the variables tab in PhpMyAdmin and copy the value of SQL mode variable.&lt;/p&gt;
&lt;h4 id=&quot;batch-rename-mysql-database-tables&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#batch-rename-mysql-database-tables&quot; aria-label=&quot;batch rename mysql database tables permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/10066783/in-mysql-how-do-i-batch-rename-tables-within-a-database&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Batch rename MySQL database tables&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Sometimes we need to rename our MySQL database tables in bulk. For example we may decide to add or change the table prefix on all tables within a database. Database management tools such as PhpMyAdmin allow us to rename tables with a few clicks, but most tools do not allow batch renaming.&lt;/p&gt;
&lt;p&gt;The article &lt;a href=&quot;https://stackoverflow.com/questions/10066783/in-mysql-how-do-i-batch-rename-tables-within-a-database&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;In MySQL, how do I batch rename tables within a database?&lt;/a&gt; suggests that to rename several MySQL tables at once, we can run a SQL query that fetches the list of all database tables from the information_schema.tables table. The SQL query can generate rename table statements. We can then export these rename table statements to a file. We can further process the table names using the find/replace feature of standard text editors. Next we can run the SQL queries for renaming the database tables.&lt;/p&gt;
&lt;p&gt;For example the following SQL query will append the text “_old” to all tables in the “db” database. The query will not actually rename any tables. It will simply generate rename table statements. In order to restrict the renaming to certain tables, we can update the WHERE condition.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt; concat &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;rename table &apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; table_name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos; to &apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; table_name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;_old;&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt; information_schema&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;tables&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt; table_schema&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;db&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;mysql-query-to-calculate-running-balance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mysql-query-to-calculate-running-balance&quot; aria-label=&quot;mysql query to calculate running balance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/a/56721288/4508593&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MySQL query to calculate running balance&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;It is possible to calculate a running balance using only MySQL. A running balance is similar to the last column of a bank statement. Since the running balance depends on the balance of the previous row, we need to use a temporary table. The following three SQL queries can be used to calculate a running balance:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token number&quot;&gt;1.&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;TEMPORARY&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;table&lt;/span&gt; tbl_temp &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; tbl&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token number&quot;&gt;2.&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;update&lt;/span&gt; tbl t1 &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; t1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bal&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;t2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;deposited_amount&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;t2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;issued_amount&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt; tbl_temp t2 &lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt; t2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;id&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;t1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;id&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token number&quot;&gt;3.&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; tbl&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;profiling-mysql-queries-using-phpmyadmin&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#profiling-mysql-queries-using-phpmyadmin&quot; aria-label=&quot;profiling mysql queries using phpmyadmin permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/10066783/in-mysql-how-do-i-batch-rename-tables-within-a-database&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Profiling MySQL queries using PhpMyAdmin&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To see which SQL queries are currently running on your MySQL server, enter the following SQL commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;GLOBAL&lt;/span&gt; general_log &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;ON&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;GLOBAL&lt;/span&gt; log_output &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;TABLE&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will log the SQL queries to the table: “general_log” in MySQL database.&lt;/p&gt;
&lt;p&gt;To see which slow SQL queries are currently running on your MySQL server, enter the following SQL commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;GLOBAL&lt;/span&gt; slow_query_log &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;ON&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;GLOBAL&lt;/span&gt; log_queries_not_using_indexes &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;ON&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;GLOBAL&lt;/span&gt; log_output &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;TABLE&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will log all the slow SQL queries to the table: “slow_log” in MySQL database. It will also log queries that are not using indexes.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[HTML, JavaScript and CSS - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to HTML, JavaScript and CSS:]]></description><link>https://pakjiddat.netlify.app//posts/html--javascript-and-css---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/html--javascript-and-css---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to HTML, JavaScript and CSS:&lt;/p&gt;
&lt;h4 id=&quot;free-font-for-urdu-language&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#free-font-for-urdu-language&quot; aria-label=&quot;free font for urdu language permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.cle.org.pk/software/localization/Fonts/nafeesWebNaskh.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Free Font for Urdu language&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;A free font for Urdu language is provided by a Pakistani Organization called Center for Language Engineering (CLE). The organization conducts research and development in linguistic and computational aspects of languages, specifically of Pakistan and developing Asia&lt;/p&gt;
&lt;h4 id=&quot;how-to-use-ccs-rules-specific-to-firefox&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-to-use-ccs-rules-specific-to-firefox&quot; aria-label=&quot;how to use ccs rules specific to firefox permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/952861/targeting-only-firefox-with-css&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to use CCS rules specific to FireFox&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The CSS statement:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@-moz-document&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;url-prefix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;red&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;allows the CSS rule: h1 {color:red} to be applied only to Firefox browser&lt;/p&gt;
&lt;h4 id=&quot;using-ems-instead-of-pixels-for-typography&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-ems-instead-of-pixels-for-typography&quot; aria-label=&quot;using ems instead of pixels for typography permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.w3schools.com/cssref/css_pxtoemconversion.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using ems instead of Pixels for Typography&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;EM is a unit for font sizes. It is based on the font size of the container element.
For example if an element has a font-size set to 2em and the font-size of the container element is set to 20px, then the font-size of the target element will be 40px&lt;/p&gt;
&lt;h4 id=&quot;replacing-a-string-using-javascript-replace-function&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#replacing-a-string-using-javascript-replace-function&quot; aria-label=&quot;replacing a string using javascript replace function permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Replacing a string using Javascript replace function&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The replace function can be used to replace a substring with another string using regular expressions.
For example: &lt;strong&gt;str.replace(/substring/g, ‘New Substring’);&lt;/strong&gt; will replace all occurrences of ‘substring’ with ‘New Substring’&lt;/p&gt;
&lt;h4 id=&quot;base64-encoding-of-utf-8-encoded-string-using-javascript&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#base64-encoding-of-utf-8-encoded-string-using-javascript&quot; aria-label=&quot;base64 encoding of utf 8 encoded string using javascript permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_.22Unicode_Problem.22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Base64 Encoding of utf-8 encoded string using Javascript&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The btoa function encodes an ASCII encoded string using Base64 encoding scheme. If the string is utf-8 encoded then the btoa function will not work correctly. The solution is to first url encode the string using encodeURIComponent and then call window.btoa function.&lt;/p&gt;
&lt;h4 id=&quot;passing-parameters-to-jquery-event-handler-function&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#passing-parameters-to-jquery-event-handler-function&quot; aria-label=&quot;passing parameters to jquery event handler function permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/4897368/how-to-use-a-function-that-takes-arguments-with-jquerys-change-method&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Passing parameters to Jquery event handler function&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To pass a parameter to Jquery event handler, the parameter should be given as first argument to event function. The argument will be passed on as a property of event.data. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;.selector&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;change&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;parameter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;user_function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parameter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;fetching-html-elements-using-javascript&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fetching-html-elements-using-javascript&quot; aria-label=&quot;fetching html elements using javascript permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.w3schools.com/jsref/prop_node_parentnode.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fetching HTML elements using JavaScript&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Fetching parent node element of a HTML node&lt;/strong&gt;. We can fetch the parent node of a HTML element using following code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;myLI&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;nodeName&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Fetching HTML elements using CSS class names&lt;/strong&gt;. We can fetch HTML elements from CSS classes using following JavaScript code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementsByClassName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;example&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Fetching html elements using CSS selectors with Javascript&lt;/strong&gt;. The following Javascript code fetches html elements using CSS selectors:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;.example&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;get-current-unix-timestamp-using-javascript&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#get-current-unix-timestamp-using-javascript&quot; aria-label=&quot;get current unix timestamp using javascript permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.w3schools.com/jsref/jsref_gettime.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Get current unix timestamp using Javascript&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The Javascript function getTime returns the number of milliseconds since Jan 1st, 1970, which is called the unix timestamp&lt;/p&gt;
&lt;h4 id=&quot;adding-tilt-effect-to-images-using-tiltjs&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-tilt-effect-to-images-using-tiltjs&quot; aria-label=&quot;adding tilt effect to images using tiltjs permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://gijsroge.github.io/tilt.js/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Adding tilt effect to images using tilt.js&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Tilt.js is a library that allows adding tilt effect to HTML elements. For example div and image tags. To add a tilt affect to an image, the following code may be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Content-Type&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text/html; charset=UTF-8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Tilt.js - DEMO&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;js/jquery.slim.min.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;js/tilt.jquery.min.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
      &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; tilt &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-tilt&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tilt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; tiltOutput &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-tilt-output&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tilt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
          tiltOutput&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;change&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; transforms&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
              &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; output &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;closest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-parent&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-output&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
              &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;&amp;lt;li&gt;&amp;lt;strong&gt;X: &amp;lt;/strong&gt;&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; transforms&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;percentageX &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos; | &amp;lt;strong&gt;Y: &amp;lt;/strong&gt;&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; transforms&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;percentageY &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;&amp;lt;/li&gt;&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;prependTo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;output&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

          &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-destroy&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;click&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
              &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; element &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;closest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-parent&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-tilt&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
              element&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tilt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;element&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

          &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-enable&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;click&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
              &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; element &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;closest&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-parent&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;.js-tilt&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
              element&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tilt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;_blank&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;[some-url]&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;[image-url]&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;js-tilt&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-tilt-speed&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;1000&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-tilt-max&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;20&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-tilt-scale&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;1.2&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data-tilt-perspective&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;250&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;961px&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;scrolling-to-specific-position-in-page&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#scrolling-to-specific-position-in-page&quot; aria-label=&quot;scrolling to specific position in page permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.w3schools.com/jsref/met_win_scrollto.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Scrolling to specific position in page&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To scroll the page to a particular position, the following code may be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; temp_arr &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; location&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;#&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; div_id   &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; temp_arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;#&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; div_id&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scrollTo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;top &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code causes the current page to scroll to a certain div. The id of this div is given by the URL hash fragment.&lt;/p&gt;
&lt;p&gt;The code uses the JQuery &lt;strong&gt;position&lt;/strong&gt; function to get the left and top co-ordinates of the div tag. The &lt;strong&gt;window.scrollTo&lt;/strong&gt; function is used to scroll 100px above this div tag, so it can be viewed properly.&lt;/p&gt;
&lt;h4 id=&quot;preloading-font-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#preloading-font-files&quot; aria-label=&quot;preloading font files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/webfont-optimization#the_font_loading_api&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Preloading font files&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;In order to use custom fonts that are not supported by the browser, we need to load a font file. Sometimes the font file may take a while to fetch, because of which the website text is displayed with default font. This usually happens with slow internet connections.&lt;/p&gt;
&lt;p&gt;This can be a problem for websites that need to display text in a foreign language such as Urdu or Arabic. To prevent this problem, we can preload the font file. This allows the browser to load the font file before other content. It increases the chances of displaying text with correct font.&lt;/p&gt;
&lt;p&gt;If the text is still not displayed with correct font, then we can use the Font API to load the font files. The Font API provides a JavaScript interface for loading font files. It allows monitoring loading of files. It can be used to hide text until a font file has completed loading.&lt;/p&gt;
&lt;p&gt;The article &lt;a href=&quot;https://stackoverflow.com/a/46830425&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Preloading @font-face fonts?&lt;/a&gt; discusses how to preload font files. The following code may be used to preload font files:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;preload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/ui/font/NafeesWeb.ttf&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;font&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;crossorigin&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;anonymous&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
@font-face {
  font-display: auto;
  font-family: NafeesWeb;
  src: local(NafeesWeb),url(/ui/font/NafeesWeb.ttf);
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Linux Server Administration - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Linux Server Administration:]]></description><link>https://pakjiddat.netlify.app//posts/linux-server-administration---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/linux-server-administration---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Linux Server Administration:&lt;/p&gt;
&lt;h4 id=&quot;recover-deleted-files-on-ext3ext4-file-system-using-photorec&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#recover-deleted-files-on-ext3ext4-file-system-using-photorec&quot; aria-label=&quot;recover deleted files on ext3ext4 file system using photorec permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.cyberciti.biz/tips/linux-ext3-ext4-deleted-files-recovery-howto.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Recover deleted files on ext3/ext4 file system using Photorec&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Photorec is part of testdisk package. To install testdisk package on Debian use &lt;strong&gt;apt-get install testdisk&lt;/strong&gt;. To run photorec enter the command photorec.&lt;/p&gt;
&lt;h4 id=&quot;force-grub2-to-not-use-uuid&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#force-grub2-to-not-use-uuid&quot; aria-label=&quot;force grub2 to not use uuid permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://askubuntu.com/questions/257425/can-i-force-grub2-update-not-to-use-uui&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Force grub2 to not use UUID&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;When restoring backup of virtual machine, the backup process may create a new disk with a new UUID. In such cases it may be useful to update grub2 so it uses the disk physical path instead of the disk UUID.&lt;/p&gt;
&lt;p&gt;The server may not reboot if the UUID of the new disk is different from the UUID of the old disk. One possible solution is to ensure that /etc/fstab file uses physical paths instead of UUID. Another solution is to update grub configuration so it uses physical device paths e.g /dev/xvda1 instead of UUID of disk.&lt;/p&gt;
&lt;h4 id=&quot;how-to-backup-and-restore-lxc-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-to-backup-and-restore-lxc-containers&quot; aria-label=&quot;how to backup and restore lxc containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/23427129/how-do-i-backup-move-lxc-containers&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to Backup and Restore LXC containers&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;It describes how to backup and restore LXC containers. One option for backing up a LXC container is to create a tar acrhive using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;lxc-stop &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; ContainerName&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; /var/lib/lxc/ContainerName/
&lt;span class=&quot;token function&quot;&gt;tar&lt;/span&gt; --numeric-owner &lt;span class=&quot;token parameter variable&quot;&gt;-czvf&lt;/span&gt; container_fs.tar.gz ./*&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The backup of the container may be restored using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;rsync&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-avh&lt;/span&gt; container_fs.tar.gz user@server_name:/var/lib/lxc/
&lt;span class=&quot;token function&quot;&gt;tar&lt;/span&gt; --numeric-owner &lt;span class=&quot;token parameter variable&quot;&gt;-xzvf&lt;/span&gt; container_fs.tar.gz ./*&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;installing-memcached-for-php-7&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-memcached-for-php-7&quot; aria-label=&quot;installing memcached for php 7 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/book.memcached.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installing memcached for Php 7&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Memcached is an extension for Php that allows accessing the Memcached daemon from Php. A similar extension called Memcache is also available but it is out dated and does not support Php 7.&lt;/p&gt;
&lt;p&gt;To install Memcached for Php 7 we need to first fetch the source code from GitHub by cloning the php7 branch. Then we need to compile it from source using the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; php7 https://github.com/php-memcached-dev/php-memcached.git
phpize
./configure
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;. The Php memcached extension has now been updated to support Php 7.x. To install the Php memcached extension the following command can be used: &lt;strong&gt;pear install memcached&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;sending-email-through-gmail-server-using-mailx-command&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#sending-email-through-gmail-server-using-mailx-command&quot; aria-label=&quot;sending email through gmail server using mailx command permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://support.google.com/accounts/answer/6010255?hl=en&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Sending email through Gmail server using mailx command&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://linux.die.net/man/1/mailx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mailx&lt;/a&gt; command can be used to send email through the gmail smtp server. For example the following command can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;mailx &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Memory usage on server is more than 70%. Please check!.&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;reply_email&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;smtp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;smtp.gmail.com:587&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
smtp-use-starttls &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;login &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth-user&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_address&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth-password&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_password&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
ssl-verify&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;ignore recepiant_email &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; /tmp/mail_body.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above command the “gmail_address” needs to allow access from insecure devices. This &lt;a href=&quot;https://support.google.com/accounts/answer/6010255?hl=en&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;article&lt;/a&gt; explains how to do this.&lt;/p&gt;
&lt;h4 id=&quot;list-users-currently-logged-in&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#list-users-currently-logged-in&quot; aria-label=&quot;list users currently logged in permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.cyberciti.biz/faq/unix-linux-list-current-logged-in-users/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;List users currently logged in&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To list the currently logged in users, we can use the command: &lt;strong&gt;users&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;upgrading-rocket-chat-to-latest-version&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#upgrading-rocket-chat-to-latest-version&quot; aria-label=&quot;upgrading rocket chat to latest version permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://rocket.chat/docs/installation/manual-installation/ubuntu#update&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Upgrading Rocket Chat to latest version&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To upgrade Rocket Chat to the latest version we need to first download the latest version of Rocket Chat using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-L&lt;/span&gt; https://rocket.chat/releases/latest/download &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; rocket.chat.tgz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to unzip the file. Then we need to remove the content of the current Rocket Chat folder with the contents of the unzipped file. After that we need to change directory to programs/server and run: &lt;strong&gt;npm install&lt;/strong&gt;. If the command fails then we may need to install the node-pre-gyp package using the command: &lt;strong&gt;npm install node-pre-gyp&lt;/strong&gt;. After that run the previous command. This should upgrade the Rocket Chat to the latest version.&lt;/p&gt;
&lt;h4 id=&quot;problem-with-copying-large-files-to-usb&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-with-copying-large-files-to-usb&quot; aria-label=&quot;problem with copying large files to usb permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://askubuntu.com/questions/348888/how-do-i-solve-error-splicing-files/610357#610357&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Problem with copying large files to USB&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you are trying to copy a large file to a disk that has been formatted with the FAT32 file system or similar, then you might get the error: &lt;strong&gt;“Error splicing file: File too large”&lt;/strong&gt;. The error can be corrected by formatting the disk with the ext4 file system.&lt;/p&gt;
&lt;h4 id=&quot;migrating-trello-issues-to-redmine&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-trello-issues-to-redmine&quot; aria-label=&quot;migrating trello issues to redmine permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/inequation/trello2redmine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Migrating Trello issues to Redmine&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We can use this script to migrate Trello issues to Redmine: &lt;a href=&quot;https://github.com/inequation/trello2redmine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://github.com/inequation/trello2redmine&lt;/a&gt;
To use the script, we first need to configure it with the Redmine url, project id, default user and a few other parameters. We can run the script with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;python trello2redmine.py &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;checking-email-server-for-problems&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#checking-email-server-for-problems&quot; aria-label=&quot;checking email server for problems permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://mxtoolbox.com/diagnostic.aspx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Checking Email server for problems&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The MxToolBox is an online tool that allows checking Email server for problems such as missing PTR records, open relays etc. Its a useful tool for troubleshooting network related problems.&lt;/p&gt;
&lt;h4 id=&quot;debugging-programs-on-linux-using-strace&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#debugging-programs-on-linux-using-strace&quot; aria-label=&quot;debugging programs on linux using strace permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Strace&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debugging programs on Linux using strace&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Strace is a system tool that is used to debug programs on Linux based operating systems. It uses a feature of the Linux kernel known as ptrace.&lt;/p&gt;
&lt;p&gt;Strace as its name suggests is used to trace operating system calls. It can be used to find out if a program is getting stuck because of a missing file or because of shared memory problems. For example it can show the id of the semaphore that is causing the program to fail. This semaphore can then be removed using the ipcrm command. The ipcrm command allows removing System V inter-process communication (IPC) objects and associated data structures from the system.&lt;/p&gt;
&lt;h4 id=&quot;increasing-number-of-concurrent-connections-for-proftp&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#increasing-number-of-concurrent-connections-for-proftp&quot; aria-label=&quot;increasing number of concurrent connections for proftp permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.proftpd.org/docs/howto/BCP.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Increasing number of concurrent connections for Proftp&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To set the number of concurrent connections for Proftp, we need to set the following configuration directives in the Proftp configuration file: &lt;strong&gt;MaxInstances, MaxClients, MaxClientsPerHost, MaxClientsPerUser, MaxHostsPerUser&lt;/strong&gt;. These directive are set when Proftp is running in standalone mode.&lt;/p&gt;
&lt;p&gt;If Proftp is running in inet mode, then &lt;strong&gt;per_source&lt;/strong&gt; and &lt;strong&gt;cps attributes&lt;/strong&gt; need to be set in the xinetd configuration file.&lt;/p&gt;
&lt;h4 id=&quot;using-pscp-command-for-copying-files-and-directories&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-pscp-command-for-copying-files-and-directories&quot; aria-label=&quot;using pscp command for copying files and directories permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://serverfault.com/questions/295565/pscp-upload-an-entire-folder-windows-to-linux&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using PSCP command for copying files and directories&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;PSCP is a command that allows uploading files and folders to a remote server. Its benefit is that it does not require rsync to be installed on the remote server. The PSCP command can be used for copying data to a shared hosting platform which does not support rsync and does not provide shell access. It can also be used to transfer data between Windows and Linux servers.&lt;/p&gt;
&lt;p&gt;The following command can be used to recursively copy a folder to a remote destination:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;pscp &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;source_folder&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;user_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;@&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_server&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_folder_path&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;finding-name-server-records-for-domains-using-dig&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#finding-name-server-records-for-domains-using-dig&quot; aria-label=&quot;finding name server records for domains using dig permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/38021/how-do-i-find-the-authoritative-name-server-for-a-domain-name&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Finding name server records for domains using Dig&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Dig&lt;/strong&gt; is a useful command line tool which allows retrieving DNS records for a domain.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Name_server&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Authoritative name servers&lt;/a&gt; are servers that provide DNS information about a domain. An Authoritative name server may be a primary or secondary name server. A primary name server contains definitive and reliable information about a domain. A secondary name server is a slave name server which contains replica of dns records on a primary name server.&lt;/p&gt;
&lt;p&gt;To fetch the list of name server records for a domain we can use the command: &lt;strong&gt;dig NS {domain_name}&lt;/strong&gt;. If we add the +short flag, then a summary of the information is returned. Other types of DNS records may be fetched similarly.&lt;/p&gt;
&lt;h4 id=&quot;plesk-repair-utility&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#plesk-repair-utility&quot; aria-label=&quot;plesk repair utility permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://docs.plesk.com/en-US/onyx/administrator-guide/plesk-administration/plesk-repair-utility.74649/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk Repair Utility&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The Plesk repair command is used to automatically diagnose and resolve issues with Plesk. To use the command, login to your Plesk server over SSH and enter the command: &lt;strong&gt;plesk repair ASPECT [OPTION]&lt;/strong&gt;. &lt;strong&gt;ASPECT&lt;/strong&gt; indicates the service to repair while &lt;strong&gt;OPTION&lt;/strong&gt; indicates how the repair should be performed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ASPECT&lt;/strong&gt; can have several values such as web, mysql, mail, all etc.
&lt;strong&gt;OPTION&lt;/strong&gt; can have the values: &lt;strong&gt;Interactive mode&lt;/strong&gt;, &lt;strong&gt;Diagnostic mode&lt;/strong&gt; or &lt;strong&gt;Repair mode&lt;/strong&gt;. The default option which is &lt;strong&gt;Interactive mode&lt;/strong&gt;, prompts the user to take action when an issue is found. In &lt;strong&gt;Diagnostic mode&lt;/strong&gt;, the issue is indicated but no action is taken. In &lt;strong&gt;Repair mode&lt;/strong&gt;, the issue is automatically resolved.&lt;/p&gt;
&lt;h4 id=&quot;checking-hard-disk-for-bad-blocks&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#checking-hard-disk-for-bad-blocks&quot; aria-label=&quot;checking hard disk for bad blocks permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Checking hard disk for bad blocks&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;A hard disk bad block is a section of the hard disk that cannot be read from or written to. To detect bad blocks we can use the badblocks command. For example to scan the hard drive &lt;strong&gt;/dev/sda&lt;/strong&gt; for bad blocks, we can run the command: &lt;strong&gt;badblocks -v /dev/sda&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;listing-files-and-directories-sorted-by-size&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#listing-files-and-directories-sorted-by-size&quot; aria-label=&quot;listing files and directories sorted by size permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.tecmint.com/find-top-large-directories-and-files-sizes-in-linux/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Listing files and directories sorted by size&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To find out which files and directories under a given directory are taking up the most space, the following command can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;du&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-a&lt;/span&gt; /home &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sort&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;setting-java_home-in-debian&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#setting-java_home-in-debian&quot; aria-label=&quot;setting java_home in debian permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/24641536/how-to-set-java-home-in-linux-for-all-users&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Setting JAVA_HOME in Debian&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;JAVA_HOME&lt;/strong&gt; environment variable is set to the path of the JDK installation. On Debian 9 the location of the JDK is &lt;strong&gt;/usr/lib/jvm/java-11-openjdk-amd64&lt;/strong&gt; for JDK version 11. The variable should be set in /home/[user]/.bashrc file, where [user] is the system user account used to run Java applications. For example add following to /home/user/.bashrc file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;export JAVA_HOME=&quot;/usr/lib/jvm/java-11-openjdk-amd64&quot;
export PATH=$JAVA_HOME/bin:$PATH&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Linux Command Line Tools - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Linux Command Line Tools:]]></description><link>https://pakjiddat.netlify.app//posts/linux-command-line-tools---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/linux-command-line-tools---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Linux Command Line Tools:&lt;/p&gt;
&lt;h4 id=&quot;using-sed-tool-for-replacing-text-in-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-sed-tool-for-replacing-text-in-files&quot; aria-label=&quot;using sed tool for replacing text in files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/6945621/using-sed-to-remove-a-block-of-text/36493035#3649303&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using SED tool for replacing text in files&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The following script can be used for updating all occurrences of a text inside files:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; folder_name &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;token parameter variable&quot;&gt;-print0&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;xargs&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-0&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;s/current_text/new_text/g&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;using-sed-tool-for-removing-line-that-starts-with-some-text-in-all-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-sed-tool-for-removing-line-that-starts-with-some-text-in-all-files&quot; aria-label=&quot;using sed tool for removing line that starts with some text in all files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/8206280/delete-all-lines-beginning-with-a-from-a-file&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using SED tool for removing line that starts with some text in all files&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The following script can be used for updating all occurrences of a text inside files:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;token parameter variable&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/^category:/ d&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; +&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;using-rsync-fore-recursive-file-copy&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-rsync-fore-recursive-file-copy&quot; aria-label=&quot;using rsync fore recursive file copy permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linux.die.net/man/1/rsync&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using Rsync fore recursive file copy&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To use Rsync for copying all mp3 files recursively from one folder to a single folder, use following command: &lt;strong&gt;rsync -avz .&lt;em&gt;/.&lt;/em&gt;.mp3 destination_folder/&lt;/strong&gt;. The command should be issued from the source folder&lt;/p&gt;
&lt;h4 id=&quot;viewing-number-of-files-in-directory&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#viewing-number-of-files-in-directory&quot; aria-label=&quot;viewing number of files in directory permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linuxconfig.org/wc-1-manual-page&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Viewing number of files in directory&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Use following command for fetching number of files in directory: &lt;strong&gt;ls | wc -l&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;convert-pdf-files-to-text-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#convert-pdf-files-to-text-files&quot; aria-label=&quot;convert pdf files to text files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.cyberciti.biz/faq/converter-pdf-files-to-text-format-command/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Convert pdf files to text files&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The pdftotext utility which is part of poplar-utils package allows converting pdf files to text files&lt;/p&gt;
&lt;h4 id=&quot;automate-scp-command-using-sshpass&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#automate-scp-command-using-sshpass&quot; aria-label=&quot;automate scp command using sshpass permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://serverfault.com/questions/318474/how-to-pass-password-to-scp-command-used-in-bash-script&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Automate scp command using sshpass&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To use the &lt;strong&gt;scp&lt;/strong&gt; command non-interactively, for example in a script, we can use the &lt;strong&gt;sshpass&lt;/strong&gt; utility.
The following command can be used to copy a file to a remote server:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;sshpass &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;{password}&apos;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;scp&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;source_file_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_user&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;@&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_server&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_server_path&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;delete-downloaded-file-using-wget&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#delete-downloaded-file-using-wget&quot; aria-label=&quot;delete downloaded file using wget permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linux.die.net/man/1/wget&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Delete downloaded file using Wget&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;delete-after&lt;/strong&gt; command line option of wget is used to delete the downloaded file&lt;/p&gt;
&lt;h4 id=&quot;fetching-website-resource-over-https-using-wget&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fetching-website-resource-over-https-using-wget&quot; aria-label=&quot;fetching website resource over https using wget permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.gnu.org/software/wget/manual/wget.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fetching website resource over https using wget&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To fetch a website resource over https, we can use wget command. If the website’s https certificate is not trusted by wget, then we can use the &lt;strong&gt;—no-check-certificate switch with wget&lt;/strong&gt;. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;wget&lt;/span&gt; https://example.com/path_to_resource --no-check-certificate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;monitoring-user-activity-with-acct-package&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#monitoring-user-activity-with-acct-package&quot; aria-label=&quot;monitoring user activity with acct package permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.tecmint.com/how-to-monitor-user-activity-with-psacct-or-acct-tools/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Monitoring user activity with acct package&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;acct&lt;/strong&gt; package provides tools for monitoring user activity. For Centos/Fedora this package is called &lt;strong&gt;psacct&lt;/strong&gt;. For Debian based systems it is called &lt;strong&gt;acct&lt;/strong&gt;
One of the tools provided by the acct package is called sa. It prints a summary of the command executed by users
Another tool called ac lists the total time for which users have been logged in&lt;/p&gt;
&lt;h4 id=&quot;split-large-files-using-split-command-in-linux&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#split-large-files-using-split-command-in-linux&quot; aria-label=&quot;split large files using split command in linux permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://askubuntu.com/questions/54579/how-to-split-larger-files-into-smaller-parts&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Split large files using split command in Linux&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To split a large file into smaller files, we can use the split command that is part of most Linux distributions. For example the following command splits a file into smaller files of size 5 Mb: &lt;strong&gt;split large_file_name -b 5M;&lt;/strong&gt;
To combine the file parts back to the original file, we need to use the command: &lt;em&gt;&lt;em&gt;cat x&lt;/em&gt; &gt; original_file_name&lt;/em&gt;*&lt;/p&gt;
&lt;h4 id=&quot;using-rsync-over-custom-ssh-port&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-rsync-over-custom-ssh-port&quot; aria-label=&quot;using rsync over custom ssh port permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://linux-tips.com/t/using-custom-port-for-rsync-over-ssh/467/2&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using Rsync over custom SSH port&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Rsync can be used with custom SSH ports. For example to copy data from a remote server that is running SSH server over port 3000, the following command can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;rsync&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-avze&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ssh -p 3000&quot;&lt;/span&gt;  &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;user&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;@&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;server&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_folder&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;local_folder&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;setting-file-permissions-with-rsync&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#setting-file-permissions-with-rsync&quot; aria-label=&quot;setting file permissions with rsync permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://unix.stackexchange.com/questions/148264/force-new-permissions-on-files-after-rsync-from-seedbox&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Setting file permissions with rsync&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If we need to upload files to a remote server using rsync, and the files need to have certain ownership, then the &lt;strong&gt;chown&lt;/strong&gt; option of rsync can be used. For example the following rsync command uploads the contents of the current folder to a remote server and sets the owner and group of the uploaded data to www-data:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;rsync&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-avz&lt;/span&gt; * &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_user&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;@&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_server&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;remote_server_path&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--chown&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;www-data:www-data&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;rsync-over-ssh-with-key-authentication&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rsync-over-ssh-with-key-authentication&quot; aria-label=&quot;rsync over ssh with key authentication permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://andykdocs.de/development/Linux/2013-01-17+Rsync+over+SSH+with+Key+Authentication&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rsync over SSH with key authentication&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The following rsync command can be used to copy files on a remote server using SSH key authentication:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;rsync&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--progress&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-avz&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ssh -i {key_file_location}&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
remote-user@remote-server:remote-folder local-folder&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;deleting-files-older-than-1-year-using-linux-command-line-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deleting-files-older-than-1-year-using-linux-command-line-tools&quot; aria-label=&quot;deleting files older than 1 year using linux command line tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://superuser.com/questions/192425/how-to-delete-files-in-linux-older-than-1-year&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Deleting files older than 1 year using Linux command line tools&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you want to recursively delete all files in a folder that were modified over 1 year ago, then the following command can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; folder_path &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;token parameter variable&quot;&gt;-mtime&lt;/span&gt; +365 &lt;span class=&quot;token parameter variable&quot;&gt;-ls&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; -- &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;deleting-empty-folders-recursively-using-linux-command-line-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deleting-empty-folders-recursively-using-linux-command-line-tools&quot; aria-label=&quot;deleting empty folders recursively using linux command line tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://unix.stackexchange.com/questions/46322/how-can-i-recursively-delete-empty-directories-in-my-home-directory&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Deleting empty folders recursively using Linux command line tools&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you want to recursively delete all folders within a given folder that are empty, then the following command may be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; d &lt;span class=&quot;token parameter variable&quot;&gt;-empty&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-delete&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following command can be used to recursively list all empty folders within a given folder:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; d &lt;span class=&quot;token parameter variable&quot;&gt;-empty&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;renaming-multiple-files-in-folder-with-bash&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#renaming-multiple-files-in-folder-with-bash&quot; aria-label=&quot;renaming multiple files in folder with bash permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://askubuntu.com/a/643410/547282&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Renaming multiple files in folder with BASH&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We often have a need to rename all files at once. For example we may need to add a certain text to all files within a folder. We can do this using a programming language. However the Bash programming language allows us to do this very easily using the &lt;strong&gt;rename&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;For example to add the text “_test” before the file extension to all mp3 files in a directory, we can use the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;rename&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;s/(.*)\.mp3/$1_test.mp3/&apos;&lt;/span&gt; *.mp3.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This was suggested in an answer to the question &lt;a href=&quot;https://unix.stackexchange.com/questions/370313/add-text-to-end-of-the-filename-but-before-extension/511382#511382&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Add text to end of the filename but before extension&lt;/a&gt; on StackOverflow.&lt;/p&gt;
&lt;h4 id=&quot;recursively-change-folder-ownership&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#recursively-change-folder-ownership&quot; aria-label=&quot;recursively change folder ownership permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/3740152/how-do-i-change-permissions-for-a-folder-and-all-of-its-subfolders-and-files-in&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Recursively change folder ownership&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you want to change the permissions of all folders under current directory to 755&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-type&lt;/span&gt; d &lt;span class=&quot;token parameter variable&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;755&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;appending-text-to-end-of-file-with-bash&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#appending-text-to-end-of-file-with-bash&quot; aria-label=&quot;appending text to end of file with bash permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.cyberciti.biz/faq/linux-append-text-to-end-of-file/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Appending text to end of file with Bash&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To append text to the end of a file in Linux:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Some new text&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&gt;&lt;/span&gt; /tmp/file_name.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[PHP and Python - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to PHP and Python]]></description><link>https://pakjiddat.netlify.app//posts/php-and-python---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/php-and-python---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to PHP:&lt;/p&gt;
&lt;h4 id=&quot;fixing-timeout-problems-with-php-scripts-on-plesk&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fixing-timeout-problems-with-php-scripts-on-plesk&quot; aria-label=&quot;fixing timeout problems with php scripts on plesk permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/13905004/how-to-fix-fastcgi-timeout-issues-in-plesk&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fixing timeout problems with PHP scripts on Plesk&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;In order to allow long running PHP scripts to run on a Plesk server, we need to increase the max_execution time value in the PHP configuration settings. If the Plesk is running PHP-FPM or PHP Fast CGI, then the following directives should be added to the file /etc/httpd/conf.d/fcgid.conf:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;FcgidIOTimeout 9000
FcgidBusyTimeout 3600&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above options can also be added to the Apache settings for the domain&lt;/p&gt;
&lt;h4 id=&quot;php-server-apis&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#php-server-apis&quot; aria-label=&quot;php server apis permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/4526242/what-is-the-difference-between-fastcgi-and-fpm&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PHP server APIs&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;PHP may be run as an Apache module. This configuration is known as mod_php. It may also be run as a FPM server or a Fast CGI server.
In the Fast CGI configuration, the PHP binary is accessed by the web server using the Fast CGI protocol.
In the PHP FPM configuration, the PHP is managed by a Fast CGI server called PHP FPM. The web server communicates with this PHP FPM server over a TCP socket.&lt;/p&gt;
&lt;h4 id=&quot;fetching-gzip-content-with-php-curl&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fetching-gzip-content-with-php-curl&quot; aria-label=&quot;fetching gzip content with php curl permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/310650/decode-gzipped-web-page-retrieved-via-curl-in-php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fetching Gzip content with PHP Curl&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To fetch urls such as RSS Feeds that have been compressed with gzip encoding the following curl option can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CURLOPT_ENCODING&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;gzip&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;using-usort-function-for-sorting-arrays&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-usort-function-for-sorting-arrays&quot; aria-label=&quot;using usort function for sorting arrays permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/function.usort.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using Usort function for sorting Arrays&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The PHP usort function allows sorting an array of values using a custom callback function. The usort function takes a comparator callback function as an argument. This function takes two arguments which are the two values to compare. The strcmp function can be used inside the comparator function for comparing string values.&lt;/p&gt;
&lt;h4 id=&quot;php-isset-function&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#php-isset-function&quot; aria-label=&quot;php isset function permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/function.isset.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PHP isset function&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The PHP function isset returns false for null values. It should not be used to check if array key exists, since some array keys may have empty value. Its better to use &lt;a href=&quot;https://www.php.net/manual/en/function.array-key-exists.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;array_key_exists&lt;/a&gt; function instead.&lt;/p&gt;
&lt;h4 id=&quot;generating-random-strings-with-array_rand-and-shuffle-functions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-random-strings-with-array_rand-and-shuffle-functions&quot; aria-label=&quot;generating random strings with array_rand and shuffle functions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/function.array-rand.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Generating random strings with array_rand and shuffle functions&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The PHP functions array_rand and shuffle functions can be used to generate random strings.&lt;/p&gt;
&lt;h4 id=&quot;what-is-the-difference-between-a-php-interpreter-and-a-php-handler&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-is-the-difference-between-a-php-interpreter-and-a-php-handler&quot; aria-label=&quot;what is the difference between a php interpreter and a php handler permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/40775071/what-is-the-difference-between-a-php-interpreter-and-a-php-handler/40801508#40801508&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;What is the difference between a PHP interpreter and a PHP handler?&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;A PHP Handler is an Apache module that is used by Apache to communicate with the PHP Interpreter. It is basically used by Apache to handle requests for PHP files. There are different types of PHP Handlers.&lt;/p&gt;
&lt;p&gt;For example mod_php is an Apache module for PHP. mod_fcgid allows communication with the php_fpm interpreter over a TCP or Unix socket. The PHP Interpreter is an application that executes PHP code one line at a time. The output of the PHP Interpreter is sent to the PHP Handler. This output may be processed by other Apache modules such as mod_deflate or mod_security. The final output is sent out of the TCP socket that Apache listens on.&lt;/p&gt;
&lt;p&gt;SuPHP is an Apache module that allows executing PHP scripts with the permissions of the script owner. Normally PHP scripts are executed with the permissions of the PHP interpreter. SuPHP allows the PHP files to have custom owner and permissions. The PHP file is then executed by the same owner that owns the PHP file. Its useful in shared hosting environments where PHP files belonging to different users need to be executed by the same PHP interpreter.&lt;/p&gt;
&lt;h4 id=&quot;passing-command-line-arguments-to-python-script&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#passing-command-line-arguments-to-python-script&quot; aria-label=&quot;passing command line arguments to python script permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.tutorialspoint.com/python/python_command_line_arguments.htm&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Passing command line arguments to Python script&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Command line arguments can be passed to a Python script. For example the parameters passed in the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;python script_name argument1 argument2 argument3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;can be read with the sys module. The sys module provides the command line arguments. To use the sys module, we have to use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;python&quot;&gt;&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; sys&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command line arguments can be used as: &lt;strong&gt;sys.argv[0], sys.argv[1], sys.argv[2]&lt;/strong&gt;. The number of command line arguments can be read with: &lt;strong&gt;len(sys.argv)&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;php-7-error-handling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#php-7-error-handling&quot; aria-label=&quot;php 7 error handling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/language.errors.php7.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PHP 7 error handling&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;PHP 7 uses a different approach for handling errors. It uses a different Error hierarchy then PHP 5. The base error class in PHP 7 is Throwable. So if we want to catch all exceptions that can be raised by a given code, then we should enclose the code in try/catch block. The catch block should use the Throwable class. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// some php code&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Throwable&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;executing-php-code-using-eval&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#executing-php-code-using-eval&quot; aria-label=&quot;executing php code using eval permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/function.eval.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Executing PHP code using eval&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The PHP eval function allows executing arbitrary PHP code. It takes as argument a string containing PHP code it returns null or the value returned by the PHP code.&lt;/p&gt;
&lt;h4 id=&quot;generate-url-query-strings-using-http_build_query&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generate-url-query-strings-using-http_build_query&quot; aria-label=&quot;generate url query strings using http_build_query permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://php.net/manual/en/function.http-build-query.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Generate URL query strings using http_build_query&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The http_build_query function allows generating valid URL query strings from simple or complex arrays including nested arrays.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Version Control - Quick Tips]]></title><description><![CDATA[Following are some quick tips related to Version Control:]]></description><link>https://pakjiddat.netlify.app//posts/version-control---quick-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/version-control---quick-tips</guid><pubDate>Wed, 03 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Following are some quick tips related to Version Control:&lt;/p&gt;
&lt;h4 id=&quot;changing-a-remote-git-repository-url&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#changing-a-remote-git-repository-url&quot; aria-label=&quot;changing a remote git repository url permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://help.github.com/en/articles/changing-a-remotes-url&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Changing a remote GIT repository URL&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The following command can be used to set the URL of a remote git repository: &lt;strong&gt;git remote set-url origin {remote-repo-url}&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;error-in-pushing-changes-to-remote-git-repository&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#error-in-pushing-changes-to-remote-git-repository&quot; aria-label=&quot;error in pushing changes to remote git repository permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://confluence.atlassian.com/stashkb/error-rpc-failed-result-22-push-to-stash-fails-604537633.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Error in pushing changes to remote git repository&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If we have a git repository with large files, and we need to push changes to a remote repository, then we might get the following error:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;Counting objects: &lt;span class=&quot;token number&quot;&gt;9554&lt;/span&gt;, done.
Delta compression using up to &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt; threads.
Compressing objects: &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;% &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5064&lt;/span&gt;/5064&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;, done.
Writing objects: &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;% &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;9554&lt;/span&gt;/9554&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;token number&quot;&gt;2.79&lt;/span&gt; GiB &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;694.00&lt;/span&gt; KiB/s, done.
Total &lt;span class=&quot;token number&quot;&gt;9554&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;delta &lt;span class=&quot;token number&quot;&gt;4382&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;, reused &lt;span class=&quot;token number&quot;&gt;9554&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;delta &lt;span class=&quot;token number&quot;&gt;4382&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
error: RPC failed&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;22&lt;/span&gt;, HTTP code &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;502&lt;/span&gt;
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To correct this error we need to increase the size of the git configuration variable http.postBuffer. We can do this with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; config &lt;span class=&quot;token parameter variable&quot;&gt;--global&lt;/span&gt; http.postBuffer &lt;span class=&quot;token number&quot;&gt;157286400&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;updating-last-commit-without-changing-annotated-tags&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#updating-last-commit-without-changing-annotated-tags&quot; aria-label=&quot;updating last commit without changing annotated tags permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://git-scm.com/book/en/v2/Git-Basics-Tagging&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Updating last commit without changing annotated tags&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you need to make modifications to the last commit of a Git Repository, without making changes to the annotated tags, then the following script may be used. The script also updates the remote repository.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# add changes to staging area&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# changes in the staging area are added to the last commit. last commit message can also be changed&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; commit &lt;span class=&quot;token parameter variable&quot;&gt;--amend&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the annotated tag called &quot;v1.0.0&quot; is deleted. this should be the most recent annotated tag&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; tag &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; v1.0.0
&lt;span class=&quot;token comment&quot;&gt;# the most recent annotated tag is deleted from the remote server&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push origin &lt;span class=&quot;token parameter variable&quot;&gt;--delete&lt;/span&gt; v1.0.0
&lt;span class=&quot;token comment&quot;&gt;# a new annotated tag is added, pointing to the last commit&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; tag &lt;span class=&quot;token parameter variable&quot;&gt;-a&lt;/span&gt; v1.0.0 &lt;span class=&quot;token parameter variable&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;initial commit&quot;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the last commit is pushed to the remote repository&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push origin master &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# all annotated tags are pushed to the remote repository&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push &lt;span class=&quot;token parameter variable&quot;&gt;--tags&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;storing-password-in-svn&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#storing-password-in-svn&quot; aria-label=&quot;storing password in svn permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2899209/how-to-save-password-when-using-subversion-from-the-console&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Storing password in SVN&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To store password for SVN commit commands, set store-passwords and store-plaintext-passwords to yes in &lt;strong&gt;/home/home_folder_name/.subversion/servers&lt;/strong&gt;. To set the user name in the commit command, append &lt;strong&gt;—username {your-user-name}&lt;/strong&gt; to the SVN commit command.&lt;/p&gt;
&lt;h4 id=&quot;update-commit-message-history&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#update-commit-message-history&quot; aria-label=&quot;update commit message history permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://help.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Update commit message history&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To rename previous commit messages, enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; rebase &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; HEAD~n&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above command &lt;strong&gt;n&lt;/strong&gt; is the number of commits back in history since the last commit. The command will cause the command line editor to open with the last &lt;strong&gt;n&lt;/strong&gt; commit messages. Each commit message is prefix with the text: &lt;strong&gt;pick&lt;/strong&gt;. Replace this with &lt;strong&gt;reword&lt;/strong&gt; for the commit message that needs to be updated.&lt;/p&gt;
&lt;p&gt;Next save the changes and exit the editor. This will cause a new editor window to open allowing editing of a commit message. After changing the commit message, save the changes and exit the editor. The editor will open up again allowing editing of the next commit message. Do this for each commit message that needs to be updated.&lt;/p&gt;
&lt;h4 id=&quot;editing-particular-commit&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#editing-particular-commit&quot; aria-label=&quot;editing particular commit permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Editing particular commit&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To edit files belonging to a particular commit, enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git rebase --interactive &apos;SHA-1^&apos;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;SHA-1 is the hash for the particular commit. It can be found using the command: &lt;strong&gt;git log —oneline&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This will open a command line editor which will list all commits made after the particular commit. Change the text “pick” to “edit” besides the particular commit. Save the changes and exit the editor.&lt;/p&gt;
&lt;p&gt;This will switch the HEAD to the given commit and will copy the commit files to the current working tree. The current working tree will be just like it was when the commit was made. Next make the necessary changes to the files and commit the changes using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt; git commit --all --amend --no-edit&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git rebase --continue&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will make the changes to the particular commit and will switch the HEAD back to the master branch. After that the changes can be pushed to the configured remote git repository using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git push -u origin master --force&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;removing-large-files-from-all-commits&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#removing-large-files-from-all-commits&quot; aria-label=&quot;removing large files from all commits permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Removing large files from all commits&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To remove large files from all commits in a git repository, the git-filter-repo tool can be used. To install the tool follow this &lt;a href=&quot;https://newbedev.com/how-do-you-install-git-filter-repo&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;install guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Next run the following command to remove the directory dir1/dir2 from all commits:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git-filter-repo --path &quot;dir1/dir2&quot; --invert-paths&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;path&lt;/strong&gt; option specifies the files or folders to include. The &lt;strong&gt;invert-paths&lt;/strong&gt; option inverts the paths so the end result is that all files and folder except those given by the &lt;strong&gt;path&lt;/strong&gt; option are included. In this way files and folders can be removed.&lt;/p&gt;
&lt;p&gt;The git-filter-repo supports many other options including removing objects larger than given size and editing commit messages.&lt;/p&gt;
&lt;h4 id=&quot;tagging-specific-commit&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#tagging-specific-commit&quot; aria-label=&quot;tagging specific commit permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://git-scm.com/book/en/v2/Git-Basics-Tagging&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Tagging specific commit&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To tag a specific commit, the following command can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git tag -a tag-version commit-checksum -m &quot;commit messsage&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above command adds an annotated tag named “tag-version”. The commit-checksum is the checksum of the commit. It can be found using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git log --oneline&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git-filter-repo --path &quot;dir1/dir2&quot; --invert-paths&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;path&lt;/strong&gt; option specifies the files or folders to include. The &lt;strong&gt;invert-paths&lt;/strong&gt; option inverts the paths so the end result is that all files and folder except those given by the &lt;strong&gt;path&lt;/strong&gt; option are included. In this way files and folders can be removed.&lt;/p&gt;
&lt;p&gt;The git-filter-repo supports many other options including removing objects larger than given size and editing commit messages.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Developers Site]]></title><description><![CDATA[The Developers Site project is a simple website that displays articles. It is suitable for developers who need a platform for publishing their work.]]></description><link>https://pakjiddat.netlify.app//posts/developers-site</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/developers-site</guid><pubDate>Mon, 18 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/c079a165e6b60b8d38bff043b331a962/8c557/pakjiddat-website.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 44.166666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsTAAALEwEAmpwYAAABgklEQVR42j3MbW+bMBQFYH57srZq0nQrZdW2vzNN/TZpk6ouJCXhHb9hHBsDCeHuBtRKj64snXPszJbuzeenlfdj4X5but+v7h5ntw/zhTtfPn66Q9586d5+ecLO1cq7Xnk391+v7z2MZosHJ6cCZZTjLViJyCjNaZTk+zhLC0Z4OUUoG/sTh4pqQrgMsR2lbwkPMvnnNXj+/fLz1/Pfl3UQ50GU7aI0TIqPPnIKVo0UykiJdjHbhkUQkX3CwoQEifBjuctkWmAqp+a0coQshMzLKhMyxYvkROE7l6qoVKHUWBhTrI1yHDrWbrQODipuG2ItaSzpmovGUmvTqgo43aoq6lraooY2yDJr99b6jq19XVN2gO4Ipx7aIzANVA+2g/5kjNVEDUSduQGh+9KclbZ13eJHxoxjVbMNg0IPxMChhVACrwd9hOFsVK3/UcB0w2GdmZQbIXh/6rvufawtWzMIxNAP0BxhV14+Mh2c+8vY5/AmLuMt6ZKcyFIAQNsSY/z/Il7dgoppLWIAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/c079a165e6b60b8d38bff043b331a962/8ac56/pakjiddat-website.webp 240w,
/static/c079a165e6b60b8d38bff043b331a962/d3be9/pakjiddat-website.webp 480w,
/static/c079a165e6b60b8d38bff043b331a962/426ac/pakjiddat-website.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/c079a165e6b60b8d38bff043b331a962/8ff5a/pakjiddat-website.png 240w,
/static/c079a165e6b60b8d38bff043b331a962/e85cb/pakjiddat-website.png 480w,
/static/c079a165e6b60b8d38bff043b331a962/8c557/pakjiddat-website.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/c079a165e6b60b8d38bff043b331a962/8c557/pakjiddat-website.png&quot;
            alt=&quot;Pak Jiddat Website&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Developers Site&lt;/strong&gt; project is a simple website that displays articles. It is suitable for developers who need a platform for publishing their work.&lt;/p&gt;
&lt;h3 id=&quot;development-of-the-website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#development-of-the-website&quot; aria-label=&quot;development of the website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Development of the website&lt;/h3&gt;
&lt;p&gt;The website was developed by following the &lt;a href=&quot;http://theleanstartup.com/principles&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Lean Startup principles&lt;/a&gt;. The book &lt;a href=&quot;https://www.packtpub.com/business/understanding-software&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Understanding Software&lt;/a&gt; was an invaluable guide in the development of the website.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The website allows publishing articles&lt;/li&gt;
&lt;li&gt;Table of contents are auto generated for articles with headings&lt;/li&gt;
&lt;li&gt;Comments can be posted to articles&lt;/li&gt;
&lt;li&gt;Contact form can be used to send a message to the website owner&lt;/li&gt;
&lt;li&gt;The website has a search box for searching articles&lt;/li&gt;
&lt;li&gt;List of recent articles and categories is auto generated&lt;/li&gt;
&lt;li&gt;The source code is modular and easy to extend with new features&lt;/li&gt;
&lt;li&gt;The website front-end is based on &lt;a href=&quot;https://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Twitter Bootstrap&lt;/a&gt; and &lt;a href=&quot;https://jquery.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JQuery&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The website front-end is valid HTML5 and has been tested with the &lt;a href=&quot;https://validator.nu/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;validator.nu&lt;/a&gt; tool&lt;/li&gt;
&lt;li&gt;The article structure is based on &lt;a href=&quot;https://www.w3schools.com/html/html5_semantic_elements.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Semantic Elements&lt;/a&gt; and is SEO friendly&lt;/li&gt;
&lt;li&gt;The website is mobile friendly&lt;/li&gt;
&lt;li&gt;The website has good browser response time&lt;/li&gt;
&lt;li&gt;Google Analytics tracking code can be easily added for keeping track of website visitors&lt;/li&gt;
&lt;li&gt;The website provides scripts for generating Site Maps and for testing the website pages for broken links and HTML 5 validation errors&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The website does not have a back-end. Article content has to be added directly to database using a database management tool such as &lt;a href=&quot;https://www.phpmyadmin.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PhpMyAdmin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#requirements&quot; aria-label=&quot;requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The “Developers Site” is based on PHP and MySQL. It uses the &lt;a href=&quot;https://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Twitter Bootstrap&lt;/a&gt; and &lt;a href=&quot;https://jquery.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JQuery&lt;/a&gt; Frontend libraries. The website uses the &lt;a href=&quot;https://pear.php.net/package/Mail/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mail&lt;/a&gt; and &lt;a href=&quot;https://pear.php.net/package/Mail_Mime/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mail Mime&lt;/a&gt; pear packages for sending email. These packages should be installed on your server.&lt;/p&gt;
&lt;p&gt;Installing the website on your own server requires PHP 7.2 and above. The website source code is based on the &lt;a href=&quot;/posts/pak-php-framework&quot;&gt;Pak Php Framework&lt;/a&gt;. The source code is fully commented and compliant with the &lt;a href=&quot;https://www.php-fig.org/psr/psr-2/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PSR-2 coding guidelines&lt;/a&gt;. The source code for the website is modular and easy to extend with new features.&lt;/p&gt;
&lt;h3 id=&quot;site-map-generation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#site-map-generation&quot; aria-label=&quot;site map generation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Site Map Generation&lt;/h3&gt;
&lt;p&gt;A Site Map for the website pages can be auto generated by running the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php  &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;application&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;pakjiddat&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Generate Site Map&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This creates a file sitemap.txt in the data folder. The script also saves all URLs to the &lt;strong&gt;pakphp_test_data&lt;/strong&gt;, which allows each URL to be checked for broken links and HTML 5 compatibility.&lt;/p&gt;
&lt;h3 id=&quot;markdown-file-generation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#markdown-file-generation&quot; aria-label=&quot;markdown file generation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Markdown file Generation&lt;/h3&gt;
&lt;p&gt;The website content stored in database can be exported as markdown files by running the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;applicaiton&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;pakjiddat&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Generate Markdown&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This creates markdown files in the data/markdown folder.&lt;/p&gt;
&lt;h3 id=&quot;testing&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#testing&quot; aria-label=&quot;testing permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Testing&lt;/h3&gt;
&lt;p&gt;All pages on the “Developers Site” website can checked for broken links and validated using the &lt;a href=&quot;https://validator.nu/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;validator.nu&lt;/a&gt; tool. To test the website pages, first enter the list of URLs to test in the database table: &lt;strong&gt;pakphp_test_data&lt;/strong&gt;. The table may be auto populated by setting the variable: &lt;strong&gt;save_ui_test_data&lt;/strong&gt; to &lt;strong&gt;true&lt;/strong&gt; in &lt;strong&gt;pakjiddat/config/Test.php&lt;/strong&gt; file. Alternately the Site Map script may be run, which saves all Site Map urls to the database table. Next run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php  &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;application&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;pakjiddat&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Unit Test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start the testing of each page listed in the database table.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The following steps can be used to install the “Developers Site” project on your own server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://github.com/pakjiddat/developers-site/archive/master.zip&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code&lt;/a&gt; from GitHub&lt;/li&gt;
&lt;li&gt;Move the source code to the document root of a virtual host&lt;/li&gt;
&lt;li&gt;Create a database and import the contents of the file: &lt;strong&gt;pakjiddat/data/developers-site.sql&lt;/strong&gt; to the database. Note down the credentials used for connecting to the database&lt;/li&gt;
&lt;li&gt;Enter the database credentials in the file &lt;strong&gt;pakjiddat/config/RequiredObjects.php&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the file: &lt;strong&gt;pakjiddat/Config.php&lt;/strong&gt;, on &lt;strong&gt;line 41&lt;/strong&gt; enter the domain names that will be used to access the website&lt;/li&gt;
&lt;li&gt;Customize the following variables in the file: &lt;strong&gt;pakjiddat/config/General.php&lt;/strong&gt;. &lt;strong&gt;$config[‘app_name’], $config[‘dev_mode’] and $config[‘site_url’]&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize the variables in the file: &lt;strong&gt;pakjiddat/config/Custom.php&lt;/strong&gt;. The comments explain what each variable is used for&lt;/li&gt;
&lt;li&gt;Set the &lt;strong&gt;$config[‘pear_folder_path’]&lt;/strong&gt; variable in the file: &lt;strong&gt;pakjiddat/config/Path.php&lt;/strong&gt;. The variable should be set to the path of the &lt;a href=&quot;https://pear.php.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;pear&lt;/a&gt; installation.&lt;/li&gt;
&lt;li&gt;Visit the website in a browser&lt;/li&gt;
&lt;li&gt;Enter the website articles in the database table: &lt;strong&gt;home_content&lt;/strong&gt;. The article should start showing on the website&lt;/li&gt;
&lt;li&gt;The layout and text of the website can be edited in html files inside the folder: &lt;strong&gt;pakjiddat/ui/html&lt;/strong&gt;. For example to edit the website header, the file: &lt;strong&gt;pakjiddat/ui/html/base/header.html&lt;/strong&gt; needs to be edited&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Islam Companion Web API]]></title><description><![CDATA[The Islam Companion Web API project is a RESTFul API (Application Programming Interface) that allows users to add Holy Quran and Hadith data to their applications. It provides Holy Quran translation in 42 languages.]]></description><link>https://pakjiddat.netlify.app//posts/islam-companion-web-api</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/islam-companion-web-api</guid><pubDate>Mon, 18 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/ed1e88d660a0dc995571f96e768b4988/21482/islamcompanion-web-api.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 44.166666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABxklEQVR42o2Qu48SURSHp7PRZEE2KwOusTOxsrAwEdYoMbGxsbCw0Nhps8bCwspHsQwLYXc1Vlb+D8KyCDMiz0Qp0EaNrYVodB1gWAbm88wMK8ZHYvHld3If3zn3KkltlVRmHW3jEdraA1ayG2jrD7m/muVOMs3d39H8vKdlSGblfCbLWjpNNpViRUuhFGrXaOsx7Focs56gXz8tnKE3pV/brRMzaglMYSB7H6tneWJc4rF+kWrjOkqnvcyHzk2oHsEqzjF8Ns+oFGKnvCDMs6NHsI0FeB4U9v/EmaZlhGiWDlMtqryvxlEGr64y6tzAfnmOcfME41acSfM4A/0oVuUY5tYiI+MQVA6K5O9QiXryYSOG0mudp9++zPDNMs7bW0ze3Wb8+gp2awm7fYFBIYStq3LpwD9xKhERBrAaJ1GG9RiU9+CU53BK+4S9Xo0eEgJywZWF6W+pfN/8hbzKt5yKKfWXfFTWgvKnrrBxSuwh6bLoj+7hdlS9dIwwo7Iv7BVULwdFH7e2JLubUT7ng1i+cAmMgPyFKwn/wUSErmhbJjILPr2pyE1X+kkm7OZEWP8PoceLGX0Rfc1FPLH79G2h+3T25B8kJf7TUf98cwAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/ed1e88d660a0dc995571f96e768b4988/8ac56/islamcompanion-web-api.webp 240w,
/static/ed1e88d660a0dc995571f96e768b4988/d3be9/islamcompanion-web-api.webp 480w,
/static/ed1e88d660a0dc995571f96e768b4988/e46b2/islamcompanion-web-api.webp 960w,
/static/ed1e88d660a0dc995571f96e768b4988/e5c51/islamcompanion-web-api.webp 1350w&quot;
              sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/ed1e88d660a0dc995571f96e768b4988/8ff5a/islamcompanion-web-api.png 240w,
/static/ed1e88d660a0dc995571f96e768b4988/e85cb/islamcompanion-web-api.png 480w,
/static/ed1e88d660a0dc995571f96e768b4988/d9199/islamcompanion-web-api.png 960w,
/static/ed1e88d660a0dc995571f96e768b4988/21482/islamcompanion-web-api.png 1350w&quot;
            sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/ed1e88d660a0dc995571f96e768b4988/d9199/islamcompanion-web-api.png&quot;
            alt=&quot;Islam Companion Web API&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The ”&lt;strong&gt;Islam Companion Web API&lt;/strong&gt;” project is a RESTFul API (Application Programming Interface) that allows users to add Holy Quran and Hadith data to their applications.&lt;/p&gt;
&lt;p&gt;It provides Holy Quran translation in 42 languages. Following languages are supported: &lt;strong&gt;Amharic, Arabic, Bosnian, Bengali, Bulgarian, Amazigh, Czech, German, Divehi, Spanish, English, Persian, French, Hindi, Hausa, Indonesian, Italian, Japanese, Korean, Kurdish, Malayalam, Malay, Dutch, Norwegian, Portuguese, Polish, Russian, Romanian, Swedish, Somali, Sindhi, Albanian, Swahili, Turkish, Tajik, Tamil, Tatar, Thai, Uzbek, Urdu, Uyghur and Chinese&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Hadith translation is provided in &lt;strong&gt;Urdu, English and Arabic languages&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The goal of the Islam Companion Web API is to help users develop applications that promote knowledge about Islam.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The Islam Companion Web API has the following features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It provides translations of Holy Quran in 42 languages&lt;/li&gt;
&lt;li&gt;It provides translations of Hadith in Urdu, English and Arabic languages&lt;/li&gt;
&lt;li&gt;It provides 8 API functions for fetching Quranic data&lt;/li&gt;
&lt;li&gt;It provides 7 API functions for fetching Hadith data&lt;/li&gt;
&lt;li&gt;The source code is available under &lt;a href=&quot;https://github.com/pakjiddat/islamcompanion-web-api/blob/master/LICENSE&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GPL License&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The source code is well commented and easy to update&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#requirements&quot; aria-label=&quot;requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The Islam Companion Web API requires PHP &gt;= 7.2. It also requires MySQL server &gt;= 5.6.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The following steps can be used to install the “Islam Companion Web API” project on your own server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://github.com/pakjiddat/islamcompanion-web-api/archive/master.zip&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code&lt;/a&gt; from GitHub&lt;/li&gt;
&lt;li&gt;Move the source code to the document root of a virtual host&lt;/li&gt;
&lt;li&gt;Download the contents of the database from: &lt;a href=&quot;https://drive.google.com/open?id=1Lq0xjVPiTso1io-uhKxz7aT7McIlBwj6&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Extract the downloaded file&lt;/li&gt;
&lt;li&gt;Create a database and import the contents of the SQL file to the database. Note down the credentials used for connecting to the database&lt;/li&gt;
&lt;li&gt;Enter the database credentials in the file &lt;strong&gt;api/config/RequiredObjects.php&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the file: &lt;strong&gt;api/Config.php&lt;/strong&gt;, on &lt;strong&gt;line 37&lt;/strong&gt; enter the domain names that will be used to access the API&lt;/li&gt;
&lt;li&gt;Customize the following variables in the file: &lt;strong&gt;api/config/General.php&lt;/strong&gt;. &lt;strong&gt;$config[‘app_name’], $config[‘dev_mode’] and $config[‘site_url’]&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;download-data&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#download-data&quot; aria-label=&quot;download data permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Download data&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://drive.google.com/file/d/1gd8B0C-N7LcppMNikv1FNQoL_XJ2nuQv/view?usp=sharing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Click here&lt;/a&gt; to download the Hadith database in &lt;strong&gt;.sql&lt;/strong&gt; format for MySQL server.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://drive.google.com/file/d/1pHo5auUuKiNEi9jlmQJ0-n3oqDEdbDR0/view?usp=sharing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Click here&lt;/a&gt; to download the Hadith database in &lt;strong&gt;.db&lt;/strong&gt; format for SQLite server.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://drive.google.com/file/d/16BdoFFoi2Vic6eDDqtk72DRppgTWCFI7/view?usp=sharing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Click here&lt;/a&gt; to download the Quranic database in &lt;strong&gt;.db&lt;/strong&gt; format for SQLite server.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;frequently-asked-questions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#frequently-asked-questions&quot; aria-label=&quot;frequently asked questions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Frequently asked questions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is the Islam Companion Web API&lt;/strong&gt;. It is a RESTFul API for accessing Holy Quran and Hadith data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What can I do with the Islam Companion Web API&lt;/strong&gt;. You can develop web based applications that present Holy Quran and Hadith data to the user. The Islam Companion API can work as the back-end of your application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Which languages are supported by the Islam Companion Web API&lt;/strong&gt;. &lt;a href=&quot;#introduction&quot;&gt;Click Here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What functions are provided by the Islam Companion Api&lt;/strong&gt;. Please read the documentation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;From where does the API get its data&lt;/strong&gt;. The Islam Companion API uses Holy Quran translations from &lt;a href=&quot;http://tanzil.net/trans/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://tanzil.net/trans/&lt;/a&gt;. It uses Hadith data from &lt;a href=&quot;http://hadithcollection.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://hadithcollection.com/&lt;/a&gt; and &lt;a href=&quot;https://www.quranurdu.com/Ahadith/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.quranurdu.com/Ahadith/&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How do I use the API&lt;/strong&gt;. To use the API, you have to make HTTP POST request to your server. Please see following sample code in PHP language.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;sample-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#sample-code&quot; aria-label=&quot;sample code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Sample Code&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;language&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;English&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;narrator&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;Mohammed Marmaduke William Pickthall&apos;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Prepare new cURL resource&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;curl_init&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;https://your-host-name/api/get_random_verses&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CURLINFO_HEADER_OUT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CURLOPT_POST&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl_setopt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;CURLOPT_POSTFIELDS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Submit the POST request&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;curl_exec&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Close cURL session handle&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl_close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$ch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// json decode the response&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Print the result&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;print_r&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token delimiter important&quot;&gt;?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;p&gt;The Islam Companion Web API supports the following functions. All function response values are in JSON format.
To test the API, use the following url: &lt;a href=&quot;https://your-host-name/api/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://your-host-name/api/&lt;/a&gt; for making API requests. All API requests must be of type HTTP POST and should include the required API parameters.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/pakjiddat/islam-companion-web-api#api-calls-for-fetching-holy-quran-data&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API calls for fetching Holy Quran data&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/pakjiddat/islam-companion-web-api#api-calls-for-fetching-hadith-data&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API calls for fetching Hadith data&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Islam Companion Website]]></title><description><![CDATA[The Islam Companion website project is a website that allows users to read Holy Quran and Hadith text. It also allows users to subscribe to Holy Quran and Hadith by email.]]></description><link>https://pakjiddat.netlify.app//posts/islam-companion-website</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/islam-companion-website</guid><pubDate>Mon, 18 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/bb4af7aa33b79483a675f47d6f1c6d10/c367c/islamcompanion-website.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 44.583333333333336%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABg0lEQVR42nWQ607CQBCF++xqNCpqFDRGX8IYIxcDGGm7lgLl1nYLBVruN29PcNxZpBIjP77szOw5M7Or7BydY//0ErHELY7jNzi8uEZMnFTbPb7A3kkCe7G4ICFjqq05OLuSOoI0VFNGsyUipqtz/JMPJ3MEgzHC4QS9/kgyErXxpn766yOU2fID/zFdvMNtdWBWarDqNoySJeHtnrzb5lOmCwo+MX9bsY4nwkTGxU998f4lmcxXzdZa8m+i9MMqun4Z3HkFd1d43EA/qMJvlURuiLwIV9y7DpNaj5twRN4SuoHQhT1L6gkl8DXwZhZMvYsw2D18/gyrksaLloGqp6EX7lAqPsBz8nhlj3jRM9BZCmYxiWY9h8BX0W2rUHq+Dklbi+gKwg5Do5YT/6fBtQtwGzlw+xltXkDFTMI0UiiaeTAji1I5i46nIhAe2TDYAjWnF/S7TEJDSF+zMmhUn9AS23o2DcrLJcijbG72FxLQZEds17QZfE+XA6IlxIAI+VIN30xWbFqIBznyAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/bb4af7aa33b79483a675f47d6f1c6d10/8ac56/islamcompanion-website.webp 240w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/d3be9/islamcompanion-website.webp 480w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/e46b2/islamcompanion-website.webp 960w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/873f3/islamcompanion-website.webp 1349w&quot;
              sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/bb4af7aa33b79483a675f47d6f1c6d10/8ff5a/islamcompanion-website.png 240w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/e85cb/islamcompanion-website.png 480w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/d9199/islamcompanion-website.png 960w,
/static/bb4af7aa33b79483a675f47d6f1c6d10/c367c/islamcompanion-website.png 1349w&quot;
            sizes=&quot;(max-width: 960px) 100vw, 960px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/bb4af7aa33b79483a675f47d6f1c6d10/d9199/islamcompanion-website.png&quot;
            alt=&quot;Islam Companion Website&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Islam Companion website&lt;/strong&gt; project is a website that allows users to read Holy Quran and Hadith text. It also allows users to subscribe to Holy Quran and Hadith by email.&lt;/p&gt;
&lt;p&gt;The goal of the Islam Companion website is to provide a basic website that displays Holy Quran and Hadith data. The user may customize this website according to their requirements.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The Islam Companion website has the following features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It has a reader that displays Holy Quran verses&lt;/li&gt;
&lt;li&gt;It has a reader that displays Hadith text&lt;/li&gt;
&lt;li&gt;It allows users to get Quranic verses and Hadith by email&lt;/li&gt;
&lt;li&gt;It allows downloading Hadith database in &lt;strong&gt;.sql&lt;/strong&gt; format&lt;/li&gt;
&lt;li&gt;It allows users of the website to send a message to the website administrator&lt;/li&gt;
&lt;li&gt;The source code is available under &lt;a href=&quot;https://github.com/pakjiddat/islam-companion-website/blob/master/LICENSE&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GPL License&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The source code is well commented, modular and easy to update&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The Islam Companion website has the following limitations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Islam Companion website was designed using JavaScript modules which are not supported by older browsers&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#requirements&quot; aria-label=&quot;requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The Islam Companion website requires PHP &gt;= 7.2. It also requires MySQL server &gt;= 5.6. For sending emails, the website requires the &lt;a href=&quot;https://pear.php.net/package/Mail/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mail&lt;/a&gt; and &lt;a href=&quot;https://pear.php.net/package/Mail_Mime/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mail Mime&lt;/a&gt; pear packages.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The following steps can be used to install the “Islam Companion” project on your own server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://github.com/pakjiddat/islam-companion-website/archive/master.zip&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code&lt;/a&gt; from GitHub&lt;/li&gt;
&lt;li&gt;Move the source code to the document root of a virtual host&lt;/li&gt;
&lt;li&gt;Download the contents of the database from: &lt;a href=&quot;https://drive.google.com/open?id=1Lq0xjVPiTso1io-uhKxz7aT7McIlBwj6&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Extract the downloaded file&lt;/li&gt;
&lt;li&gt;Create a database and import the contents of the SQL file to the database. Note down the credentials used for connecting to the database&lt;/li&gt;
&lt;li&gt;Enter the database credentials in the file &lt;strong&gt;islamcompanion/config/RequiredObjects.php&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the file: &lt;strong&gt;islamcompanion/Config.php&lt;/strong&gt;, on &lt;strong&gt;line 32&lt;/strong&gt; enter the domain names that will be used to access the website&lt;/li&gt;
&lt;li&gt;Customize the following variables in the file: &lt;strong&gt;islamcompanion/config/General.php&lt;/strong&gt;. &lt;strong&gt;$config[‘app_name’], $config[‘dev_mode’] and $config[‘site_url’]&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize the variables in the file: &lt;strong&gt;islamcompanion/config/Custom.php&lt;/strong&gt;. The comments explain what each variable is used for&lt;/li&gt;
&lt;li&gt;Set the &lt;strong&gt;$config[‘pear_folder_path’]&lt;/strong&gt; variable in the file: &lt;strong&gt;islamcompanion/config/Path.php&lt;/strong&gt;. The variable should be set to the path of the &lt;a href=&quot;https://pear.php.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;pear&lt;/a&gt; installation.&lt;/li&gt;
&lt;li&gt;Visit the website in a browser&lt;/li&gt;
&lt;li&gt;The layout and text of the website can be edited in HTML files inside the folder: &lt;strong&gt;islamcompanion/ui/html&lt;/strong&gt;. For example to edit the website header, the file: &lt;strong&gt;islamcompanion/ui/html/base/header.html&lt;/strong&gt; needs to be edited&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Responsive website design with Element Queries]]></title><description><![CDATA[Element Queries allow changing the size of a HTML element based on the style of other elements. Element queries are similar to media queries, but are based on element size instead of browser or view-port size.]]></description><link>https://pakjiddat.netlify.app//posts/responsive-website-design-with-element-queries</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/responsive-website-design-with-element-queries</guid><pubDate>Mon, 18 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Element Queries allow changing the size of a HTML element based on the style of other elements. Element queries are similar to media queries, but are based on element size instead of browser or view-port size.&lt;/p&gt;
&lt;p&gt;Element Queries are not supported by browsers natively like media queries. Two libraries that implement element queries are: &lt;a href=&quot;https://elementqueries.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;EQCSS&lt;/a&gt; and &lt;a href=&quot;https://github.com/marcj/css-element-queries&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CSS Element-Queries&lt;/a&gt;. Both libraries are small sized JavaScript files, that parse contents of CSS files and run the element queries defined in the file.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/marcj/css-element-queries&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CSS Elements Query&lt;/a&gt; library has a feature called ResizeSensor. It allows JavaScript code to be run, when an element is resized. It can be used to change layout of pages that display dynamic content such as ads.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://tomhodgins.github.io/element-queries-spec/element-queries.html#introduction&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Specification for CSS Element Queries&lt;/a&gt; describes how CSS Element Queries work&lt;/p&gt;
&lt;p&gt;See the question &lt;a href=&quot;https://stackoverflow.com/questions/12251750/can-media-queries-resize-based-on-a-div-element-instead-of-the-screen&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Can media queries resize based on a div element instead of the screen?&lt;/a&gt; on Stack-overflow for more information about Element queries&lt;/p&gt;</content:encoded></item><item><title><![CDATA[YouTube Playlist]]></title><description><![CDATA[The YouTube Playlist is derived from the MediaElement player. It allows YouTube videos to be displayed in a playlist.]]></description><link>https://pakjiddat.netlify.app//posts/youtube-playlist</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/youtube-playlist</guid><pubDate>Mon, 18 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/1f55fabadcd6a9195596f8b57476f9a8/8c557/youtube-playlist.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 78.33333333333333%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAIAAACZeshMAAAACXBIWXMAAAsTAAALEwEAmpwYAAADQklEQVR42o1T6XLiRhAeGYvDeBfiC4NxuCRhwDIISRxCB+IQCMxhE5vFWNj4ArzGx6YckoqXzV6uTaUSb23tC+QB8gx5tYxJKtmf6ekfM939Tff3TQ1Ip3M8L6uFMi8pQq5c+aZVb2rPur3G/sle92xrr/us2z/oD7dah2y6qFS3xNxmudHObu6QMQmIQgrD8EBwnWZpkopyolSsbR0NBhfXN+O3r398+04tV9RSlRHytJBPZYvpfKlQaQg5ldigQSaby6rV3vDyZjT66Zff7j99vn318uX9m9H4+1cf3l2NRqWSKkliPCVIcjaTyUiwmyDS8WSAJEFLO97Vjjun/Rd347Orq2KtWtmunfW65/3OyWnn+fW51u3kCvkkn0px8WIhk5XiAh+naDpCUSCTUxIcvxYI+DCPx+uNJpjB1UmjWU9LfFYWdnZqw+vn55d9hqXC4XVtv3HQrshi4nEUPgGkdCZMxzxuV4BwszGmvltvdnaKqhxnGdznpSLrFBXuDY5EKUWSwcZ2sV5Os0xUlgUuyYB0JkcEQ3bbotuDMZFIraJusHHM6yODAfeq02lfti3NKaqiVtRQgFCyPB0O4QTOcSwdCYFgkHS5PHa7Y2F+ccZo3AiHMP/avNXidq74PS7M7XLYlnxep6IWBDHFczEC9+E4noyFPS4nWFhY1E3pUN20TqdDAHj6ZHbWbDagOpPRYERRs9Gkn5426PXzc3NWiwVmjQYDLHhqMup1KIAhAMAUgkAk9P9pM/NL6BMLsFktEGNAED2CGOAtjzaNTP2zEAQe4WS6SXwKwiZdgK/edogFMOgPmtpRu70/6J+yUaaSjh/vJsda4WHQorxfVZu9i+9+/eHidrjJwefI88l8LLydz8YwfGHGDF6P7x4+PWjt/uHBICPJZ1r9xej2j58//Hk3pPyuekNrHd98fP/+92/3RIlrbhZbJeX+dO+hf7Rqd4I4yyoFxY8HHbYV3+rXgqwUW5fb1eahnJhzYHSUgd9mjfRHqZDdsRoOBUUuGcJ8JEaYTLPAs7wMqaCQ9t9uNKEoOhHlkZvVajWbzZDmhCmAez2q/083mP5SbeQLg3HHygpBEPZl+79SPWo4cQDAXxsUuNvqJUvXAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/1f55fabadcd6a9195596f8b57476f9a8/8ac56/youtube-playlist.webp 240w,
/static/1f55fabadcd6a9195596f8b57476f9a8/d3be9/youtube-playlist.webp 480w,
/static/1f55fabadcd6a9195596f8b57476f9a8/426ac/youtube-playlist.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/1f55fabadcd6a9195596f8b57476f9a8/8ff5a/youtube-playlist.png 240w,
/static/1f55fabadcd6a9195596f8b57476f9a8/e85cb/youtube-playlist.png 480w,
/static/1f55fabadcd6a9195596f8b57476f9a8/8c557/youtube-playlist.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/1f55fabadcd6a9195596f8b57476f9a8/8c557/youtube-playlist.png&quot;
            alt=&quot;YouTube Playlist&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The YouTube Playlist is derived from the &lt;a href=&quot;http://mediaelementjs.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MediaElement player&lt;/a&gt;. It allows YouTube videos to be displayed in a playlist.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Allows playlist information to be loaded from XML file&lt;/li&gt;
&lt;li&gt;Allows video quality to be set&lt;/li&gt;
&lt;li&gt;Provides option for sharing video on social networks&lt;/li&gt;
&lt;li&gt;The start and end time for each YouTube video can be specified in XML file. It allows unnecessary parts of the YouTube video to be excluded&lt;/li&gt;
&lt;li&gt;Allows switching to next and previous tracks&lt;/li&gt;
&lt;li&gt;Provides a loop option for playing a track repeatedly&lt;/li&gt;
&lt;li&gt;Provides a shuffle option for playing a random track&lt;/li&gt;
&lt;li&gt;Can be used under the terms and conditions of the &lt;a href=&quot;https://github.com/mediaelement/mediaelement/blob/master/LICENSE&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Media Element Player license&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;development-of-the-player&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#development-of-the-player&quot; aria-label=&quot;development of the player permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Development of the player&lt;/h3&gt;
&lt;p&gt;The YouTube Playlist was developed by modifying the MediaElement &lt;a href=&quot;https://github.com/mediaelement/mediaelement-plugins/blob/master/docs/playlist.md&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Playlist plugin&lt;/a&gt; and the &lt;a href=&quot;https://github.com/mediaelement/mediaelement-plugins/blob/master/docs/quality.md&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Quality plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Minor changes to the MediaElement Player were also made. The article &lt;a href=&quot;https://xparkmedia.com/blog/mediaelements-add-a-share-button-to-video-elements-using-jquery/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mediaelements: Add a share button to video elements using jQuery&lt;/a&gt; was used to add Social Sharing buttons to the player. The player also uses the &lt;a href=&quot;http://manos.malihu.gr/jquery-thumbnail-scroller/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;jQuery thumbnail scroller&lt;/a&gt; library for the scroll-able playlist.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Download the source code by running the command: &lt;strong&gt;git clone &lt;a href=&quot;https://github.com/pakjiddat/youtube-playlist.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://github.com/pakjiddat/youtube-playlist.git&lt;/a&gt;&lt;/strong&gt;. Place the source code in a virtual host directory, so that the &lt;strong&gt;index.html&lt;/strong&gt; file is served by a web server. Navigate to the index.html file in a browser. You should see this &lt;a href=&quot;#youtube-screen&quot;&gt;screen&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Generating Table of Contents]]></title><description><![CDATA[Table of contents gives an overview of the article. It describes what the article contains. A quick glance at the table of contents gives a useful overview of the article. Most articles have a table of contents which contains links to the important parts of an article.]]></description><link>https://pakjiddat.netlify.app//posts/generating-table-of-contents</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/generating-table-of-contents</guid><pubDate>Sat, 16 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Table of contents gives an overview of the article. It describes what the article contains. A quick glance at the table of contents gives a useful overview of the article. Most articles have a table of contents which contains links to the important parts of an article.&lt;/p&gt;
&lt;h3 id=&quot;basic-usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#basic-usage&quot; aria-label=&quot;basic usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Basic Usage&lt;/h3&gt;
&lt;p&gt;To generate a table of contents using PHP, the following code can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$toc&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;TOC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$toc_data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$toc&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GenerateToc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$article_text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;how-the-code-works&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-the-code-works&quot; aria-label=&quot;how the code works permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How the code works&lt;/h3&gt;
&lt;p&gt;In the above code, the &lt;strong&gt;$article_text&lt;/strong&gt; is the article for which the table of contents needs to be generated. The &lt;strong&gt;$toc_data&lt;/strong&gt; variable is an associative array containing two entries.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;toc_list&lt;/strong&gt; entry is the table of contents formatted as an unordered HTML list. The &lt;strong&gt;updated_text&lt;/strong&gt; is the updated article text. The headings in this updated text are marked with ids, so when the user clicks on a link in the table of contents, it scrolls to the article heading&lt;/p&gt;
&lt;p&gt;The code for generating the table of contents does three things. First it extracts the headings from the article text using regular expressions. The headings are extracted recursively. Next the script generates an unordered HTML list from the extracted headings. After that the script updates the article text, adding ids to the HTML headings&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The script extracts all heading tags from h1-h6. It also adds ids to the article text. The table of contents is an unordered HTML list. Each item in the list is a link to a heading.&lt;/p&gt;
&lt;p&gt;In the article text a heading level may be skipped. For example h5 headings can follow a h3 heading&lt;/p&gt;
&lt;h3 id=&quot;limitations&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#limitations&quot; aria-label=&quot;limitations permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Limitations&lt;/h3&gt;
&lt;p&gt;The headings in the article text must be nested. So after h1, there must be a lower level heading such as &lt;strong&gt;h2, h3, h4, h5, or h6&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://gist.github.com/nadirlc/9d1368f86fa3d96bca70a7cd626c8890&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Download PHP class for generating Table of Contents&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Pak Php Framework]]></title><description><![CDATA[The Pak Php Framework is a framework for developing PHP applications. It can be used to develop command line applications as well as browser applications based on Model View Controller (MVC) design pattern.]]></description><link>https://pakjiddat.netlify.app//posts/pak-php-framework</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/pak-php-framework</guid><pubDate>Mon, 11 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/0bbdf53e45311e0a6f63599b55e00390/8c557/hello-world.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 43.75%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsTAAALEwEAmpwYAAABP0lEQVR42mMwPjPT9Mwss7OzAq+ssD431/D0DKAIEBmdmWl4ZobRGSgXK2IwOD1d69RU30vLLn95GXZ1tc6pqUCzgHoczy/wvrTEBmgcbv0MQJ3el5aufXVt//v7npeW6J+eDhQFOiToyoqIa2sCLi83wmOz+dnZG15ff/Pr27tf39ofHjY9O9v1wiLHCwucLix0vrDQ5cJCJzDb7vw8TFMYfC4t3fLm5uY3N3e/vdP96Ije6WmmqCpMwIFicmYWFpuBIWR5do7d+fn25+ebgsMJTYXB6Rk6p6YBvYPpeQYTsAagz9VPTjbGsBNoNNDcOc/Ornl5FWgHUL8JsmYgBpoadW1N0Z0d8HiCaZ6le2pa+JXVG1/dAIYoMEZ0T09Ddj8D0ElFt3dc//Lq3rd3mTe3QKIK2QigiUDTgQgzzgGG1TMFcL7g/AAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/0bbdf53e45311e0a6f63599b55e00390/8ac56/hello-world.webp 240w,
/static/0bbdf53e45311e0a6f63599b55e00390/d3be9/hello-world.webp 480w,
/static/0bbdf53e45311e0a6f63599b55e00390/426ac/hello-world.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/0bbdf53e45311e0a6f63599b55e00390/8ff5a/hello-world.png 240w,
/static/0bbdf53e45311e0a6f63599b55e00390/e85cb/hello-world.png 480w,
/static/0bbdf53e45311e0a6f63599b55e00390/8c557/hello-world.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/0bbdf53e45311e0a6f63599b55e00390/8c557/hello-world.png&quot;
            alt=&quot;Pak Php Framework Installation&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The Pak Php Framework is a framework for developing PHP applications. It can be used to develop command line applications as well as browser applications based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Model View Controller (MVC) design pattern&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;An application framework provides libraries and tools for developing applications. The Pak Php framework provides error handling, function validation, log handling, session handling, URL request handling based on MVC design pattern, URL routing, translation and testing. It also includes utility classes that provide commonly used features such as Template Engine, Database Abstraction, Error Handling, File and Folder management and more.&lt;/p&gt;
&lt;p&gt;The utility classes and features provided by the Pak Php Framework are implemented as separate components that are easy to extend. All components of the Pak Php Framework are based on the principles of &lt;a href=&quot;https://en.wikipedia.org/wiki/Separation_of_concerns&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Separation of concerns&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Don’t repeat yourself&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Third party frontend libraries such as &lt;a href=&quot;https://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Twitter Bootstrap&lt;/a&gt;, &lt;a href=&quot;https://jquery.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JQuery&lt;/a&gt;, &lt;a href=&quot;https://www.w3schools.com/w3css/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3.CSS&lt;/a&gt; etc can be integrated with the Pak Php Framework.&lt;/p&gt;
&lt;h3 id=&quot;requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#requirements&quot; aria-label=&quot;requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The Pak Php Framework requires Php 7.2 and above. The code for the Pak Php Framework is fully commented and compliant with the &lt;a href=&quot;https://www.php-fig.org/psr/psr-2/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PSR-2&lt;/a&gt; coding guidelines. Parameter and return types are given for all methods.&lt;/p&gt;
&lt;p&gt;The Pak Php Framework does not have any external dependencies apart from the XDebug PHP extension. It has its own Template Engine and Test Manager. It provides a simple framework for developing well tested applications.&lt;/p&gt;
&lt;h3 id=&quot;development-of-the-website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#development-of-the-website&quot; aria-label=&quot;development of the website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Development of the website&lt;/h3&gt;
&lt;p&gt;The website was developed by following the &lt;a href=&quot;http://theleanstartup.com/principles&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Lean Startup principles&lt;/a&gt;. The book &lt;a href=&quot;https://www.packtpub.com/business/understanding-software&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Understanding Software&lt;/a&gt; was an invaluable guide in the development of the framework.&lt;/p&gt;
&lt;p&gt;The goal of the Pak Php Framework is to provide a light weight set of tools for developing professional, well tested web applications. Applications developed using the Pak Php Framework should be based on Lean Startup principles.&lt;/p&gt;
&lt;h3 id=&quot;application-structure&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#application-structure&quot; aria-label=&quot;application structure permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Application Structure&lt;/h3&gt;
&lt;p&gt;A single instance of the Pak Php Framework can support several applications. Each application must be in its own folder. The following shows the structure of a sample Pak Php Framework application:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;├── config
│   ├── Custom.php
│   ├── General.php
│   ├── Path.php
│   ├── RequiredObjects.php
│   ├── Test.php
│   └── Callables.txt
├── Config.php
├── lib
├── test
│   └── results
│       ├── codecoverage
│       └── tracelogs
└── ui
    ├── css
    ├── html
    ├── images
    ├── js
    ├── pages&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The config folder holds the application configuration files. Each file should contain a single method called &lt;strong&gt;GetConfig&lt;/strong&gt;. This method should return an array containing configuration data, which overrides the default framework configuration. See the folder &lt;strong&gt;framework/config&lt;/strong&gt;, for the default configuration files.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Custom.php&lt;/strong&gt; file can contain custom configuration. The &lt;strong&gt;Callables.txt&lt;/strong&gt; file defines the URL routing information for the application.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;lib&lt;/strong&gt; folder should contain the user defined library files. The &lt;strong&gt;ui&lt;/strong&gt; folder contains the user interface related code. It should contains the sub folders shown in the above example. The &lt;strong&gt;css&lt;/strong&gt; sub folder contains application CSS files, the &lt;strong&gt;images&lt;/strong&gt; folder contains application image files, the &lt;strong&gt;js&lt;/strong&gt; folder contains application JavaScript files. The &lt;strong&gt;html&lt;/strong&gt; folder contains the HTML template files. The &lt;strong&gt;pages&lt;/strong&gt; folder should hold files that derive from the &lt;strong&gt;\Framework\Application\Page&lt;/strong&gt; base class.&lt;/p&gt;
&lt;h3 id=&quot;framework-structure&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#framework-structure&quot; aria-label=&quot;framework structure permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Framework Structure&lt;/h3&gt;
&lt;p&gt;The Pak Php Framework has the following structure:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;├── autoload.php
├── index.php
├── .htaccess
├── framework
│   ├── application
│   │   ├── Api.php
│   │   ├── Application.php
│   │   ├── CommandLine.php
│   │   ├── libraries
│   │   │   ├── ErrorHandling.php
│   │   │   ├── FunctionValidation.php
│   │   │   ├── LogHandling.php
│   │   │   ├── SessionHandling.php
│   │   │   ├── Translation.php
│   │   │   └── UrlRouting.php
│   │   ├── Page.php
│   │   └── Web.php
│   ├── config
│   │   ├── base
│   │   │   ├── GeneralConfig.php
│   │   │   ├── PathConfig.php
│   │   │   ├── RequiredObjectsConfig.php
│   │   │   └── TestConfig.php
│   │   ├── Config.php
│   │   ├── Initializer.php
│   │   └── Manager.php
│   ├── documentation
│   │   └── changelog.txt
│   ├── templateengine
│   │   ├── BasePage.php
│   │   ├── Generator.php
│   │   └── HeaderTags.php
│   ├── testmanager
│   │   ├── BlackBoxTesting.php
│   │   ├── CodeCoverageGenerator.php
│   │   ├── TestDataManager.php
│   │   ├── TestFunctionProcessor.php
│   │   ├── TestFunctionValidator.php
│   │   ├── TestResultsManager.php
│   │   ├── UiTesting.php
│   │   ├── UnitTestRunner.php
│   │   └── WhiteBoxTesting.php
│   ├── utilities
│   │   ├── Authentication.php
│   │   ├── autoload.php
│   │   ├── CacheManager.php
│   │   ├── commentmanager
│   │   ├── databasemanager
│   │   ├── documentation
│   │   │   └── changelog.txt
│   │   ├── Email.php
│   │   ├── Encryption.php
│   │   ├── errormanager
│   │   ├── examples
│   │   ├── Excel.php
│   │   ├── filesystem
│   │   ├── LogManager.php
│   │   ├── Profiler.php
│   │   ├── StringUtils.php
│   │   ├── TemplateUtils.php
│   │   └── UtilitiesFramework.php
│   └── vendors&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;main-entry-point&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#main-entry-point&quot; aria-label=&quot;main entry point permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Main entry point&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;index.php&lt;/strong&gt; file is the main entry point for the application. All URL requests are routed by the &lt;strong&gt;.htaccess&lt;/strong&gt; file to the &lt;strong&gt;index.php&lt;/strong&gt; file. The &lt;strong&gt;autoload.php&lt;/strong&gt; file is used to autoload classes. All classes should have a name-space. The folder structure of a class should match the class name-space.&lt;/p&gt;
&lt;h4 id=&quot;application-base-classes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#application-base-classes&quot; aria-label=&quot;application base classes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Application base classes&lt;/h4&gt;
&lt;p&gt;All Pak Php Framework applications are child classes of the &lt;strong&gt;Application&lt;/strong&gt; base class, which is &lt;strong&gt;application/Application.php&lt;/strong&gt;. Currently three types of applications are supported. API, Command Line and Web.&lt;/p&gt;
&lt;p&gt;API applications extend the &lt;strong&gt;Api&lt;/strong&gt; base class. Command Line applications extend the &lt;strong&gt;CommandLine&lt;/strong&gt; base class. Web applications can extend either the Web class or the Page class. The Page class is derived from the Web class.&lt;/p&gt;
&lt;p&gt;The main framework features which are URL Routing, Session Handling, Error Handling, Translation, Function Validation and Log Handling are implemented by classes in the &lt;strong&gt;application/libraries&lt;/strong&gt; folder. Each feature is implemented separately from other features.&lt;/p&gt;
&lt;h4 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h4&gt;
&lt;p&gt;Configuration is one of the main features of the Pak Php Framework. It allows class objects to be used without explicitly initializing the object. The user only has to mention the class once in &lt;strong&gt;config/RequiredObjects.php&lt;/strong&gt;. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;contactpage&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;class_name&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;\PakJiddat\Ui\Pages\Contact&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The class can then be used using the syntax: &lt;strong&gt;Config::GetComponent(“contactpage”);&lt;/strong&gt;. The framework takes care of initializing the class object. If the object has already been created, then it is simply returned. All classes are autoloaded using &lt;a href=&quot;https://www.php-fig.org/psr/psr-4/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PSR-4 autoloading standard&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Application data is stored in configuration files inside the folder: &lt;strong&gt;config/&lt;/strong&gt;. See the &lt;a href=&quot;#application-structure&quot;&gt;user application structure&lt;/a&gt; for details. Configuration variables can be accessed using the syntax:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token class-name static-context&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;general&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;dev_mode&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code returns the current development mode of the application. If it is false, then application is in production mode.&lt;/p&gt;
&lt;h4 id=&quot;url-routing&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#url-routing&quot; aria-label=&quot;url routing permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Url Routing&lt;/h4&gt;
&lt;p&gt;The Pak Php Framework provides URL Routing. The user application should contain the file &lt;strong&gt;config/Callables.txt&lt;/strong&gt;. This file specifies the callbacks for commands as well as callbacks for handling URL requests. An entry in the file has two parts. The first part starts with &lt;strong&gt;url:&lt;/strong&gt; or &lt;strong&gt;command:&lt;/strong&gt;. The second part starts with &lt;strong&gt;callback:&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The application should define an entry for each URL or pattern of URLs. The first line in the entry is a regular expression that defines which URLs to handle. The next line defines the callback function that should handle the URL request. The line after that defines an optional validator callback. This is the callback to be used for validating application parameters.&lt;/p&gt;
&lt;h4 id=&quot;command-line-scripts&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#command-line-scripts&quot; aria-label=&quot;command line scripts permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Command Line scripts&lt;/h4&gt;
&lt;p&gt;If the application has functions that are called from the command line, then each function should have an entry in &lt;strong&gt;Callables.txt&lt;/strong&gt;, that starts with &lt;strong&gt;command:&lt;/strong&gt;. The entry should specify the name of the command that needs to be entered by the user from the command line. The next line defines the callback function for handling the command. For example if an application defines the command “Generate Site Map”, then it can be run with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;application&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;app&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;command&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Generate Site Map&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;Callables.txt&lt;/strong&gt; file should contain the entry:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;command: Generate Site Map
callback: {&quot;object&quot;: &quot;websitetools&quot;, &quot;function&quot;: &quot;GenerateSiteMap&quot;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This entry means that the function &lt;strong&gt;GenerateSiteMap&lt;/strong&gt; of the object “websitetools” will be called, when the command “Generate Site Map” is entered. The config file: &lt;strong&gt;config\General.php&lt;/strong&gt;, should contain the following line:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The custom commands */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;commands&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Generate Site Map (generates site map of website)&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above command defines the commands implemented by the application. These commands are shown to the user when he enters the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;application&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;app&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;command&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Help&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command lists all commands supported by the application.&lt;/p&gt;
&lt;p&gt;The following code shows sample contents of the &lt;strong&gt;Callables.txt&lt;/strong&gt; file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;url: ^/$
callback: {&quot;object&quot;: &quot;homepage&quot;, &quot;function&quot;: &quot;Generate&quot;}

url: ^/articles(/view/\d+/[A-Za-z\-0-9\._%]+)?$
callback: {&quot;object&quot;: &quot;viewarticlepage&quot;, &quot;function&quot;: &quot;Generate&quot;}

url: ^/articles/(tag|search)/[a-z\-0-9A-Z\._%]+?$
callback: {&quot;object&quot;: &quot;listarticlepage&quot;, &quot;function&quot;: &quot;Generate&quot;}

url: ^/contact/form$
callback: {&quot;object&quot;: &quot;contactpage&quot;, &quot;function&quot;: &quot;Generate&quot;}

url: ^/contact/add$
callback: {&quot;object&quot;: &quot;contactpage&quot;, &quot;function&quot;: &quot;SendContactMessage&quot;}

command: Generate Site Map
callback: {&quot;object&quot;: &quot;websitetools&quot;, &quot;function&quot;: &quot;GenerateSiteMap&quot;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;template-engine&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#template-engine&quot; aria-label=&quot;template engine permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Template Engine&lt;/h4&gt;
&lt;p&gt;The Pak Php Framework includes a template engine which allows user applications to merge application data with HTML templates&lt;/p&gt;
&lt;h4 id=&quot;test-manager&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#test-manager&quot; aria-label=&quot;test manager permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test Manager&lt;/h4&gt;
&lt;p&gt;The Pak Php Framework provides classes for testing code. Three types of tests are supported. &lt;a href=&quot;https://en.wikipedia.org/wiki/White-box_testing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;White Box tests&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Black-box_testing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Black Box tests&lt;/a&gt; and Ui (user interface) tests.&lt;/p&gt;
&lt;p&gt;White Box tests are written like &lt;a href=&quot;https://en.wikipedia.org/wiki/PHPUnit&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PhpUnit&lt;/a&gt; tests. The user defines test methods in a file. Each method name should start with “Test”. The test is then run from the command line. Assert statements may be used within the test methods to validate conditions.&lt;/p&gt;
&lt;p&gt;Black Box tests are written by defining test data inside test files. Each method has its own test data file. The first line in the test data file gives the list of parameters separated by ’|‘. The last three entries in the first line gives the expected return value, the type of the return value and the rule used to validate the return value. The test data file can be auto generated for each method defined by the application. The command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;php index&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt;php &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;application&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;[app-name]&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;--&lt;/span&gt;action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Generate Test Data&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will generate test data files for each user defined method. The test data files will be placed in the folder: &lt;strong&gt;test/testdata/{class-name}&lt;/strong&gt;. The name of the file is same as the name of the method. Following is a sample structure of a test data file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;param_int_name1|param_int_name2|param_int_name3|return_name1|return_type|rule
1|1|7|{&quot;count&quot;:7}|array|count&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A UI (user interface) test allows the HTML of the response to be checked for errors. The &lt;a href=&quot;https://validator.nu/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;validator.nu&lt;/a&gt; service is used to check if the HTML conforms with the HTML5 standard. Broken links are also checked as part of the Ui test. The test data for the Ui test is defined in a database table. See the structure of the table: &lt;strong&gt;pakphp_test_data&lt;/strong&gt;. It has two main fields which are the URL and URL parameters. This data may be auto generated by setting the &lt;strong&gt;save_ui_test_data&lt;/strong&gt; variable to &lt;strong&gt;true&lt;/strong&gt; in &lt;strong&gt;config/Test.php&lt;/strong&gt;. When this option is set to true, the framework saves the current URL and parameters to database&lt;/p&gt;
&lt;p&gt;After a black box or white box test has been run, code coverage information for the test is displayed on the console and also saved to database. A summary of the test results is saved to database and file. A trace log of all function calls is also saved. The code coverage and function trace are generated using XDebug. The following screenshot shows the test results that are printed to the console after running black box tests:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/2bea64f8b487d1d20acb58e98c955a56/8c557/black-box-test-results.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 44.166666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsTAAALEwEAmpwYAAABJElEQVR42nVR2W7DIBD0x/WhiQssFsYHkPrgxm7//61rN5EqJR0QILTD7DAVA7iQN5C1npT5XNtBcSG56EQrpWxbIeS5933fHpBdJ5umgRMV8HMAdJ1QeqBQA7APesG1Ju8M2G8dpZSx+5k/UDGgWqtlmayzq7XmZqy1zjucIbhpnlfrhr7nvPlLu5PxST0qLN6/vkvZvHfe+1LKvu85l5iiDeFmjBCCP6ECxozWwbutbAG13JpzKtu+lZxycjGuqx2GEX2+IFNCxqG365JyRtlpmpxzqBxjSCn5ED7nZZmXf8iUqHFEu0eT0TvrDuWSsZGcM/q23htj8LefLPPqeq0JIUqj8fHI5EjniAcjOdCdV+flC2UGnFGqMKhWwCOYl3gm/wAfEroacPfFkwAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/2bea64f8b487d1d20acb58e98c955a56/8ac56/black-box-test-results.webp 240w,
/static/2bea64f8b487d1d20acb58e98c955a56/d3be9/black-box-test-results.webp 480w,
/static/2bea64f8b487d1d20acb58e98c955a56/426ac/black-box-test-results.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/2bea64f8b487d1d20acb58e98c955a56/8ff5a/black-box-test-results.png 240w,
/static/2bea64f8b487d1d20acb58e98c955a56/e85cb/black-box-test-results.png 480w,
/static/2bea64f8b487d1d20acb58e98c955a56/8c557/black-box-test-results.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/2bea64f8b487d1d20acb58e98c955a56/8c557/black-box-test-results.png&quot;
            alt=&quot;Black Box Testing Results&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The following screenshot shows the code coverage summary after running black box tests:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/fae30daf90e230ecdf76875b356d9615/8c557/code-coverage.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 37.916666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAABLElEQVR42l2RaW/DIAyG+wfXchNCLrKM+2r+/4c5k6pus5EFFo9fjG/7vltrp3nmQkgpBRcSnEvOryikgiRhmHHKOMcEEULwy27O+VxK6z2m0luNKdfWIcRUoy8ptk+7rfv0ZS0dCeVIjRpT+oK9iznFFK33tWQfYqkthBSvLBw90x/DxBZjEMEgSihFv5Vjusw5V3I+rAvA+BhCBAsxLGbUqzLGsIES+oDu3sre+x+V5J3ttVnrSylQzvlQrpp+NsO4iHU3UilE7pRCiRcM5Ss8tDW4ePZn9OnZe67A51bbble5YL0pMY4XgzBC6P1hwLTWLwDg84Q+n/0stedcwXe3bscqJjZoxYTEf+22bZvZDQwMNsdxLMuq9QRLKa3HmXKC6B0G9sCX7D/4G4qrsfpgA1hKAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/fae30daf90e230ecdf76875b356d9615/8ac56/code-coverage.webp 240w,
/static/fae30daf90e230ecdf76875b356d9615/d3be9/code-coverage.webp 480w,
/static/fae30daf90e230ecdf76875b356d9615/426ac/code-coverage.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/fae30daf90e230ecdf76875b356d9615/8ff5a/code-coverage.png 240w,
/static/fae30daf90e230ecdf76875b356d9615/e85cb/code-coverage.png 480w,
/static/fae30daf90e230ecdf76875b356d9615/8c557/code-coverage.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/fae30daf90e230ecdf76875b356d9615/8c557/code-coverage.png&quot;
            alt=&quot;Code Coverage Results&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h4 id=&quot;utilities&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#utilities&quot; aria-label=&quot;utilities permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Utilities&lt;/h4&gt;
&lt;p&gt;The utilities folder contains classes that provide utility functions. These classes are used by the framework and may be used in user applications. See the &lt;a href=&quot;/posts/utilities-framework&quot;&gt;Utilities Framework&lt;/a&gt; package for information on how to use the utility classes.&lt;/p&gt;
&lt;h4 id=&quot;vendors&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#vendors&quot; aria-label=&quot;vendors permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Vendors&lt;/h4&gt;
&lt;p&gt;The vendors folder contains third party libraries such as &lt;a href=&quot;https://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Twitter Bootstrap&lt;/a&gt;, &lt;a href=&quot;https://jquery.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JQuery&lt;/a&gt;, &lt;a href=&quot;https://www.w3schools.com/w3css/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3.CSS&lt;/a&gt; and &lt;a href=&quot;https://qunitjs.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;QUnit&lt;/a&gt;. These frontend libraries can be used in html templates. Reusable widgets may be developed that allow developers to easily create attractive looking applications.&lt;/p&gt;
&lt;h4 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Run the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; require nadirlc/pak-php-framework &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Installation using Composer&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; OR
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/pakjiddat/pak-php-framework.git &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Download from &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;GitHub Repository&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;https://github.com/pakjiddat/pak-php-framework&lt;span class=&quot;token punctuation&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After the source code has been downloaded, create a MySQL database called &lt;strong&gt;pakjiddat_pakphp&lt;/strong&gt; and import the contents of the file &lt;strong&gt;framework/data/pak-php-framework.sql&lt;/strong&gt; to the database. This will create the database tables used by the Pak Php Framework. These tables are used for saving error data, access logs, test data and test results.&lt;/p&gt;
&lt;h3 id=&quot;examples&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#examples&quot; aria-label=&quot;examples permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Examples&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;helloworld&lt;/strong&gt; sample application shows how to get started with the Pak Php Framework. To run the application, enter the name of the host used to access the application in the &lt;strong&gt;helloworld/Config.php&lt;/strong&gt; file. Replace &lt;strong&gt;example.pakjiddat.pk&lt;/strong&gt; with &lt;strong&gt;your-host-name&lt;/strong&gt;. Also enter the database server credentials in &lt;strong&gt;helloworld/config/RequiredObjects.php&lt;/strong&gt;. After that open the application in the browser.&lt;/p&gt;
&lt;p&gt;For a more complex example you can download and install one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/developers-site&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Developers Site&lt;/a&gt;. It is a simple website that allows web developers to publish their work&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/islam-companion-website&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Islam Companion Website&lt;/a&gt;. It allows users to read the Holy Quran and Hadith. Also allows subscribing to Holy Quran and Hadith by email&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pakjiddat/islam-companion-web-api&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Islam Companion Web API&lt;/a&gt;. It provides a RESETFul API for fetching Holy Quran and Hadith data&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Utilities Framework]]></title><description><![CDATA[The Utilities Framework is a set of PHP libraries that provide functions such as error handling, logging, emailing, fetching web pages, script profiling, database abstraction, encryption, template engine and more. It requires PHP 7.2 and above. The libraries are easy to use and can be used with custom applications and PHP Frameworks.]]></description><link>https://pakjiddat.netlify.app//posts/utilities-framework</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/utilities-framework</guid><pubDate>Sun, 10 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/96dae10abb4ff04f3f2750946dd689d3/8c557/code-editor.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 52.916666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAIAAADwazoUAAAACXBIWXMAAAsTAAALEwEAmpwYAAABuUlEQVR42kWR246dMAxF+f9vqzQPMy1M50CAHK4hVwghxD6qoaPW2nK2H5Yd2VmeF4+/8fWoq5pVrCrLuqzZFyuKz/ePjzzPq6rknDd1zRhr27auaypZXWVSLd7vSqtozljEnbtQhNgcUcbjOFJKr9cL7ogxhnCQ2bbNOau1zobxeZ7JOIsaIU8n37FAEADpFoF46w7EyxG2LIuUMuv61nuvrIIZ0ltMHzG9B/wB8CsBS9gBdgg9YPxuQbwxRt6RNc9SSmWsjgZSg2eLhwhnhZEB6awgkliKPl1wuvj/cNc3NFlrY6W3dlNbXD0p7Af4AJQvQznQTLh/DfofPE8TPVTr+WjK0D7Tszt5G/sehx6GHsWMwcO+Q6Be4VqAs0apb3he3WqsmyesKmQMmxp5i20LTQOcA39CP0DfwzSDlLQtMmaeb3gYBqWl0hsxn7/x8bh4GkuaRmJQiMtwjtMEi4B5AsZMVclxlFnB3sru5zjNYkqGjq0i7U7pKM2pTVI6aZf2kPb9PGK6T4VaWyEkKeuGbg9Ba+WUUZOWoxajWcivTq+bXp1aN7et62aNM6uz3m9SLkKIZRF/ABU5aWACb4hMAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/96dae10abb4ff04f3f2750946dd689d3/8ac56/code-editor.webp 240w,
/static/96dae10abb4ff04f3f2750946dd689d3/d3be9/code-editor.webp 480w,
/static/96dae10abb4ff04f3f2750946dd689d3/426ac/code-editor.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/96dae10abb4ff04f3f2750946dd689d3/8ff5a/code-editor.png 240w,
/static/96dae10abb4ff04f3f2750946dd689d3/e85cb/code-editor.png 480w,
/static/96dae10abb4ff04f3f2750946dd689d3/8c557/code-editor.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/96dae10abb4ff04f3f2750946dd689d3/8c557/code-editor.png&quot;
            alt=&quot;Utilities Framework&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The Utilities Framework is a set of PHP libraries that provide functions such as error handling, logging, emailing, fetching web pages, script profiling, database abstraction, encryption, template engine and more. It requires PHP 7.2 and above. The libraries are easy to use and can be used with custom applications and PHP Frameworks.&lt;/p&gt;
&lt;p&gt;The Utilities Framework code is fully commented and compliant with the &lt;a href=&quot;https://www.php-fig.org/psr/psr-2/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PSR-2&lt;/a&gt; coding guidelines.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The Utilities Framework has the following features:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;h4 id=&quot;database-management&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#database-management&quot; aria-label=&quot;database management permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Database Management&lt;/h4&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It provides functions for working with Databases. It consists of a Query Builder, Database Cache Manager and Database Log Manager. It also provides a Database MetaQuery Runner and Database Transaction Manager, based on &lt;a href=&quot;http://php.net/manual/en/book.pdo.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PDO&lt;/a&gt;
2. #### Method Validation
This allows validating method parameter values against information in the method’s Doc Block comments. This feature is provided by the &lt;a href=&quot;/posts/comment-manager&quot;&gt;Comment Manager&lt;/a&gt; package.
3. #### Error Management
It allows application errors to be displayed using HTML template files. The template files can be easily customized. Default template files are provided for displaying formatted error messages for the browser and the command line
4. #### File and Folder Management
It provides functions for fetching URL contents, checking if network connection works, searching for files with a folder and copying folder contents recursively
5. #### Email Handling
It provides functions for sending email in plain text format and HTML format with file attachments. It is based on the &lt;a href=&quot;https://pear.php.net/package/Mail/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Pear Mail&lt;/a&gt; library and hence supports sending email using SMTP server, PHP mail function and Sendmail library&lt;br&gt;
6. #### Log Management
It provides functions for saving and updating log data to database. It uses the PDO library for saving data and hence allows log data to be saved to all the databases that are supported by PDO
7. #### Template Engine
It provides a template engine that allows separating the HTML layout code from the data. It also allows templates to be built recursively. This means that a template can consist of one or more templates, which can contain more templates. This allows complex website layouts to be divided in to simple layout files that are automatically combined by the template engine
8. #### Encryption
It provides function for encryption and decryption data using the new &lt;a href=&quot;http://php.net/manual/en/book.sodium.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;LibSodium library&lt;/a&gt;, which is part of PHP &gt;=7.2
9. #### String Utilities
It provides functions for exporting data to RSS format, converting relative URLs to absolute, checking if string is valid JSON, HTML or Base64 encoded and more
10. #### Profiler
It allows the memory usage and execution time to be measured between function calls
11. #### Cache Manager
It allows data to be stored in a cache. It supports memory cache and database cache
12. #### Authentication
It provides functions for authenticating users using HTTP digest authentication&lt;/p&gt;
&lt;p&gt;The following screenshot shows the error message displayed by the error handler component:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/8c557/error-message.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 35%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA20lEQVR42oWPS2vDMBCE8/9/V8mllCSnQsCH2IkfUiRF2pVsvXZr51Zw6TIMc9iPnT0cjx/fpxMPD761LARbyw4YkRG24HHLy8x7czh/fV7Pl6o0aU0vw85yTkyFa6GSqby9ln04x9CLRjzblxLaSBVAISoE7cFG56JbHRIS0Q5cqZpkm/vcPrjtWcqtaQib9vZ/wyUtAEpM0zjdx6mTVppoINlCOZX0Vsw1E+9dzsvcjddhaKyUVvQYVtJDRB89RlgFEXzyf9SuVUfTPd1tDK0MwqJfP+T/Gr/hH50clazdOO9aAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/8ac56/error-message.webp 240w,
/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/d3be9/error-message.webp 480w,
/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/426ac/error-message.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/8ff5a/error-message.png 240w,
/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/e85cb/error-message.png 480w,
/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/8c557/error-message.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/4b28a0b5ed5b0aa7f4133d5058d7f40f/8c557/error-message.png&quot;
            alt=&quot;Error Handler Component&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The following screenshot shows the MySQL query log displayed by the error handler component as part of the error:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; &quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/44b4c52eae54f6996f3f2a609624d4b3/8c557/mysql-query-log.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 35.416666666666664%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA8klEQVR42nVQa4+DIBD0///C3kVTLvKUl6Jg0UpvoLnkvnRCYDfLzs5ORykbx3FZlud1nU/gfKNGLSmlvD6go4z2/feklJ9nnAo/W2vxWuussSnFnB9v1uM8GuoD0k4IiX6jtTF2mqSaKpSUuAXnUioHJmseOe/7Y097SjsQY6zNjLEfctdaQzmmpVpOqKW/j9d1lQ/ohn64fd2GYVBqcs631q1SVIIUkWxxDSsQ2o0cQHYcueOcE3I31tbyuoUQIMF734LgnTtyhjf/bUMMNc0wygghUoi6JAzAtkpJwbE2RY0LDSekhBYI2ursOhkiSim/SIWOLywtixAAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/44b4c52eae54f6996f3f2a609624d4b3/8ac56/mysql-query-log.webp 240w,
/static/44b4c52eae54f6996f3f2a609624d4b3/d3be9/mysql-query-log.webp 480w,
/static/44b4c52eae54f6996f3f2a609624d4b3/426ac/mysql-query-log.webp 700w&quot;
              sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/44b4c52eae54f6996f3f2a609624d4b3/8ff5a/mysql-query-log.png 240w,
/static/44b4c52eae54f6996f3f2a609624d4b3/e85cb/mysql-query-log.png 480w,
/static/44b4c52eae54f6996f3f2a609624d4b3/8c557/mysql-query-log.png 700w&quot;
            sizes=&quot;(max-width: 700px) 100vw, 700px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/44b4c52eae54f6996f3f2a609624d4b3/8c557/mysql-query-log.png&quot;
            alt=&quot;MySQL Query Log&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Run the command: &lt;strong&gt;composer require nadirlc/utilities-framework&lt;/strong&gt; (installation using Composer) &lt;strong&gt;OR&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Run the command: &lt;strong&gt;git clone &lt;a href=&quot;https://github.com/pakjiddat/utilities-framework.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://github.com/pakjiddat/utilities-framework.git&lt;/a&gt;&lt;/strong&gt; (Download from &lt;a href=&quot;https://github.com/pakjiddat/utilities-framework&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GitHub Repository&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;usage&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;p&gt;All components of the Utilities Framework can be accessed using factory functions. To use a feature, we need to first create an object of the relevant component. For example: &lt;strong&gt;UtilitiesFramework::Factory(“email”, $parameters);&lt;/strong&gt;. To send an email the following code can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* The Email class requires Mail and Mail_Mime pear package */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;include_once&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Mail.php&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;include_once&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Mail/mime.php&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/* Change the from and to emails to your email address */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$from_email&lt;/span&gt;       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;nadir@dev.pakjiddat.pk&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$to_email&lt;/span&gt;         &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;nadir@dev.pakjiddat.pk&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The parameters for the email object */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$parameters&lt;/span&gt;       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;params&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;backend&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;mail&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/* The Email class object is fetched */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$email&lt;/span&gt;            &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;UtilitiesFramework&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Factory&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$parameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The email is sent */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$is_sent&lt;/span&gt;          &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SendEmail&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$from_email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$to_email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Utilitiesframework Test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                        &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;h3&gt;test html content&amp;lt;/h3&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                        &lt;span class=&quot;token constant&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                        &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;file-path&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** If the email was sent, then information message is shown */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$is_sent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Email was successfully sent&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Email could not be sent&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;examples&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#examples&quot; aria-label=&quot;examples permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Examples&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;/examples&lt;/strong&gt; folder contains example usage for each component.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Editoria book publishing platform]]></title><description><![CDATA[Editoria is a web based tool for publishing books. It allows editors and authors to collaborate on book publishing. Editoria is being developed by the University of California Press and the California Digital Library in partnership with the Coko Foundation.]]></description><link>https://pakjiddat.netlify.app//posts/installing-editoria-book-publishing-platform</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-editoria-book-publishing-platform</guid><pubDate>Sat, 09 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Editoria is a web based tool for publishing books. It allows editors and authors to collaborate on book publishing. Editoria is being developed by the University of California Press and the California Digital Library in partnership with the Coko Foundation.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://editoria.pub/about-us/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Editoria’s goal&lt;/a&gt; is to provide a modern web based publishing platform that is more efficient, then current desktop based book publishing software. Editoria provides a web based workflow tool for styling, copyediting, author review, and proofreading.&lt;/p&gt;
&lt;p&gt;Editoria is available as open source software and can be downloaded and installed by anyone free of cost. It is based on NodeJs library.  In this article I will describe my experience with installing Editoria on Debian 9 (Stretch) operating system.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Editoria is based on several &lt;a href=&quot;https://gitlab.coko.foundation/pubsweet&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PubSweet&lt;/a&gt; components. It also uses PostgreSQL database. The &lt;a href=&quot;https://gitlab.coko.foundation/editoria/editoria/blob/master/INSTALL.md&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Editoria installation&lt;/a&gt; guide describes how to install Editoria. The main installation steps are as follows:&lt;/p&gt;
&lt;p&gt;Editoria requires NodeJs version &lt;strong&gt;8.3&lt;/strong&gt; and above. Version &lt;strong&gt;8.9&lt;/strong&gt; worked for me. &lt;a href=&quot;https://docs.docker.com/install/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Docker&lt;/a&gt; and &lt;a href=&quot;https://docs.docker.com/compose/install/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Docker Compose&lt;/a&gt; are also required for running the PostgreSQL database server.&lt;/p&gt;
&lt;h4 id=&quot;installing-project-dependencies&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-project-dependencies&quot; aria-label=&quot;installing project dependencies permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing project dependencies&lt;/h4&gt;
&lt;p&gt;The first step in installing Editoria is to clone the source code repository on GitLab using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://gitlab.coko.foundation/editoria/editoria.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The next step is to install the project dependencies using the &lt;a href=&quot;https://yarnpkg.com/en/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Yarn&lt;/a&gt; package management tool for NodeJs. Yarn can be installed using the command: &lt;strong&gt;npm install -g yarn&lt;/strong&gt;. To install the dependencies for the Editoria, run the command &lt;strong&gt;yarn&lt;/strong&gt; from the root folder of the source code.&lt;/p&gt;
&lt;p&gt;The next step is to change directory to application folder which is &lt;strong&gt;packages/editoria-app&lt;/strong&gt; and create the configuration file: &lt;strong&gt;config/local-development.json&lt;/strong&gt;. This was not possible since the &lt;strong&gt;packages/editoria-app&lt;/strong&gt; folder did not exist. A similar &lt;a href=&quot;https://gitlab.coko.foundation/editoria/editoria/issues/238&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;issue&lt;/a&gt; was mentioned on the Editoria issue tracker. The solution as suggested in the issue was to first clone the repository &lt;strong&gt;&lt;a href=&quot;https://gitlab.coko.foundation/editoria/ucp.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://gitlab.coko.foundation/editoria/ucp.git&lt;/a&gt;&lt;/strong&gt; and then replace the text &lt;strong&gt;&lt;a href=&quot;https://git@gitlab.coko.foundation/pubsweet/html-epub&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://git@gitlab.coko.foundation/pubsweet/html-epub&lt;/a&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;a href=&quot;https://git@gitlab.coko.foundation/pubsweet/html-epub.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://git@gitlab.coko.foundation/pubsweet/html-epub.git&lt;/a&gt;&lt;/strong&gt;, in the file &lt;strong&gt;yarn.lock&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h4&gt;
&lt;p&gt;After that the dependencies should be installed with the command: &lt;strong&gt;yarn&lt;/strong&gt;. The application folder is the root folder of the source code. Next the configuration file &lt;strong&gt;config/local-development.json&lt;/strong&gt; needs to be created. This file contains credentials for configuring the &lt;a href=&quot;https://gitlab.coko.foundation/INK/ink-api&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;INK server&lt;/a&gt;. The INK server provides an API for uploading Word files. Without the INK server the user will not be able to upload Word files. I did not install the INK server, so there was no need to edit the configuration file.&lt;/p&gt;
&lt;p&gt;The next step is to create the configuration file, &lt;strong&gt;config/development.env&lt;/strong&gt;. This file contains environment variables such as database server credentials, email server information and the INK server credentials.&lt;/p&gt;
&lt;p&gt;The environment variables given in the file should be imported with the command: &lt;strong&gt;source config/development.env&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;database-server-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#database-server-configuration&quot; aria-label=&quot;database server configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Database server configuration&lt;/h4&gt;
&lt;p&gt;Next the database server should be started with the command: &lt;strong&gt;yarn start:services&lt;/strong&gt;. The command should be run from the root folder. It will start the Docker container containing the PostgreSQL server.&lt;/p&gt;
&lt;p&gt;If the command &lt;strong&gt;yarn start:services&lt;/strong&gt; fails with the error, that the root role does not exist, then the root role and an admin user should be created within the Docker container. The steps for creating the role and user are described in an answer to the question: &lt;a href=&quot;https://stackoverflow.com/a/23934693/4508593&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PostgreSQL error: Fatal: role “username” does not exist&lt;/a&gt; on StackOverflow.&lt;/p&gt;
&lt;p&gt;To create the database role and user, we first need to get the name of the container using the command: &lt;strong&gt;docker container ls&lt;/strong&gt;. Next we need to enter the container command prompt with the command: &lt;strong&gt;docker exec -it {container name} /bin/bash&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next we need to switch to user &lt;strong&gt;postgres&lt;/strong&gt; and then select the &lt;strong&gt;template1&lt;/strong&gt; database from psql prompt. This can be done with the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;su&lt;/span&gt; - postgres&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
psql template1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;template0&lt;/strong&gt; and &lt;strong&gt;template1&lt;/strong&gt; databases are default databases in PostgreSQL, that are used as templates for creating new databases. The default &lt;strong&gt;postgres&lt;/strong&gt; database is intended to be used by users, utilities and third part applications. Next we need to create a role with super user privileges. This can be done with the command: &lt;strong&gt;CREATE ROLE root superuser;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next we need to create a user with the command: **CREATE USER username; ** and assign it root role with the command: &lt;strong&gt;GRANT ROOT TO username;&lt;/strong&gt;. Next we need to give login access to the user with the command: &lt;strong&gt;ALTER ROLE root WITH LOGIN&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Once we have created the root role and user, we need to configure the database with the command: &lt;strong&gt;yarn resetdb&lt;/strong&gt;. This will prompt for a user name and password. It will also create some database tables. The user name and password specified here should be noted and entered in the &lt;strong&gt;config/development.env&lt;/strong&gt; configuration file. After the file has been edited, the environment variables in the file should be imported with the command: &lt;strong&gt;source config/development.env&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;After that we should start the database server again with the command: &lt;strong&gt;yarn start:service&lt;/strong&gt;. Next in a new terminal, we can start the main Editoria application with the command: &lt;strong&gt;yarn server&lt;/strong&gt;. This will start the Editoria application on &lt;strong&gt;port 3000&lt;/strong&gt;. We should then be able to access the Editoria from a browser.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Editoria is an innovative book publishing platform, that allows all people involved with book publishing to collaborate. It is a useful tool for speeding up the book publishing process.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Comment Manager]]></title><description><![CDATA[The Comment Manager is a PHP script that allows parsing method Doc Block comments. It also allows validating parameter values and return values using information in the Doc Block comments.]]></description><link>https://pakjiddat.netlify.app//posts/comment-manager</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/comment-manager</guid><pubDate>Sun, 03 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The Comment Manager is a PHP script that allows parsing method &lt;a href=&quot;https://en.wikipedia.org/wiki/PHPDoc&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Doc Block comments&lt;/a&gt;. It also allows validating parameter values and return values using information in the Doc Block comments.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;h4 id=&quot;1-method-parameter-validation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#1-method-parameter-validation&quot; aria-label=&quot;1 method parameter validation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Method parameter validation&lt;/h4&gt;
&lt;p&gt;If you have added the following comment to a method:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;@param string $my_param [val1,val2,val3]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then the Comment Manager script can be used to check if the value given for the parameter, $my_param is in the list val1,val2,val3.&lt;/p&gt;
&lt;p&gt;The script can validate range of numbers, parameter types, lists, emails, json and arrays. Method return values can also be validated based on information in DocBlock comments&lt;/p&gt;
&lt;h4 id=&quot;2-extracting-method-description&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#2-extracting-method-description&quot; aria-label=&quot;2 extracting method description permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Extracting method description&lt;/h4&gt;
&lt;p&gt;The Comment Manager script can be used to extract the description text given in method Doc Bloc comments. Long and short method description can be extracted&lt;/p&gt;
&lt;h4 id=&quot;3-validating-method-context&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#3-validating-method-context&quot; aria-label=&quot;3 validating method context permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Validating method context&lt;/h4&gt;
&lt;p&gt;The Comment Manager script can be used to check if a class method is being called from the command line, from browser, as an API function or test function etc, based on information in the &lt;a href=&quot;http://docs.phpdoc.org/references/phpdoc/tags/internal.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;@internal tag&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&quot;4-custom-validation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#4-custom-validation&quot; aria-label=&quot;4 custom validation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Custom Validation&lt;/h4&gt;
&lt;p&gt;The Comment Manager script allows validating parameter values using custom validation functions&lt;/p&gt;
&lt;h4 id=&quot;5-supported-tags&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#5-supported-tags&quot; aria-label=&quot;5 supported tags permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Supported tags&lt;/h4&gt;
&lt;p&gt;Currently the Comment Manager script can be used to extract the following tags from DocBloc comments: &lt;a href=&quot;http://docs.phpdoc.org/references/phpdoc/tags/param.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;@param&lt;/a&gt;, &lt;a href=&quot;http://docs.phpdoc.org/references/phpdoc/tags/version.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;@version&lt;/a&gt;, &lt;a href=&quot;http://docs.phpdoc.org/references/phpdoc/tags/internal.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;@internal&lt;/a&gt;, &lt;a href=&quot;http://docs.phpdoc.org/references/phpdoc/tags/return.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;@return&lt;/a&gt; and the &lt;a href=&quot;http://docs.phpdoc.org/guides/docblocks.html#description&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;long and short method description&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Comment Manager script can be easily extended to extract other tags from method comments&lt;/p&gt;
&lt;h4 id=&quot;6-use-in-mvc-frameworks&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#6-use-in-mvc-frameworks&quot; aria-label=&quot;6 use in mvc frameworks permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Use in MVC frameworks&lt;/h4&gt;
&lt;p&gt;The Comment Manager package can be used in MVC (Model View Controller) frameworks for performing automatic validation of method parameters based on information in the method Doc Block comments&lt;/p&gt;
&lt;h4 id=&quot;7-psr-standard&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#7-psr-standard&quot; aria-label=&quot;7 psr standard permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;7. PSR Standard&lt;/h4&gt;
&lt;p&gt;The Comment Manager package code is compliant with the &lt;a href=&quot;https://www.php-fig.org/psr/psr-2/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PSR-2 coding style&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;example-use&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-use&quot; aria-label=&quot;example use permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example Use&lt;/h3&gt;
&lt;h4 id=&quot;example-1&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-1&quot; aria-label=&quot;example 1 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 1&lt;/h4&gt;
&lt;p&gt;The following example shows how to call a function safely with parameter and return value validation:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The safe_function_caller closure is fetched from the CommentManager class */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$safe_function_caller&lt;/span&gt;       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token class-name static-context&quot;&gt;CommentManager&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetClosure&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The parameters for the test function */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$parameters&lt;/span&gt;                 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;number1&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;number2&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;number3&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                   &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;data&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                                                 &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;type&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;integer&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                                &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;random_string&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;The result of adding the three integers is: &quot;&lt;/span&gt;
                                            &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                              &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The function that provides custom validation for the test function parameters */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$custom_validation_callback&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;CustomValidation&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The callback */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$callback&lt;/span&gt;                   &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;class_name&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;get_class&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;class_object&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;function_name&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;AddNumbers&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;parameters&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$parameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
                                  &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;context&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;cli&quot;&lt;/span&gt;
                              &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;                                          
   &lt;span class=&quot;token comment&quot;&gt;/** The test function is called through the safe function caller */&lt;/span&gt;
   &lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt;                  &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$safe_function_caller&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$custom_validation_callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;            
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name class-name-fully-qualified&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;Error&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** The error message is displayed and the script ends */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The result of adding the numbers is displayed */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;random_string&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;sum&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above example, &lt;strong&gt;CustomValidation&lt;/strong&gt; is a user defined function that performs custom validation. &lt;strong&gt;AddNumbers&lt;/strong&gt; is the function to validate. It takes 3 numbers and a random string as parameters. It returns the random string as it is and also the sum of the three numbers.&lt;/p&gt;
&lt;p&gt;The custom validation function validates the return value by checking if the length of the random string is within range. The type and value of the parameters is checked by the Comment Manager classes. See the example file &lt;strong&gt;CommentManagerTest.php&lt;/strong&gt; for the complete example.&lt;/p&gt;
&lt;h4 id=&quot;example-2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#example-2&quot; aria-label=&quot;example 2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 2&lt;/h4&gt;
&lt;p&gt;The following example shows how to extract method DocBlock comments:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The Parser class is included */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;Parser.php&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** An object of the parser class is created */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$parser&lt;/span&gt;          &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Parser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The method doc block comments are parsed */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$parsed_comments&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$parser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ParseMethodDocBlockComments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$class_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$function_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;print_R&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$parsed_comments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above example, $class name and $function_name is the method to check. The following output is produced:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;short&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; This &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; adds the three numbers given &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; parameters&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; It returns the sum of the numbers &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; a random &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; The random &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt; is given &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; the last parameter
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;long&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;version&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;since&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;version&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;internal&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;context&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; cli
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;parameters&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;int&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; number1
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; range
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the first number
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;int&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; number2
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; range
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the second number
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;int&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; number3
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; range
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the third number
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;array&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; data
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; contains the type of the numbers &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; a &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;values&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; type
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;list&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; integer&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token keyword type-declaration&quot;&gt;float&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the type of number to be added
                                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; random_string
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; custom
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
                                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; a random &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt; that is returned by the &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;
                                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;return_value&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;array&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; result
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the result of the &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;values&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; sum
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;int&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; range
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the sum of the three numbers
                        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;Array&lt;/span&gt;
                        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;variable_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; random_string
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;rule_data&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
                            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;description&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; the random &lt;span class=&quot;token keyword type-declaration&quot;&gt;string&lt;/span&gt;
                        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;function_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; AddNumbers
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;list-of-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#list-of-files&quot; aria-label=&quot;list of files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;List of files&lt;/h3&gt;
&lt;p&gt;The Comment Manager package consists of the following files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CommentManager.php&lt;/strong&gt;. It provides a closure function for safe calling of class methods. It also provides functions for parsing and validating method parameters and return value&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parser.php&lt;/strong&gt;. It provides a single function for parsing all method DocBlock comments&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DescriptionParser.php&lt;/strong&gt;. It provides functions for extracting long and short method description as well as the internal and version tags&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ParameterParser.php&lt;/strong&gt;. It provides functions for parsing the &lt;strong&gt;@param&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Validator.php&lt;/strong&gt;. It provides functions for validating method parameters and method return value using information in DocBloc comments&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VariableValidator.php&lt;/strong&gt;. It provides functions for validating different types of variables. For example integer, string, boolean and arrays&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Run the command: &lt;strong&gt;composer require nadirlc/comment-manager&lt;/strong&gt; (installation using Composer) &lt;strong&gt;OR&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Run the command: &lt;strong&gt;git clone &lt;a href=&quot;https://github.com/pakjiddat/comment-manager.git&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://github.com/pakjiddat/comment-manager.git&lt;/a&gt;&lt;/strong&gt; (Download from &lt;a href=&quot;https://github.com/pakjiddat/comment-manager&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GitHub Repository&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Website performance testing]]></title><description><![CDATA[The role of websites has evolved greatly over the last few years. Websites were initially a novel way of presenting information. Over the last few years websites have grown greatly in importance. Websites now may be regarded as the public image of all types of organizations.]]></description><link>https://pakjiddat.netlify.app//posts/website-performance-testing</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/website-performance-testing</guid><pubDate>Tue, 19 Feb 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The role of websites has evolved greatly over the last few years. Websites were initially a novel way of presenting information. Over the last few years websites have grown greatly in importance. Websites now may be regarded as the public image of all types of organizations.&lt;/p&gt;
&lt;p&gt;A well developed informative company website is a great asset for the company. Several technologies related to websites have been developed over the years, such as website performance testing, search engine optimization, email marketing etc.&lt;/p&gt;
&lt;p&gt;Given the importance of websites, it is important to ensure that a website loads correctly on all types of devices. This is no small task as it involves ensuring that all website components are being loaded correctly. For example CSS, JavaScript files should be loading quickly and in correct sequence. Images should be compressed so that they take less time to load. Web page HTML needs to conform to well known standards such as HTML 5.&lt;/p&gt;
&lt;p&gt;The most commonly used tool for measuring website performance is the browsers developer tool bar. All major web browsers such as Google Chrome, FireFox and Internet Explorer have a built in developers tool box which provides detailed information on web page content.&lt;/p&gt;
&lt;p&gt;Several online services such as &lt;a href=&quot;https://gtmetrix.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GTmetrix&lt;/a&gt; and &lt;a href=&quot;http://developers.google.com/speed/pagespeed/insights/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Pagespeed&lt;/a&gt; are available for measuring website performance. These services not only measure various performance metrics but also provide suggestions on how to improve the website performance. It is the job of the website developer to implement these suggestions and ensure good website performance. In this article I will focus on the suggestions for improving website performance.&lt;/p&gt;
&lt;p&gt;Some of the recommendations given by these tools are:&lt;/p&gt;
&lt;h3 id=&quot;combine-external-javascript-and-css&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#combine-external-javascript-and-css&quot; aria-label=&quot;combine external javascript and css permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Combine external JavaScript and CSS&lt;/h3&gt;
&lt;p&gt;This implies combining several JavaScript files into one file and several CSS files into one file. This reduces the number of requests sent by the browser and reduces the page loading time. The combined file may then be compressed or minimized which further reduces the loading time.&lt;/p&gt;
&lt;p&gt;On WordPress based websites this recommendation can be implemented using a plugin such as &lt;a href=&quot;https://wordpress.org/plugins/js-css-script-optimizer/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JS &amp;#x26; CSS Script Optimizer&lt;/a&gt;. This plugin supports combining and minifying JavaScript and CSS files.&lt;/p&gt;
&lt;h3 id=&quot;minimize-redirects&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#minimize-redirects&quot; aria-label=&quot;minimize redirects permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Minimize redirects&lt;/h3&gt;
&lt;p&gt;This involves reducing the use of redirect URLs. Redirect URLs are those URLs that redirect to other URLs. This increases page load times.&lt;/p&gt;
&lt;h3 id=&quot;minimize-dns-lookups&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#minimize-dns-lookups&quot; aria-label=&quot;minimize dns lookups permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Minimize DNS lookups&lt;/h3&gt;
&lt;p&gt;This implies reducing the number of host names that need to be looked up by the browser. This can be implemented by hosting all your web resources under a single host name. Use of a content delivery network (CDN) can also help in this regard.&lt;/p&gt;
&lt;h3 id=&quot;leverage-browser-caching&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#leverage-browser-caching&quot; aria-label=&quot;leverage browser caching permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Leverage browser caching&lt;/h3&gt;
&lt;p&gt;This is a common recommendation given by most of the tools. It implies making use of web browser caching. Web browsers can place resources such as CSS, JavaScript and image files in their local cache. By using resources in its local cache, the web browser has to make fewer requests to the web server.&lt;/p&gt;
&lt;p&gt;To make use of browser caching you need to configure your web server so it instructs the web browser to cache files for certain duration. For the &lt;a href=&quot;http://www.apache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache web server&lt;/a&gt; this can be achieved by entering commands in htaccess file. WordPress provides caching plugins such as &lt;a href=&quot;https://wordpress.org/plugins/w3-total-cache/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3 Total Cache&lt;/a&gt;, which have several caching features, including browser caching.&lt;/p&gt;
&lt;h3 id=&quot;use-a-content-delivery-network&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#use-a-content-delivery-network&quot; aria-label=&quot;use a content delivery network permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Use a Content Delivery Network&lt;/h3&gt;
&lt;p&gt;This means using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Content_delivery_network&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Content Delivery Network&lt;/a&gt; for hosting static resources such as JavaScript, HTML, CSS and images. The benefit of this is that the content is delivered more reliable and quickly. CDN services such as Akamai, Cloudflare and Cloudinary can be used to host your static resources.&lt;/p&gt;
&lt;p&gt;Cloudinary is a CDN service provider that has a very useful free plan. They also have a plugin for WordPress that allows content hosted on their servers to be accessed from WordPress websites.&lt;/p&gt;
&lt;h3 id=&quot;put-scripts-at-the-bottom&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#put-scripts-at-the-bottom&quot; aria-label=&quot;put scripts at the bottom permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Put scripts at the bottom.&lt;/h3&gt;
&lt;p&gt;This implies placing your JavaScript and CSS files at the bottom of your HTML page. It makes sense to delay loading CSS and JavaScript files that are not needed for rendering the page.&lt;/p&gt;
&lt;p&gt;These files may even be loaded asynchronously. Loading asynchronously means the file is downloaded and processed while other operations are being carried out. This allows the web page to render more quickly. Delaying the loading of scripts may not always be desirable. For example CSS and JavaScript files needed for rendering a page should be placed inside the head tag so they can be downloaded and processed quickly.&lt;/p&gt;
&lt;h3 id=&quot;choose-link-over-import&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#choose-link-over-import&quot; aria-label=&quot;choose link over import permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Choose &amp;#x3C;link&gt; over @import&lt;/h3&gt;
&lt;p&gt;This implies linking your CSS files using links tags instead off CSS @import statements. Using link tags is preferable because certain web browsers load CSS files that are linked using @import statement at the bottom of the page.&lt;/p&gt;
&lt;h3 id=&quot;gzip-and-compress-components&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#gzip-and-compress-components&quot; aria-label=&quot;gzip and compress components permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Gzip and compress components&lt;/h3&gt;
&lt;p&gt;This implies compressing web page content before it is sent by the browser. Content that is compressed takes less time to be transmitted and also reduces the network bandwidth usage. The W3 Total Cache WordPress plugin has support for compressing content. In Apache web server it can be achieved using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mod_gzip&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mod_gzip&lt;/a&gt; module. Once this module has been activated it can be configured using htaccess file.&lt;/p&gt;
&lt;h3 id=&quot;optimize-and-correctly-display-images&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#optimize-and-correctly-display-images&quot; aria-label=&quot;optimize and correctly display images permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Optimize and correctly display images&lt;/h3&gt;
&lt;p&gt;This implies ensuring that your images are compressed and are not larger than the required size. Images tend to be large in size and are one of the main bottlenecks of website performance. It is important to compress an image and resize it before serving it on your website.&lt;/p&gt;
&lt;p&gt;In WordPress this can be achieved using plugins such as &lt;a href=&quot;https://wordpress.org/plugins/ewww-image-optimizer/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;EWWW Image Optimizer&lt;/a&gt; or &lt;a href=&quot;https://wordpress.org/plugins/wp-smushit/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Smush.it&lt;/a&gt;. Both these are excellent plugins that can resize and compress the files in WordPress media library. Alternately you can use &lt;a href=&quot;https://www.websiteplanet.com/webtools/imagecompressor/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;a free online image compression tool&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;minify-html-css-and-javascript&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#minify-html-css-and-javascript&quot; aria-label=&quot;minify html css and javascript permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Minify HTML, CSS, and Javascript&lt;/h3&gt;
&lt;p&gt;This implies compressing HTML, CSS and JavaScript files before serving them. This makes the file size small and reduces the time needed to download the file. The W3 Total Cache plugin supports file compression.&lt;/p&gt;
&lt;h3 id=&quot;use-css-sprites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#use-css-sprites&quot; aria-label=&quot;use css sprites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Use CSS Sprites&lt;/h3&gt;
&lt;p&gt;A CSS Sprite is one large image that contains smaller images. CSS code is used to display images within a CSS sprite. CSS Sprites are specially useful for combining background images into a single image. The benefit of this is that it reduces the number of requests for individual images.&lt;/p&gt;
&lt;h3 id=&quot;monitor-plugin-performance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#monitor-plugin-performance&quot; aria-label=&quot;monitor plugin performance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Monitor plugin performance&lt;/h3&gt;
&lt;p&gt;Remove the plugins you don’t need. Having too many plugins on your site greatly reduces performance. You can also use the &lt;a href=&quot;https://wordpress.org/plugins/p3-profiler/screenshots&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;P3 performance profiler&lt;/a&gt; plugin to check which plugins are slowing down your website. This tip was suggested in a useful blog post titled ”&lt;a href=&quot;http://startbloggingonline.com/speed-up-wordpress/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Speeding up WordPress load from 4.23s to 1.33s [Case Study]&lt;/a&gt;“.&lt;/p&gt;
&lt;h3 id=&quot;use-online-validation-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#use-online-validation-tools&quot; aria-label=&quot;use online validation tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Use online validation tools&lt;/h3&gt;
&lt;p&gt;The World Wide Web Consortium (W3C) is an organization that manages HTML standards. It has an excellent &lt;a href=&quot;http://validator.w3.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;on-line tool&lt;/a&gt; that can be used to validate HTML documents.&lt;/p&gt;
&lt;p&gt;In WordPress you can validate each page and post of your website using the &lt;a href=&quot;https://wordpress.org/plugins/validated/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;validated&lt;/a&gt; plugin. WordPress also has a useful plugin called &lt;a href=&quot;https://wordpress.org/plugins/broken-link-checker/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Broken Link Checker&lt;/a&gt;, that can be used to check your website for broken page links.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Ensuring that the HTML of your website complies with web standards is an important consideration for any website. A website that is standards compliant will not only receive a higher ranking in Google search results but will also render more reliably across different web browsers.&lt;/p&gt;
&lt;h3 id=&quot;some-useful-links&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#some-useful-links&quot; aria-label=&quot;some useful links permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Some useful links&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://diythemes.com/thesis/improve-website-pagespeed/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Performance Unleashed: How To Speed Up WordPress Load Times&lt;/a&gt; is a useful article that describes how to improve WordPress load times. The optimization tips given in the article can also be applied to websites that are not based on WordPress.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://websitesetup.org/best-wordpress-hosting-performance/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Best WordPress Hosting: Top 10 Comparison &amp;#x26; Reviews&lt;/a&gt; is another useful article which reviews the best WordPress Hosting services.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.founderjar.com/best-web-hosting-services/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;17+ Best Web Hosting Services in 2020 (Providers Ranked by Industry, Use Case, and Price)&lt;/a&gt; is an excellent article that provides information about the different web hosting services. The article provides information about the best web hosting providers, the fastest web hosting plans, best WordPress hosting services for Bloggers, the best web hosting for small businesses and more.&lt;/li&gt;
&lt;/ol&gt;</content:encoded></item><item><title><![CDATA[Tracking Issues with Mantis Bug Tracker]]></title><description><![CDATA[Mantis Bug Tracker is web based software that allows keeping track of issues. It is used mainly for tracking bugs in software, but may be used as a general purpose issue tracker for all types of projects.]]></description><link>https://pakjiddat.netlify.app//posts/tracking-issues-with-mantis-bug-tracker</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/tracking-issues-with-mantis-bug-tracker</guid><pubDate>Wed, 02 Jan 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Mantis Bug Tracker is web based software that allows keeping track of issues. It is used mainly for tracking bugs in software, but may be used as a general purpose issue tracker for all types of projects.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Mantis_Bug_Tracker&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mantis Bug Tracker&lt;/a&gt; was first released in 2000. It is supported by an active software community and is stable and user friendly.&lt;/p&gt;
&lt;p&gt;It is written in Php language and supports several databases including MySQL, MSSQL and Oracle. In this article, I will describe my experience with installing and using &lt;a href=&quot;https://www.mantisbt.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mantis Bug Tracker&lt;/a&gt; for tracking software related issues. I will also describe my experience with upgrading Mantis and migrating issues from Jira to Mantis&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Installation of Mantis Bug Tracker is very simple and takes a couple of minutes. It is well documented in the &lt;a href=&quot;https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html/admin.install.new.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;online documentation for Mantis&lt;/a&gt;. The pre-requisites for using Mantis Bug Tracker are a Web Server, Php and a database server such as MySQL.&lt;/p&gt;
&lt;p&gt;To install Mantis Bug Tracker, we need to first &lt;a href=&quot;https://sourceforge.net/projects/mantisbt/files/mantis-stable/2.18.0/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;download the files from SourceForge&lt;/a&gt;, and then extract them to the document root folder. Next we need to run the installer from the web browser by visiting the url: &lt;a href=&quot;http://your-domain/path-to-mantis/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://your-domain/path-to-mantis/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The web based installer will ask a few questions such as the name of the database server, user name and password for the database user and the database table name prefix. After entering the required information, we need to press submit and the installer will create the database tables. This completes the installation process.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html/admin.install.upgrade.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;process for upgrading Mantis Bug Tracker&lt;/a&gt; is identical to the installation process. To upgrade an existing installation of Mantis, we need to simply install the new version of Mantis and specify the information for the existing Mantis database during the installation.&lt;/p&gt;
&lt;p&gt;Once the installation has completed, we can login with user: &lt;strong&gt;administrator&lt;/strong&gt; and password: &lt;strong&gt;root&lt;/strong&gt;. We will be prompted to remove the &lt;strong&gt;admin&lt;/strong&gt; installation folder and change the default password. For those interested in trying out Mantis, a &lt;a href=&quot;https://www.mantisbt.org/bugs/my_view_page.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;demo of the current version&lt;/a&gt; is provided.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mantis Admin Guide&lt;/a&gt; provides useful information about Mantis. To get started with Mantis, we need to first create a project. Each project contains issues.&lt;/p&gt;
&lt;h4 id=&quot;issues&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#issues&quot; aria-label=&quot;issues permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Issues&lt;/h4&gt;
&lt;p&gt;The issue is the main feature of Mantis. It contains fields such as &lt;strong&gt;description&lt;/strong&gt;, &lt;strong&gt;summary&lt;/strong&gt;, &lt;strong&gt;reporter&lt;/strong&gt;, &lt;strong&gt;assigned to&lt;/strong&gt;, &lt;strong&gt;status&lt;/strong&gt;, &lt;strong&gt;resolution&lt;/strong&gt;, &lt;strong&gt;steps to reproduce the issue&lt;/strong&gt;, &lt;strong&gt;additional issue information&lt;/strong&gt; and more. We can also add unlimited &lt;strong&gt;notes&lt;/strong&gt;, &lt;strong&gt;attachments&lt;/strong&gt;, &lt;strong&gt;tags&lt;/strong&gt; and &lt;strong&gt;custom fields&lt;/strong&gt; to issues.&lt;/p&gt;
&lt;h4 id=&quot;projects&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#projects&quot; aria-label=&quot;projects permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Projects&lt;/h4&gt;
&lt;p&gt;A project is a container for issues. Each project can have its own &lt;strong&gt;sub projects&lt;/strong&gt;, &lt;strong&gt;custom fields&lt;/strong&gt;, &lt;strong&gt;categories&lt;/strong&gt; and &lt;strong&gt;versions&lt;/strong&gt;. The list of users with access to the project can also be given.&lt;/p&gt;
&lt;h4 id=&quot;change-log&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#change-log&quot; aria-label=&quot;change log permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Change Log&lt;/h4&gt;
&lt;p&gt;A useful feature of Mantis is the &lt;strong&gt;Change Log&lt;/strong&gt;. It allows us to keep track of our projects. The Change Log shows the list of issues grouped by project version. To use the Change Log we need to first add versions to our project. When reporting an issue, we can select the project version under the “Fixed in Version” and “Product Version” fields. The issue will then appear under this project version on the “Change Log” page.&lt;/p&gt;
&lt;h4 id=&quot;road-maps&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#road-maps&quot; aria-label=&quot;road maps permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Road Maps&lt;/h4&gt;
&lt;p&gt;The Road Map shows issues for future versions of our projects. Each project version may be marked as &lt;strong&gt;released&lt;/strong&gt;. A project which is not marked as released will show up on the Road Map page along with the relevant issues.&lt;/p&gt;
&lt;p&gt;The Road Map page shows a progress bar describing how much progress has been made in completing the project. The progress is calculated by the number of issues completed in the project version. To configure an issue so it shows on the Road Map, we need to select the project version under the “Target Version” field. This field shows only project versions that have not been released.&lt;/p&gt;
&lt;h4 id=&quot;email-notifications&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#email-notifications&quot; aria-label=&quot;email notifications permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Email Notifications&lt;/h4&gt;
&lt;p&gt;Another useful feature of Mantis is the ability to get email notifications on issue changes. These notification emails may be configured at a detailed level for user roles. For example each time an issue is updated, an email may be sent to the project developers describing the change.&lt;/p&gt;
&lt;p&gt;The Mantis configuration file allows detailed configuration of Mantis including &lt;strong&gt;enable/disable email notification&lt;/strong&gt;, &lt;strong&gt;email server settings for SMTP email&lt;/strong&gt;, &lt;strong&gt;Logo and title&lt;/strong&gt;, &lt;strong&gt;fields to show/hide on the add, edit and view issue pages&lt;/strong&gt; and much more. A useful feature of Mantis is that it allows configuration of almost all features at a detailed level.&lt;/p&gt;
&lt;h4 id=&quot;plugins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#plugins&quot; aria-label=&quot;plugins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Plugins&lt;/h4&gt;
&lt;p&gt;A useful feature of Mantis is the ability to customize its features using plugins. The &lt;a href=&quot;https://www.mantisbt.org/wiki/doku.php/mantisbt:plugins:start&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;list of plugins&lt;/a&gt; for Mantis is listed on the Mantis wiki. For most plugins, the installation is as simple as downloading and extracting the plugin files to the &lt;strong&gt;plugins&lt;/strong&gt; folder. After that the plugin needs to be enabled from the plugins page.&lt;/p&gt;
&lt;h3 id=&quot;migrating-issues-from-jira-to-mantis&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-issues-from-jira-to-mantis&quot; aria-label=&quot;migrating issues from jira to mantis permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating issues from Jira to Mantis&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Jira_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jira&lt;/a&gt; is a feature rich Issue Tracker from Atlassian. Like Mantis it has been in use for several years and is in active development.&lt;/p&gt;
&lt;p&gt;In the article, &lt;a href=&quot;/posts/installing-atlassian-products-on-google-cloud&quot;&gt;Installing Atlassian products on Google Cloud&lt;/a&gt;, I described my experience with using Jira. Jira has more features than Mantis, but its main drawback is that it takes a lot of server resources. In order to reduce our billings on Google Cloud, we decided to migrate from Jira to Mantis.&lt;/p&gt;
&lt;p&gt;To migrate issues from Jira to Mantis, I first selected a project in Jira and enabled the columns that I wanted to export. Next I clicked on the option for exporting to CSV format with current fields. This exported all the issues in the project to a CSV file. I did this for all the projects that I wanted to export.&lt;/p&gt;
&lt;p&gt;Next, I installed the &lt;a href=&quot;https://github.com/mantisbt-plugins/csv-import&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mantis CSV Import plugin&lt;/a&gt;, which allows importing issues from a CSV file. To import the Jira issues, I simply uploaded the CSV files one by one.&lt;/p&gt;
&lt;p&gt;After each upload, I was asked to select the field mappings for the issues. The field mappings option allows selecting the fields on the issue page that corresponds with fields in the CSV file. After selecting the field mappings, the issues were imported. The imported process completed but gave an &lt;a href=&quot;https://mantisbt.org/bugs/view.php?id=25122&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Internal Application”&lt;/a&gt; error, which I posted to the issue tracker for the plugin.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Mantis Bug Tracker is very user friendly and easy to use. It is stable, well documented and is supported by an active community. Its useful for keeping track of all types of issues such as those related to Server Management, Website Maintenance and Website Development.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[JavaScript arrow functions and the let keyword]]></title><description><![CDATA[JavaScript arrow functions are unnamed functions which are best used as non-method functions. They provide a short hand notation for using functions. An arrow function consists of a list of function parameters followed by an arrow which is followed by an expression to be returned or a code block.]]></description><link>https://pakjiddat.netlify.app//posts/javascript-arrow-functions-and-the-let-keyword</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/javascript-arrow-functions-and-the-let-keyword</guid><pubDate>Sun, 25 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;JavaScript arrow functions are unnamed functions which are best used as non-method functions. They provide a short hand notation for using functions. An arrow function consists of a list of function parameters followed by an arrow which is followed by an expression to be returned or a code block. The following code shows how to create an arrow function&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;ToUpperWrapper&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;ToUpperWrapper&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;let&lt;/strong&gt; keyword is used to define a variable with a local scope. A variable declared using let can only be used in the block, expression or statement in which it is used as well as in sub blocks. The &lt;strong&gt;var&lt;/strong&gt; keyword allows a variable to be used globally or within a function block. Variables created with &lt;strong&gt;var&lt;/strong&gt; can be accessed any where within the enclosing function&lt;/p&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Arrow functions&lt;/a&gt; for more information about using JavaScript arrow functions&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using JavaScript modules]]></title><description><![CDATA[JavaScript Modules are an implementation of ES6 Modules. They allow a useful way to organize and reuse JavaScript code. JavaScript Modules consist of a set of features that provide module functionality.]]></description><link>https://pakjiddat.netlify.app//posts/using-javascript-modules</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-javascript-modules</guid><pubDate>Sun, 25 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;JavaScript Modules are an implementation of ES6 Modules. They allow a useful way to organize and reuse JavaScript code. JavaScript Modules consist of a set of features that provide module functionality.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;export&lt;/strong&gt; keyword allows exporting functions, constants, variables, class etc. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// lib.mjs&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;param1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello World !&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; testdata &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Test&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;import&lt;/strong&gt; keyword can be used to import exported functions and variables. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// main.mjs&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; Test from &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;lib&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;mjs&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test argument&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above example, the lib.mjs must have a relative path or it should be specified with &lt;strong&gt;http(s)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Module files are loaded like normal JavaScript files but with the &lt;strong&gt;type&lt;/strong&gt; attribute set to &lt;strong&gt;“module”&lt;/strong&gt;. The following example shows how to load a module:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;script type&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;module&quot;&lt;/span&gt; src&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;main.mjs&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;script&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;script nomodule src&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;fallback.js&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;script&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the above example, the &lt;strong&gt;fallback.js&lt;/strong&gt; file is loaded only by browsers that do not understand the JavaScript module standard. Browsers that understand module standard ignore the fallback.js script.&lt;/p&gt;
&lt;p&gt;Modules are different from normal scripts in that they are always executed in &lt;strong&gt;strict mode&lt;/strong&gt;. HTML style comments are not supported in modules. Instead single line comments should be used. Module scripts are loaded with &lt;strong&gt;Cross Origin Resource Sharing (CORS)&lt;/strong&gt;. This means the HTTP response that delivers the module code should include the HTTP Header: **Access-Control-Allow-Origin: *** or similar.&lt;/p&gt;
&lt;p&gt;Another feature of JavaScript modules is that they are loaded by the browser in deferred mode by default, which means they are downloaded while the page is being parsed. JavaScript module files should have the &lt;strong&gt;.mjs&lt;/strong&gt; file extension, but it is not required. The important thing is that the file is served with &lt;strong&gt;content-type&lt;/strong&gt; of &lt;strong&gt;text/javascript;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Dynamic import allows loading JavaScript modules from within scripts. The following example shows how to load JavaScript modules dynamically:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;script type&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;module&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; moduleSpecifier &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;./lib.mjs&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;repeat&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; shout&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;moduleSpecifier&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;hello&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;shout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;Dynamic import in action&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;script&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://developers.google.com/web/fundamentals/primers/modules&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Using JavaScript modules on the web&lt;/a&gt; for more information about using JavaScript modules.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Freelancing over the Internet - Drawbacks and Benefits]]></title><description><![CDATA[In this article I describe my experiences and conclusions of working as a Freelancer over the internet. I will describe the benefits and drawbacks of Freelancing in general with an emphasis of Freelance I.T work.]]></description><link>https://pakjiddat.netlify.app//posts/freelancing-over-the-internet---drawbacks-and-benefits</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/freelancing-over-the-internet---drawbacks-and-benefits</guid><pubDate>Tue, 13 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In this article I describe my experiences and conclusions of working as a Freelancer over the internet. I will describe the benefits and drawbacks of Freelancing in general with an emphasis of Freelance I.T work.&lt;/p&gt;
&lt;p&gt;Freelancing over the Internet is a career option pursed by many people these days. Its popular in both developing and developed countries. The advancement of Internet and Communication related technologies has led to an increase in the number of Freelance I.T workers. It has also created new challenges for individuals and society.&lt;/p&gt;
&lt;p&gt;Specialized software tools such as online portals, social networking platforms, voice and video conferencing, support forums etc have led to the creation of virtual communities, where people with common interests meet and share ideas.&lt;/p&gt;
&lt;p&gt;Freelancing over the Internet is made possible by specialized software that is used by the community members to interact with one another. For example Freelancers use communication tools such as Skype or an Instant Messaging client for communication with each other. Inspite of the rapid development in online communication tools, email remains a popular choice for communication between Freelancers.&lt;/p&gt;
&lt;p&gt;Online payment services such as PayPal, Skrill and Payoneer allow Freelancers to receive payment from their contractees. Online project management tools such as Redmine and Open Project are used to record the details of all work done by the Freelancers.&lt;/p&gt;
&lt;p&gt;Online Job Portals such as Upwork, Elance and Toptal allow Freelancers to choose the type of work that best suites them&lt;/p&gt;
&lt;h3 id=&quot;benefits-of-freelancing-over-the-internet&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#benefits-of-freelancing-over-the-internet&quot; aria-label=&quot;benefits of freelancing over the internet permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Benefits of Freelancing over the Internet&lt;/h3&gt;
&lt;p&gt;Freelancers in most cases have the freedom to choose their work hours and work place. This means they have more flexibility in planning their day to day activities. Many offices have a strict working culture and do not encourage religious and charitable activities. A Freelancer who works from home can divide his time between family, work, religious and charitable activities. He can choose when to exercise, when to sleep, when to eat, when to work etc.&lt;/p&gt;
&lt;p&gt;Another benefit of working as a Freelancer is that one does not have to commute to work and therefore does not have to spend as much on transportation and clothes. Also Freelancers suffer less from work related stress.&lt;/p&gt;
&lt;p&gt;Working from home is the new normal and is part of the modern gig economy. The article &lt;a href=&quot;https://gigster.com/thought-leadership/6-signs-that-the-future-of-work-is-here-today/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;6 signs that the future of work is here today&lt;/a&gt; describes how elastic staffing and working from home are affecting the modern corporate work environment.&lt;/p&gt;
&lt;h3 id=&quot;drawbacks-of-freelancing-over-the-internet&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#drawbacks-of-freelancing-over-the-internet&quot; aria-label=&quot;drawbacks of freelancing over the internet permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Drawbacks of Freelancing over the internet&lt;/h3&gt;
&lt;p&gt;Freelance workers who work remotely cannot interact with their contractees in person. This is a major drawback since it means they cannot get as good an understanding of their work as compared to a person who works onsite.&lt;/p&gt;
&lt;p&gt;Working onsite also means you get to learn from the experiences of others. Interacting with others professionally helps in developing personality and social skills. It also means the worker has a much better idea of what his employer is asking of him. He is thus able to contribute more effectively towards the achievement of his organizations goals.&lt;/p&gt;
&lt;p&gt;Freelancers have the freedom to choose who they work for. They can work for anyone in any part of the world!. This has implications for society as well as the individual. If someone works for an employer who lives in another country and he spends over 40 hours per day working for him, then it would seem that part of him is a member of his physical society and part of him is a member of a virtual community.&lt;/p&gt;
&lt;p&gt;I think this is not a fair assessment. An individual is either part of a physical society or he is not. He must not think of imaginary virtual worlds. He should regard his virtual community as another set of obligations not different from those of his physical world. He must focus on meeting those obligations.&lt;/p&gt;
&lt;h3 id=&quot;opportunities-for-freelance-it-workers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#opportunities-for-freelance-it-workers&quot; aria-label=&quot;opportunities for freelance it workers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Opportunities for Freelance I.T workers&lt;/h3&gt;
&lt;p&gt;Being a Freelancer not only means you can choose when and where to work, it also means you can choose who to work for. A Freelancer may work part time for a contractee and spend his remaining time contributing to worthy causes. He may also run his own business along side his Freelance work.&lt;/p&gt;
&lt;p&gt;There are numerous opportunities available online for Freelance workers. For example a Freelancer who needs money, can simply work for more people. Of course he must be careful about fulfilling his contractual obligations. Before working for a contractee online, he must ensure that he understands the terms of the contract between him and his contractee. If an understanding cannot be developed, then the contractor must stop working for that contractee and look for other opportunities&lt;/p&gt;
&lt;h3 id=&quot;starting-you-own-online-business&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#starting-you-own-online-business&quot; aria-label=&quot;starting you own online business permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Starting you own online business&lt;/h3&gt;
&lt;p&gt;Starting your own business is an attractive concept. Running a physical business is beyond the capability of most people. Not everyone is blessed with the mental and physical capabilities that are required to run a business.&lt;/p&gt;
&lt;p&gt;The internet has allowed people to overcome this barrier. Anyone who can read and type, can build a respectable online presence. However this does not mean that everyone can succeed over the internet. Succeeding in any occupation requires hard work, dedication and patience. The internet I believe only provides new opportunities to excel. The hard work of course still has to be done.&lt;/p&gt;
&lt;p&gt;Starting an online business requires very little capital and initial effort. All you need is a website that displays your products and services. These products and services dont even have to exist in the real world!. To attain true success however, the online business must be developed incrementally and improved over time.&lt;/p&gt;
&lt;p&gt;For example, a Freelancer may start an online blog and transform it into a respectable online business. He may start with publishing blog posts describing his Freelance work. He may also publish the source code that he has written on his own website.&lt;/p&gt;
&lt;p&gt;He may develop his own software components and make them available for others. While this may not make him a millionaire over night, it will bring him valuable feedback from which he can learn and improve. Fruitful and productive interaction over the internet, I believe is important for a person to understand how to benefit from the internet.&lt;/p&gt;
&lt;p&gt;Drawing more visitors to your blog is a good idea, since it brings feedback which can be used to improve and build on your ideas of running an online business. &lt;a href=&quot;https://websitesetup.org/wp-content/uploads/2016/08/how-to-start-a-business-blog.jpg&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to start a business blog&lt;/a&gt; is a useful info-graphic that pictorially describes how drawing visitors to your website can help you grow your online business.&lt;/p&gt;
&lt;p&gt;Cloud related technology has had a major impact on businesses. The Cloud offers various tools for collaboration, communication, data storage and computing that can benefit all types of businesses. The article &lt;a href=&quot;https://www.cloudwards.net/10-tips-how-the-cloud-can-make-your-company-more-productive-in-2015/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;10 Tips How The Cloud Can Make Your Company More Productive in 2015&lt;/a&gt; is a useful article that describes how Cloud related technologies can benefit businesses.&lt;/p&gt;
&lt;p&gt;While the Cloud has created new opportunities for businesses, its usage has created new challenges for society. Excessive usage of any technology is not a good thing and the Cloud is certainly no exception. Excessive usage of Cloud related technologies has created health and social problems, which must be identified and corrected.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Freelancing over the internet is a popular occupation that has grown in leaps and bounds in recent years. The advancement of technology has led to specialization in the work that is done remotely. For example website development and maintenance, software development, help desk management and call center management are some of the sub areas of Freelance work.&lt;/p&gt;
&lt;p&gt;The online job Marketplace freelancer.com lists over 900 job categories. Before choosing a career in Freelancing, I believe it is important to be aware of the pros and cons of Freelancing as well as the &lt;a href=&quot;/posts/pros-and-cons-of-technology-in-the-light-of-religion&quot;&gt;pros and cons of the technology&lt;/a&gt; behind it.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[ES6 brings new features to JavaScript]]></title><description><![CDATA[The ES6 standard has introduced several changes to JavaScript. These changes include Classes, Proxies, Promises, Modules, Iterators and Generators and more]]></description><link>https://pakjiddat.netlify.app//posts/es6-brings-new-features-to-javascript</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/es6-brings-new-features-to-javascript</guid><pubDate>Thu, 08 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The ES6 standard has introduced several changes to JavaScript. These changes include &lt;a href=&quot;/research/all/using-classes-and-objects-in-javascript&quot;&gt;Classes&lt;/a&gt;, Proxies, Promises, Modules, Iterators and Generators and more&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;for of&lt;/strong&gt; syntax allows iterating over an array. The following example shows how it works:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; array &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;//&apos;i&apos; refers to the values of the array indexes&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; array&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;//4, 5, 3, 7, 9&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The spread operator which is &lt;strong&gt;”…”&lt;/strong&gt; allows expanding an array. It can be used to allow functions to take indefinite number of arguments. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//args variable is an array holding the passed function arguments&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;function_one&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;args&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;   
    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;args&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;args&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;function_one&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;function_one&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;function_one&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;ES6 also allows functions to return multiple values. It allows a function to return a numerically indexed array. Its values can be assigned to multiple variables. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;function_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;//here we are storing variables in an array and returning the array&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; a&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; d&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; f&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;a&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; d&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; f&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;function_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;const&lt;/strong&gt; keyword is used to declare constant variables. A variable prefixed with &lt;strong&gt;const&lt;/strong&gt;, cannot be updated. Also we cannot declare more than one variable with same name and scope as constant&lt;/p&gt;
&lt;p&gt;See the article &lt;a href=&quot;http://qnimate.com/post-series/ecmascript-6-complete-tutorial/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ECMAScript 6 Complete Tutorial&lt;/a&gt; for more information about the new ES6 features&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using await and async with Promises]]></title><description><![CDATA[The async keyword is used when declaring functions. A function declared with async must return a promise. If a function is declared with async and it does not return a promise, then the JavaScript engine will automatically convert the return value of the function to a promise object.]]></description><link>https://pakjiddat.netlify.app//posts/using-await-and-async-with-promises</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-await-and-async-with-promises</guid><pubDate>Thu, 08 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The &lt;strong&gt;async&lt;/strong&gt; keyword is used when declaring functions. A function declared with async must return a &lt;strong&gt;promise&lt;/strong&gt;. If a function is declared with async and it does not return a promise, then the JavaScript engine will automatically convert the return value of the function to a promise object. For example the following functions are both valid async functions:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; Promise&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;await&lt;/strong&gt; keyword is used to wait for a promise to resolve. It causes code execution to wait until the promise has been resolved. The await keyword can only be used inside functions declared with async. It cannot be used inside regular functions. The following example shows how to use the await keyword:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; promise &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;resolve&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;done!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; result &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; promise&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// wait till the promise resolves&lt;/span&gt;

  &lt;span class=&quot;token function&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;result&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// &quot;done!&quot;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://javascript.info/async-await&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Async/await&lt;/a&gt; for more information about using &lt;strong&gt;await&lt;/strong&gt; and &lt;strong&gt;async&lt;/strong&gt; with JavaScript Promises.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using generators, classes and objects in JavaScript]]></title><description><![CDATA[All values in JavaScript are objects except for primitive values which have no methods and properties.]]></description><link>https://pakjiddat.netlify.app//posts/using-generators--classes-and-objects-in-javascript</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-generators--classes-and-objects-in-javascript</guid><pubDate>Thu, 08 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h4 id=&quot;javascript-objects&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#javascript-objects&quot; aria-label=&quot;javascript objects permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;JavaScript Objects&lt;/h4&gt;
&lt;p&gt;All values in JavaScript are objects except for primitive values which have no methods and properties.&lt;/p&gt;
&lt;p&gt;JavaScript defines 5 primitive data types, which are: &lt;strong&gt;string, boolean, null, undefined and number.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A JavaScript object is a collection of named values which are called properties. An object property can be a primitive, function or an object.&lt;/p&gt;
&lt;p&gt;An object method is an object property containing a function definition.&lt;/p&gt;
&lt;p&gt;Examples of creating JavaScript objects:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; person &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;firstName&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;John&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;lastName&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Doe&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;eyeColor&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; person &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The Object.create creates an object from an existing object */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; me &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;JavaScript objects are said to be mutable or changeable. When an object is assigned to another object, the assignment is done by reference. A new object is not created.&lt;/p&gt;
&lt;p&gt;All JavaScript objects are descendants of the built in &lt;strong&gt;Object&lt;/strong&gt;. All objects inherit properties that are in &lt;strong&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Object.prototype&lt;/a&gt;&lt;/strong&gt;. These properties may be overridden by the objects. For example &lt;strong&gt;toString()&lt;/strong&gt; method.&lt;/p&gt;
&lt;h4 id=&quot;javascript-classes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#javascript-classes&quot; aria-label=&quot;javascript classes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;JavaScript classes&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;ES6&lt;/strong&gt; introduced a new keyword &lt;strong&gt;class&lt;/strong&gt;, which allows creating classes using syntax that is common to most programming languages. The &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;class syntax&lt;/a&gt; also allows inheritance. The class syntax is just a wrapper for &lt;strong&gt;object.prototype&lt;/strong&gt;. It is implemented using the built in &lt;strong&gt;object.prototype&lt;/strong&gt; property.&lt;/p&gt;
&lt;p&gt;A major different between function declarations and class declarations is that functions are hoisted while classes are not. When we say that function declarations are hoisted, it means that a function can be called before it is defined, while a class cannot be used before it is defined. Following example shows how to declare and use a JavaScript class:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Rectangle&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;height&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;height &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; height&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;width &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; width&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;area &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;width &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;height&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;area&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calcArea&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;area&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;new_area&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;area&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;new_area&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; p &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; area &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; p&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;area&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
p&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;area   &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;constructor&lt;/strong&gt; keyword defines a function that is automatically called when an object is instantiated. The &lt;strong&gt;get&lt;/strong&gt; and &lt;strong&gt;set&lt;/strong&gt; keywords allows functions to be called when a property is read or updated.&lt;/p&gt;
&lt;p&gt;Functions prefixed with &lt;strong&gt;static&lt;/strong&gt; keyword are called on the class. They cannot be called on an instance of the class. The &lt;strong&gt;extends&lt;/strong&gt; keyword allows a class to inherit properties and methods from another class. The &lt;strong&gt;super&lt;/strong&gt; function should be the first line of code in the class constructor. It calls the parent class constructor.&lt;/p&gt;
&lt;p&gt;The W3school website provides useful information about &lt;a href=&quot;https://www.w3schools.com/js/js_object_definition.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JavaScript classes and objects&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;using-generators-in-javascript&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-generators-in-javascript&quot; aria-label=&quot;using generators in javascript permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Generators in JavaScript&lt;/h4&gt;
&lt;p&gt;Generators were introduced in ES6. One of the benefits of Generators is that they allow efficient handling of large arrays. JavaScript implements generators using the &lt;strong&gt;yield&lt;/strong&gt; keyword and &lt;strong&gt;function&lt;/strong&gt;* function declaration.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;function&lt;/strong&gt;* denotes a generator function. Within the function, the yield keyword can be used. The following code describes how to use generators in JavaScript:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;collection_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; count &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;collection_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;count&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the part 10 of the tutorial &lt;a href=&quot;http://qnimate.com/javascript-yield-keyword-and-function-syntax/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ECMAScript 6 Complete Tutorial&lt;/a&gt; for more information about using Generators in JavaScript&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using JavaScript promises]]></title><description><![CDATA[A Promise is defined as an object representing the eventual completion or failure of an asynchronous operation. When creating a Promise object, we have to pass a function called executor as the constructor parameter. The function should accept two functions as arguments called resolve and reject.]]></description><link>https://pakjiddat.netlify.app//posts/using-javascript-promises</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-javascript-promises</guid><pubDate>Mon, 05 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A &lt;strong&gt;Promise&lt;/strong&gt; is defined as an object representing the eventual completion or failure of an asynchronous operation. When creating a Promise object, we have to pass a function called &lt;strong&gt;executor&lt;/strong&gt; as the constructor parameter. The function should accept two functions as arguments called &lt;strong&gt;resolve&lt;/strong&gt; and &lt;strong&gt;reject&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;resolve&lt;/strong&gt; function should be called by the executor to resolve the Promise. The &lt;strong&gt;reject&lt;/strong&gt; function should be called to reject the promise. The following code shows how to create a Promise object:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; promise1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;resolve&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;foo&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

promise1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// expected output: &quot;foo&quot;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code starts a timer for 300 ms. When the timer expires, the Promise is marked as resolved. Once the Promise has been resolved, a function is called which prints the value passed to the resolve function.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;then&lt;/strong&gt; function is used to call functions that are called after a Promise has been resolved or rejected. It takes two parameters, the function to be called after the Promise has been resolved and the function to be called after the Promise has been rejected. It returns a Promise object. This allows chaining functions that need to be called asynchronously.&lt;/p&gt;
&lt;p&gt;The catch function allows exceptions thrown inside the executor function to be handled. It takes a single parameter, which is the function to handle the error. The following example shows how the catch function works:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; promise1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;resolve&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; reject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;Uh-oh!&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

promise1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Promise&lt;/a&gt; for more information about using JavaScript promises.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using Web Components in JavaScript]]></title><description><![CDATA[Web Components is a suit of different technologies that allow creating and using reusable custom HTML elements. Currently it is based on the three main features which are: Custom Elements, Shadow DOM and HTML Templates.]]></description><link>https://pakjiddat.netlify.app//posts/using-web-components-in-javascript</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-web-components-in-javascript</guid><pubDate>Mon, 05 Nov 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Web Components is a suit of different technologies that allow creating and using reusable custom HTML elements. Currently it is based on the three main features which are: Custom Elements, Shadow DOM and HTML Templates.&lt;/p&gt;
&lt;p&gt;A Web Component is created by registering a class which defines the component. The component can then be used in two ways. It can either extend the functionality of an existing element such as a paragraph tag, or it can define a custom element with its own name.&lt;/p&gt;
&lt;p&gt;A custom element can be defined using the following:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;word-count&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; WordCount&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;p&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first argument is the name of the component. The second argument is the name of the class which defines the Web Component. It should be a valid ES6 class name. The class may extend &lt;strong&gt;HTMLElement&lt;/strong&gt; or another HTML class such as &lt;strong&gt;HTMLParagraphElement&lt;/strong&gt;. The third argument is an optional argument which specifies the HTML element that the custom element is based on.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Shadow DOM API&lt;/strong&gt; allows the custom element to keep its markup, style and code separate without effecting other parts of the page. The &lt;strong&gt;attachShadow&lt;/strong&gt; allows a shadow root to be attached to any DOM element. Once the shadow root has been attached, it can be used like any other DOM element. For example, elements and styles can be added to it using JavaScript. The following example shows how to create the shadow root and attach it to the custom element:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Create a shadow root&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; shadow &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;open&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;mode&lt;/strong&gt; parameter indicates whether the Shadow DOM should be accessible to the main page. For example the &lt;strong&gt;video&lt;/strong&gt; tag contains a Shadow DOM which is in closed mode. Which means we cannot access its &lt;strong&gt;shadowRoot&lt;/strong&gt; property.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Templates&lt;/strong&gt; and &lt;strong&gt;Slots&lt;/strong&gt; are another part of Web Components. A template is an inert block of code which is not directly rendered by the browser. It is defined using &lt;strong&gt;Template&lt;/strong&gt; tag. The following code defines a template:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;template&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;my-paragraph&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;My paragraph&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;template&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A template is rendered by fetching its contents and appending it to a DOM element using JavaScript. The following shows how to use a template:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;my-paragraph&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; templateContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;templateContent&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Slots&lt;/strong&gt; provide placeholders for template values. Slots are defined using the &lt;strong&gt;slot&lt;/strong&gt; tag. A slot tag has a &lt;strong&gt;name&lt;/strong&gt; attribute which is used to access the slot from the custom element tag.&lt;/p&gt;
&lt;p&gt;Slots are first defined inside the template tag using the &lt;strong&gt;slot&lt;/strong&gt; tag. Then they are used inside the custom element tag by using the attribute &lt;strong&gt;slot&lt;/strong&gt; on an HTML element such as &lt;strong&gt;span&lt;/strong&gt; or &lt;strong&gt;div&lt;/strong&gt;. The value of the slot attribute is the name of the slot tag defined in the template.&lt;/p&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Web_Components&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Web Components&lt;/a&gt; for more information about how to use Web Components in JavaScript.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Generating free SSL certificate from LetsEncrypt on localhost]]></title><description><![CDATA[If your website hosting allows uploading SSL certificates but does not allow SSH access and you need a SSL certificate for your website, then a free SSL certificate from LetsEncrypt is a good option.]]></description><link>https://pakjiddat.netlify.app//posts/generating-free-ssl-certificate-from-letsencrypt-on-localhost</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/generating-free-ssl-certificate-from-letsencrypt-on-localhost</guid><pubDate>Wed, 31 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If your website hosting allows uploading SSL certificates but does not allow SSH access and you need a SSL certificate for your website, then a free SSL certificate from LetsEncrypt is a good option.&lt;/p&gt;
&lt;p&gt;First we need to install the SSL certificate on a remote host, for example localhost. To install the SSL certificate we need to first install the Certbot Acme client. The &lt;a href=&quot;https://certbot.eff.org/lets-encrypt/debianstretch-apache.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Certbot installation guide for Debian (Stretch)&lt;/a&gt; on the Certbot website describes how to install Certbot on Debian Stretch. Similar guides are available for other Unix based operating systems. For example the following command will install Certbot on Debian (Stretch): &lt;strong&gt;sudo apt-get install python-certbot-apache -t stretch-backports&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next, we need to obtain the SSL certificate. This can be done by issuing the command: &lt;strong&gt;sudo certbot certonly —manual&lt;/strong&gt;. We will then be asked to enter the name of the domain. After that the screen will show some text and the name of a file. We will have to add the text to the file and then upload it to the server at the specified path. Next the LetsEncrypt server will verify the existence of the uploaded file and will issue the SSL certificates to our Certbot client. Usually the SSL certificates are saved to the folder: &lt;strong&gt;/etc/letsencrypt/live/&lt;/strong&gt;. Next we need to upload the private key and SSL certificate to the website control panel. After this our website should be accessible over SSL.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://certbot.eff.org/docs/using.html#manual&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Certbot documentation&lt;/a&gt; for more information.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[How To Change Account Passwords on an OpenLDAP Server]]></title><description><![CDATA[To change the LDAP admin password, we need to first save the rootdn account information. We can do this with the command:]]></description><link>https://pakjiddat.netlify.app//posts/how-to-change-account-passwords-on-an-openldap-server</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/how-to-change-account-passwords-on-an-openldap-server</guid><pubDate>Fri, 19 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;To change the LDAP admin password, we need to first save the rootdn account information. We can do this with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ldapsearch &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; ldapi:// &lt;span class=&quot;token parameter variable&quot;&gt;-LLL&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-Q&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-Y&lt;/span&gt; EXTERNAL &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;cn=config&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;(olcRootDN=*)&quot;&lt;/span&gt; dn olcRootDN olcRootPW &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/newpasswd.ldif&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to generate a hash of the password using the slappasswd utility. The password should be appended to the LDAP configuration file. We can do this with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;/usr/sbin/slappasswd &lt;span class=&quot;token parameter variable&quot;&gt;-h&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;SSHA&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/newpasswd.ldif&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to place the generated hash password in the current location in the ldap configuration file. The new file should look similar to the following:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;dn: olcDatabase={1}hdb,cn=config
#olcRootDN: cn=admin,dc=example,dc=com
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}lieJW/YlN5ps6Gn533tJuyY6iRtgSTQw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The hdb string is the type of LDAP database. It can have other values such as mdb.&lt;/p&gt;
&lt;p&gt;After that we need to apply the changes using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ldapmodify &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; ldapi:// &lt;span class=&quot;token parameter variable&quot;&gt;-Y&lt;/span&gt; EXTERNAL &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/newpasswd.ldif&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This changes the password in the administrative section of the LDAP configuration&lt;/p&gt;
&lt;p&gt;We also need to change the password for the user. To do this we need to update the configuration file so it looks like following:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;dn: cn=admin,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: {SSHA}lieJW/YlN5ps6Gn533tJuyY6iRtgSTQw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to apply the changes using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ldapmodify &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; ldap:// &lt;span class=&quot;token parameter variable&quot;&gt;-x&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;cn=admin,dc=example,dc=com&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-W&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/newpasswd.ldif&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The article &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-change-account-passwords-on-an-openldap-server#changing-the-rootdn-password&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How To Change Account Passwords on an OpenLDAP Server&lt;/a&gt; describes how to change account passwords on an OpenLDAP server.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[INADEQUATE_SECURITY - SSL Cipher problems with HTTP2]]></title><description><![CDATA[HTTP2 requires encryption over SSL. The recommended SSL protocol for HTTP2 is TLS 1.2. Ciphers are encryption algorithms used by SSL protocols.]]></description><link>https://pakjiddat.netlify.app//posts/inadequate-security---ssl-cipher-problems-with-http2</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/inadequate-security---ssl-cipher-problems-with-http2</guid><pubDate>Fri, 19 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;HTTP2 requires encryption over SSL. The recommended SSL protocol for HTTP2 is TLS 1.2. Ciphers are encryption algorithms used by SSL protocols.&lt;/p&gt;
&lt;p&gt;Certain devices specially old ones such as old Android mobile phones or old operating systems like Windows XP, support outdated SSL Ciphers that are not supported by HTTP2 protocol.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://http2.github.io/http2-spec/#BadCipherSuites&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;TLS 1.2 Cipher Suite Black List&lt;/a&gt; shows the list of all SSL Ciphers that are not supported by the HTTP2 protocol. If a web browser running on an old operating system requests a SSL Cipher that is on the list of unsupported Ciphers, then the HTTP2 implementation of the browser should reject the connection to the server with &lt;a href=&quot;https://http2.github.io/http2-spec/#INADEQUATE_SECURITY&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;INADEQUATE_SECURITY&lt;/a&gt; error message&lt;/p&gt;
&lt;p&gt;To test if the connection between your device and a web server is over a reliable and secure HTTP2 connection, go to &lt;a href=&quot;https://www.ssllabs.com/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.ssllabs.com/index.html&lt;/a&gt; and enter the url of the website&lt;/p&gt;
&lt;p&gt;See the discussion &lt;a href=&quot;https://talk.plesk.com/threads/nginx-http-2-support-cipher-problems.337707/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;nginx HTTP/2 support cipher problems&lt;/a&gt; on the official Plesk forum for more information&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Securing Plesk using the Plesk Advisor extension]]></title><description><![CDATA[Plesk is a useful control panel for Windows and Linux based servers. It is used for managing web hosts, users, server security, email and more.]]></description><link>https://pakjiddat.netlify.app//posts/securing-plesk-using-the-plesk-advisor-extension</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/securing-plesk-using-the-plesk-advisor-extension</guid><pubDate>Fri, 19 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Plesk is a useful control panel for Windows and Linux based servers. It is used for managing web hosts, users, server security, email and more. Plesk is a commercial application with different pricing plans starting at 9.16 USD per month. Users can try Plesk for free for up to 2 weeks. The &lt;a href=&quot;https://www.plesk.com/features/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk website&lt;/a&gt; describes the different Plesk features.&lt;/p&gt;
&lt;p&gt;Recently I had the opportunity of securing a Plesk based server. In this article I will describe my experience with configuring the following Plesk security related features: &lt;strong&gt;“Plesk Watchdog”&lt;/strong&gt;, &lt;strong&gt;“Plesk Advisor”&lt;/strong&gt;, &lt;strong&gt;“Plesk Server Health Monitor”&lt;/strong&gt;, &lt;strong&gt;“HTTP2”&lt;/strong&gt;, &lt;strong&gt;“Fail2Ban”&lt;/strong&gt; and &lt;strong&gt;“ModSecurity”&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;securing-plesk&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#securing-plesk&quot; aria-label=&quot;securing plesk permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Securing Plesk&lt;/h3&gt;
&lt;p&gt;A server running Plesk should be configured from within Plesk. Installing custom scripts and applications outside Plesk is possible, but not recommended as it can conflict with scripts used by Plesk. Plesk has a number of built in features that can be used to secure the server. It also provides several &lt;a href=&quot;https://www.plesk.com/extensions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;extensions&lt;/a&gt; or addons for configuring server security. Following are some useful features/addons that can be configured:&lt;/p&gt;
&lt;h4 id=&quot;plesk-watchdog&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#plesk-watchdog&quot; aria-label=&quot;plesk watchdog permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Plesk Watchdog&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://docs.plesk.com/en-US/12.5/deployment-guide/appendix-g-configuring-additional-plesk-components-linux/watchdog-system-monitoring-component.70443/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk Watchdog&lt;/a&gt; is an extension for Plesk.&lt;/p&gt;
&lt;p&gt;It can be installed by clicking on Extensions on the left menu and then selecting Watch Dog. The Plesk Watchdog allows scanning the server for malware, viruses and rootkits. It allows monitoring hard disk usage as well as different services managed by Plesk.&lt;/p&gt;
&lt;p&gt;The Plesk Watchdog uses the &lt;a href=&quot;https://mmonit.com/monit/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Monit&lt;/a&gt; tool for monitoring services. It scans for viruses and malware using &lt;a href=&quot;https://en.wikipedia.org/wiki/Rkhunter&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RKHunter&lt;/a&gt; tool. The Plesk Watchdog allows monitoring services such as Nginx, Apache web server, Postfix SMTP server, MySQL server and all other extensions that can be managed from Plesk.&lt;/p&gt;
&lt;p&gt;Each service is monitored at an interval of 5 minutes by default. If a service is found to be stopped, then the Plesk Watchdog will start the service and will send an email to the server administrator. The user can configure the monitoring interval as well as disable service monitoring.&lt;/p&gt;
&lt;p&gt;The commands for starting and stopping each service can also be configured. This option was very useful, because we had installed the latest version of PHP FPM and the Plesk Watchdog was using incorrect commands for monitoring the service. Fortunately it was easy to change the monitoring commands.&lt;/p&gt;
&lt;p&gt;The Plesk Watchdog also allows monitoring the free disk space. It allows running a custom command if the free disk usage or number of files exceeds a certain threshold value.&lt;/p&gt;
&lt;p&gt;The Plesk Watchdog also allows scanning the server for malware, root kits, Trojans and other malicious software. It uses the Rkhunter tool for this purpose. The security scan can be configured to run daily, weekly, monthly or disabled. After the scan completes a summary report is sent to the configured email address. A summary report is also sent containing overview of the security scan and service status. This report can also be sent daily, weekly, monthly or disabled. The Plesk Watchdog also shows statistics containing CPU and RAM usage by different services.&lt;/p&gt;
&lt;h4 id=&quot;plesk-advisor&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#plesk-advisor&quot; aria-label=&quot;plesk advisor permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Plesk Advisor&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.plesk.com/extensions/advisor/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk Advisor&lt;/a&gt; is a useful tool that suggests options for improving server security and performance. The suggestions are basically Plesk extensions or features that can be used to improve the server security and performance.&lt;/p&gt;
&lt;p&gt;The Plesk Advisor also provides an overall score for the server which indicates how well the server security and performance has been configured. The higher the score, the more secure the server.&lt;/p&gt;
&lt;p&gt;The suggestions given by the Plesk Advisor can be enabled or disabled with a single click. Some of the recommendations by the Plesk Advisor include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Secure Websites With SSL/TLS Certificates&lt;/strong&gt;. It allows enabling/disabling SSL certificates for websites.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configure Scheduled Backups&lt;/strong&gt; allows configuring backup of databases, domains and configuration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configure ModSecurity &amp;#x26; Fail2ban&lt;/strong&gt; allows enabling/disabling the built in Plesk features Mod Security and Fail2Ban.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configure the Plesk Firewall&lt;/strong&gt; allows controlling which users and IP addresses have access to Plesk.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Disallow Weak Passwords&lt;/strong&gt; allows disabling the use of weak passwords.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enable HTTP/2&lt;/strong&gt; allows enabling/disabling HTTP2&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Switch On Automatic Updates&lt;/strong&gt; allows the operating system updates to be installed automatically.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;plesk-server-health-monitor&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#plesk-server-health-monitor&quot; aria-label=&quot;plesk server health monitor permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Plesk Server Health Monitor&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://docs.plesk.com/en-US/onyx/administrator-guide/statistics-and-monitoring/server-health-monitor/tracking-server-health.68888/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk Server Health Monitor&lt;/a&gt; allows us to monitor CPU, Hard Disk and Memory usage. It is available as a Plesk component and can be installed by going to &lt;strong&gt;“Tools and Settings”&lt;/strong&gt; and then &lt;strong&gt;“Updates”&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The Plesk Server Health Monitor allows us to monitor the CPU usage by each Plesk service. It provides current values as well as trend values in the form of graphs. For example it provides graphs that show how much CPU Apache web server has used. The CPU usage can be viewed for the last 3 hours, 1 day, 3 days and 1 week. Some of the monitored services are MySQL, PostFix and Nginx.&lt;/p&gt;
&lt;p&gt;The Plesk Server Health Monitor also allows us to monitor disk usage and current memory usage. It provides details on overall CPU usage such as average load, number of processes, zombie processes etc. The Plesk Server Health Monitor also allows us to monitor the current number of network packets sent and received per second. A detailed graph shows the trend over different time intervals.&lt;/p&gt;
&lt;p&gt;Emails notifications and alarms can be configured for the parameters being monitored. To configure emails notifications and alarms, we need to first click on “Download Configuration File”. This will download the configuration file for the Plesk Server Health Monitor.&lt;/p&gt;
&lt;p&gt;The configuration file is a XML file that allows setting threshold values and email notifications for each parameter being monitored, such as CPU usage by Apache web server.&lt;/p&gt;
&lt;p&gt;There are two types of alarms that can be configured. A yellow alarm indicating that resource usage is high and a red alarm indicating that the resource usage has reached a limit.&lt;/p&gt;
&lt;p&gt;The Plesk Server Health Monitor does not automatically detect changes in server hardware. The changes are detected only once when the component is first installed. In case of hardware changes such as increase in RAM, the Plesk Server Health Monitor configuration needs to be updated by clicking on &lt;strong&gt;“Detect Hardware Changes”&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;http2-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#http2-configuration&quot; aria-label=&quot;http2 configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;HTTP2 configuration&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/HTTP/2&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;HTTP2&lt;/a&gt; is a major version of the HTTP network protocol. It followed HTTP/1.1 protocol. It is based on the experimental &lt;a href=&quot;https://en.wikipedia.org/wiki/SPDY&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SPDY&lt;/a&gt; protocol originally developed by Google. As of October 2018, 30.5% of the top 10 million websites supported HTTP/2. HTTP/2 is supported by most major browsers.&lt;/p&gt;
&lt;p&gt;Its main features are improved performance and security. Performance improvement is achieved by several improvements such as header compression, multiplexing several requests and responses over a single TCP connection and server push.&lt;/p&gt;
&lt;p&gt;HTTP/2 provides improved security by requiring the TCP connection to be encrypted. Although HTTP2 protocol supports unencrypted connections, all major browsers only support HTTP2 over SSL/TLS connection. TLS 1.2 is the recommended SSL protocol for HTTP2 connections.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/HTTP/2_Server_Push&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;HTTP/2 Server Push&lt;/a&gt; allows the server to send resources to the client without waiting for the client to request the resources.&lt;/p&gt;
&lt;p&gt;For example if a browser sends a request for a web page index.html containing style.css and script.js, the server which implements HTTP/2 Server Push will send the style.css and script.js files to the browser along with the contents of index.html. This greatly reduces the web page loading time. HTTP/2 Server Push is supported by Nginx version 1.13.9 onwards and Apache version 2.4.17 onwards. HTTP/2 support for Apache is provided by the mod_http2 module.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.plesk.com/en-US/onyx/administrator-guide/web-servers/apache-and-nginx-web-servers-linux/http2-support-in-plesk.76461/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk support for HTTP2 protocol&lt;/a&gt; requires the latest version of Nginx web server.&lt;/p&gt;
&lt;p&gt;Once Nginx has been installed, HTTP2 support can be enabled with the command: &lt;strong&gt;plesk bin http2_pref enable&lt;/strong&gt;. To test if HTTP2 has been enabled for your website, go to the website: &lt;a href=&quot;https://tools.keycdn.com/http2-test&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://tools.keycdn.com/http2-test&lt;/a&gt; and enter the URL of your website. Also the Chrome Developers Toolbox has a column called protocol that indicates the HTTP protocol used to load each resource.&lt;/p&gt;
&lt;h4 id=&quot;fail2ban&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#fail2ban&quot; aria-label=&quot;fail2ban permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Fail2Ban&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fail2ban&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fail2Ban&lt;/a&gt; is a command line tool for banning suspicious IP addresses. It scans log files such as web server and ssh server log files and detects abnormal user activity such as too many failed login attempts or several web page error messages. It then updates the system firewall such as Iptables and prevents further access from the IP address for a certain time period.&lt;/p&gt;
&lt;p&gt;Plesk provides protection against brute force attacks using the &lt;a href=&quot;https://docs.plesk.com/en-US/onyx/administrator-guide/server-administration/protection-against-brute-force-attacks-fail2ban.73381/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Fail2Ban component&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The component first has to be installed. Next it has to be enabled, by going to &lt;strong&gt;Tools &amp;#x26; Settings&lt;/strong&gt;, then &lt;strong&gt;IP Address Banning (Fail2Ban)&lt;/strong&gt; and then &lt;strong&gt;Enable intrusion detection&lt;/strong&gt;. Next select the &lt;strong&gt;Enable intrusion detection&lt;/strong&gt; checkbox. This will activate the Fail2Ban service.&lt;/p&gt;
&lt;p&gt;The settings page for Fail2Ban allows us to set the &lt;strong&gt;IP address ban period&lt;/strong&gt;, &lt;strong&gt;Time interval for detection of subsequent attacks&lt;/strong&gt; and the &lt;strong&gt;Number of failures before the IP address is banned&lt;/strong&gt;. The &lt;strong&gt;IP address ban period&lt;/strong&gt;, is the time after which a banned IP address is automatically unbanned.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Time interval for detection of subsequent attacks&lt;/strong&gt; is the time interval during which the number of unwanted actions from an IP address are counted. The &lt;strong&gt;Number of failures before the IP address is banned&lt;/strong&gt; is the number of unwanted actions after which the IP address is banned&lt;/p&gt;
&lt;p&gt;The Plesk Fail2Ban component is based on the concept on Jails. A Jail is a set of rules covering an individual scenario for example SSH. A Jail is a combination of a filter and one or more actions. A filter is a regular expression that is applied to log files in order to determine suspicious activity.&lt;/p&gt;
&lt;p&gt;Actions are commands that are executed when the filter catches a suspicious IP address. A jail can have a status of active or inactive. An inactive jail does not ban IP addresses. There are pre-configured jails for all Plesk services such as web server, ftp server etc. Jails can be managed from the Jails tab.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Banned IP Addresses&lt;/strong&gt; tab shows the list of IP addresses that have been banned by the Fail2Ban Jails. It allows un-banning IP addresses or marking them as trusted. The &lt;strong&gt;Trusted IP Addresses&lt;/strong&gt; tab shows the list of IP addresses that will not be banned.&lt;/p&gt;
&lt;h4 id=&quot;modsecurity&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#modsecurity&quot; aria-label=&quot;modsecurity permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ModSecurity&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/ModSecurity&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ModSecurity&lt;/a&gt; is an open source cross platform Web Application Firewall. It checks all requests to the web server and responses from the web server against a set of rules.&lt;/p&gt;
&lt;p&gt;If the check passes, the request is allowed. If it fails predefined action is taken. ModSecurity can be deployed either as a web server module or as a proxy server to a web server. It supports the major web servers which are Microsoft IIS, Apache and Nginx.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.plesk.com/en-US/onyx/administrator-guide/server-administration/web-application-firewall-modsecurity.73383/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The Web Application Firewall (ModSecurity)&lt;/a&gt; for Plesk is available as a Plesk component. Once it has been installed, it needs to be enabled by going to &lt;strong&gt;Tools &amp;#x26; Settings&lt;/strong&gt;, then &lt;strong&gt;Web Application Firewall (ModSecurity)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next set the &lt;strong&gt;Web application firewall mode&lt;/strong&gt; to &lt;strong&gt;On&lt;/strong&gt;. This will cause the Plesk ModSecurity to match each incoming request and its response against a set of rules. If the check succeeds, the request is allowed.&lt;/p&gt;
&lt;p&gt;If it fails, the action is logged, a notification email is sent and the HTTP response is provided with an error status code. The Plesk ModSecurity mode can also be set to &lt;strong&gt;Off&lt;/strong&gt; or to &lt;strong&gt;Detection only&lt;/strong&gt;. When in detection mode, the action taken in case of failure is to simply log the request.&lt;/p&gt;
&lt;p&gt;ModSecurity for Plesk uses the &lt;strong&gt;Atomic Basic ModSecurity&lt;/strong&gt; rule set as the default set of rules for matching requests and responses. This can be changed to other rule sets such as &lt;strong&gt;OWASP ModSecurity&lt;/strong&gt;, &lt;strong&gt;Advanced ModSecurity Rules by Atomicorp&lt;/strong&gt;, &lt;strong&gt;Comodo ModSecurity&lt;/strong&gt; or a custom rule set. Some of the rule sets require a subscription and are more strict and suitable for certain cases. The rule sets can be configured to update daily, weekly or monthly.&lt;/p&gt;
&lt;p&gt;The rule sets can be configured to apply to the HTTP URI and parts of the HTTP header, the HTTP URI, header and HTTP POST request payload or the entire HTTP traffic including the HTTP response.&lt;/p&gt;
&lt;p&gt;The ModSecurity audit log contains events logged by the ModSecurity. For example suspicious HTTP requests that fail to pass a rule. A security rule may be switched off, by entering the &lt;strong&gt;Security Rule ID&lt;/strong&gt;, &lt;strong&gt;Tag&lt;/strong&gt; or &lt;strong&gt;Regular Expression&lt;/strong&gt;. This might be useful in case a HTTP request was incorrectly blocked. ModSecurity may be configured server wide for all domains, or for each domain.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Server security is an important task carried out by system administrators. Online applications are increasing in popularity. It is important that the servers that deliver these applications are properly secured.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Viewing package information using yum history command]]></title><description><![CDATA[The yum history command displays list of all commands used to install or remove packages using yum package manager. The list is ordered by date and id. Each history item is called a transaction.]]></description><link>https://pakjiddat.netlify.app//posts/viewing-package-information-using-yum-history-command</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/viewing-package-information-using-yum-history-command</guid><pubDate>Fri, 19 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The yum history command displays list of all commands used to install or remove packages using yum package manager. The list is ordered by date and id. Each history item is called a transaction.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To view details about a transaction enter the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; info transaction_id&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where transaction_id is a number such as &lt;strong&gt;15&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To view information about a certain package such as &lt;strong&gt;httpd&lt;/strong&gt;, enter the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; info httpd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;To view information about an entire package or list of packages for example &lt;strong&gt;httpd&lt;/strong&gt;, use the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; package-list httpd or yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; package-info httpd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;To undo changes made by a transaction, enter the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; undo transaction_id&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;To redo or reapply changes made by a transaction, enter the command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; redo transaction_id

* To rollback or reverse changes made upto a certain transaction, enter the command:
```bash
yum &lt;span class=&quot;token function&quot;&gt;history&lt;/span&gt; rollback transaction_id&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://www.tecmint.com/view-yum-history-to-find-packages-info/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to Use ‘Yum History’ to Find Out Installed or Removed Packages Info&lt;/a&gt; for more information on viewing package information using yum.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Lets Encrypt SSL Certificates on Debian Jessie and Nginx]]></title><description><![CDATA[HTTPS Certificates are files that are used to secure websites. A website that is secured using HTTPS is accessed using the HTTPS protocol. For example https://www.google.com. HTTPS certificates are issued by a Certificate Authority (CA). Lets Encrypt is a CA that issues HTTPS certificates free of cost.]]></description><link>https://pakjiddat.netlify.app//posts/installing-lets-encrypt-ssl-certificates-on-debian-jessie-and-nginx</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-lets-encrypt-ssl-certificates-on-debian-jessie-and-nginx</guid><pubDate>Sun, 14 Oct 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;HTTPS Certificates are files that are used to secure websites. A website that is secured using HTTPS is accessed using the HTTPS protocol. For example &lt;a href=&quot;https://www.google.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.google.com&lt;/a&gt;. HTTPS certificates are issued by a Certificate Authority (CA). &lt;a href=&quot;https://letsencrypt.org/getting-started/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Lets Encrypt&lt;/a&gt; is a CA that issues HTTPS certificates free of cost.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;To install a certificate from Lets Encrypt, we need to prove that we have control over the domain that needs to be secured. We can do this using an ACME (Automatic Certificate Management Environment) Protocol client. &lt;a href=&quot;https://ietf-wg-acme.github.io/acme/draft-ietf-acme-acme.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ACME Protocol&lt;/a&gt; is a protocol that allows automating Certificate Management Environments. Lets Encrypt provides several ACME clients. Certbot is the recommended ACME client which can be used to obtain HTTPS certificates from Lets Encrypt.&lt;/p&gt;
&lt;p&gt;Certbot is packaged with Debian Jessie and can be obtained using the back-port repositories. To install Certbot on Debian Jessie, we can use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; certbot &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; jessie-backports&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install the Certbot client. To obtain a SSL certificate using Certbot, we need to enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; certbot certonly&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will allow us to interactively select the plugin and specify options that will be used to download the HTTPS certificate files. The webroot plugin is a simple plugin that downloads certificate files to the &lt;strong&gt;/etc/letsencrypt&lt;/strong&gt; folder.&lt;/p&gt;
&lt;p&gt;The webroot plugin can be used to obtain several certificates at a time. The plugin downloads verification files to the user specified folder. These files should be accessible over the internet. The Certbot server checks the presence of the files and then issues the requested certificates files. The files are saved to the &lt;strong&gt;/etc/letsencrypt&lt;/strong&gt; folder. This folder contains several sub folders. The renew sub folder contains information used for renewing the certificate files. The live sub folder contains the certificate files used by the web server. It contains one sub folder for each domain.&lt;/p&gt;
&lt;h3 id=&quot;certificate-renewal&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#certificate-renewal&quot; aria-label=&quot;certificate renewal permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Certificate Renewal&lt;/h3&gt;
&lt;p&gt;The certificates issued by Lets Encrypt are only valid for 90 days. After 90 days, the certificates must be renewed. Renewal of the certificates is very simple and simply requires the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; certbot renew&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will renew all certificates that were issued to the Certbot. The command can be run daily from cron. The Lets Encrypt &lt;a href=&quot;https://certbot.eff.org/#debianjessie-nginx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation guide&lt;/a&gt; describes the process of installing HTTPS certificate files using Certbot. The &lt;a href=&quot;https://certbot.eff.org/docs/using.html#&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;user guide&lt;/a&gt; describes the Certbot command line options in detail.&lt;/p&gt;
&lt;h3 id=&quot;certificate-removal&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#certificate-removal&quot; aria-label=&quot;certificate removal permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Certificate Removal&lt;/h3&gt;
&lt;p&gt;To remove a LetsEncrypt SSL certificate we can issue the command: &lt;strong&gt;certbot delete&lt;/strong&gt;. It will display list of installed certificates, with option for deleting a certificate. When a certificate has been deleted, all the certificate related files are removed.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Lets Encrypt is an excellent service that allows securing websites free of cost. Their service is reliable and easy to use. It is also well documented and well supported.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating scalable applications with Ionic Framework and Firebase]]></title><description><![CDATA[The Ionic Framework allows developing applications for web browsers, desktops and mobile devices. Ionic Framework applications are written in HTML, CSS and JavaScript. Apps can be generated from a single code base, which can be accessed from web browsers, Android, IOS and Windows based devices.]]></description><link>https://pakjiddat.netlify.app//posts/creating-scalable-applications-with-ionic-framework-and-firebase</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-scalable-applications-with-ionic-framework-and-firebase</guid><pubDate>Tue, 25 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://ionicframework.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ionic Framework&lt;/a&gt; allows developing applications for web browsers, desktops and mobile devices. Ionic Framework applications are written in HTML, CSS and JavaScript. Apps can be generated from a single code base, which can be accessed from web browsers, Android, IOS and Windows based devices.&lt;/p&gt;
&lt;p&gt;The Ionic Framework essentially is a front-end framework. The back-end for the apps can be implemented using &lt;a href=&quot;https://firebase.google.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Firebase&lt;/a&gt; or a server side programming language. The &lt;a href=&quot;https://beta.ionicframework.com/docs/intro/concepts&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;core concepts&lt;/a&gt; of the Ionic Framework describe how the framework works.&lt;/p&gt;
&lt;h3 id=&quot;difference-between-native-hybrid-and-mobile-apps&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#difference-between-native-hybrid-and-mobile-apps&quot; aria-label=&quot;difference between native hybrid and mobile apps permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Difference between native, hybrid and mobile apps&lt;/h3&gt;
&lt;p&gt;The current version of the Ionic Framework, which is &lt;a href=&quot;https://beta.ionicframework.com/docs/intro&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;version 4 Beta&lt;/a&gt; supports several JavaScript frameworks in addition to AngularJs, such as ReactJs and Vue.&lt;/p&gt;
&lt;p&gt;It essentially does not depend on any particular framework. It also uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Apache_Cordova&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Cordova&lt;/a&gt; for generating hybrid apps from a JavaScript, HTML and CSS code base. Hybrid apps may be regarded as a hybrid between native apps and mobile apps.&lt;/p&gt;
&lt;p&gt;Native apps are written in platform specific programming language such as Objective-C for IOS and Java for Android. Native apps have direct access to operating system libraries and tend to have better performance than hybrid and mobile apps.&lt;/p&gt;
&lt;p&gt;Mobile apps are websites that are optimized for viewing on mobile devices. Hybrid apps on the other hand are written in platform independent JavaScript, HTML and CSS. Hybrid apps run inside a container called a Web View and have access by means of an Application Programming Interface (API) to device features such as camera, GPS, address book etc.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The Ionic Framework is a plugin for Node Js. It can be installed with the command: &lt;strong&gt;npm install -g ionic&lt;/strong&gt;. The &lt;strong&gt;-g&lt;/strong&gt; flag installs the package globally for all users. To enable support for developing hybrid apps, the Cordova NPM package needs to be installed with the command: &lt;strong&gt;npm install -g cordova&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://ionicframework.com/docs&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ionic Framework documentation&lt;/a&gt; describes how to get started with the Ionic Framework. To create an Ionic application, we need to enter the command: &lt;strong&gt;ionic start MyApp blank&lt;/strong&gt;. This will create a new Ionic application in the current folder with the blank template. Supported templates are super, tutorial, blank, tabs and sidemenu.&lt;/p&gt;
&lt;h3 id=&quot;running-ionic-applications&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-ionic-applications&quot; aria-label=&quot;running ionic applications permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running Ionic Applications&lt;/h3&gt;
&lt;p&gt;The Ionic command line interface (CLI) has several options that can be viewed with: &lt;strong&gt;ionic help&lt;/strong&gt;. To run the new app from a browser simply enter the command: &lt;strong&gt;ionic serve&lt;/strong&gt;. This will start a web server that listens on port 8100. The command actually performs build tasks such as running Web Pack, trans-piling Type Script to JavaScript and converting SASS files to CSS.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Webpack&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Web Pack&lt;/a&gt; is used to bundle JavaScript files for use in browsers. &lt;a href=&quot;https://en.wikipedia.org/wiki/Sass_(stylesheet_language)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Syntactically awesome style-sheets (SASS)&lt;/a&gt; is a script language that is compiled to Cascading Style Sheet (CSS). Ionic framework applications usually use SASS files for styling pages and Type Script for the front end programming. Converting code from one programming language to another is called trans-piling. For example converting Type Script to JavaScript.&lt;/p&gt;
&lt;p&gt;If you have a production ready app then you may want to run it so the app uses compressed CSS and JavaScript and runs quickly. The following command line minifies the CSS and JavaScript files used by the app. It also disables live reloading of the app and causes the web server to run at port 9100. Live reloading allows an app to be modified without restarting the web server.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;--mifyjs --minifycss --optimizejs --no-livereload --port=9100&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;folder-structure-of-an-ionic-app&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#folder-structure-of-an-ionic-app&quot; aria-label=&quot;folder structure of an ionic app permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Folder structure of an Ionic App&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;./src&lt;/strong&gt; folder contains the source code for our application. It has a file &lt;strong&gt;index.html&lt;/strong&gt; which is the main entry point for our app. We do not need to edit this file. The files we need to edit are the Type Script files that end with &lt;strong&gt;“.ts”&lt;/strong&gt;. For example the file:&lt;strong&gt;src/app/app.module.ts&lt;/strong&gt; is the entry point for the app. This file defines the root module which controls the application. The following example code defines the root module:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;@&lt;span class=&quot;token function&quot;&gt;NgModule&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token literal-property property&quot;&gt;declarations&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;MyApp&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; HelloIonicPage&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ItemDetailsPage&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ListPage&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token literal-property property&quot;&gt;imports&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;BrowserModule&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; IonicModule&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forRoot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MyApp&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token literal-property property&quot;&gt;bootstrap&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;IonicApp&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token literal-property property&quot;&gt;entryComponents&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;MyApp&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; HelloIonicPage&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ItemDetailsPage&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ListPage&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;token literal-property property&quot;&gt;providers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;AppModule&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The file &lt;strong&gt;./src/app/app.component.ts&lt;/strong&gt; declares the root module and the HTML template where the root module will be rendered.&lt;/p&gt;
&lt;p&gt;When we run &lt;strong&gt;ionic serve&lt;/strong&gt;, it creates a www directory containing the trans-piled JavaScript and CSS files. The contents of the www directory are served while the app is running.&lt;/p&gt;
&lt;h3 id=&quot;firebase&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#firebase&quot; aria-label=&quot;firebase permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Firebase&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://firebase.google.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Firebase&lt;/a&gt; is a platform provided by Google, which allows scaling apps to billions of users. It essentially provides a set of services for developing the back-end of mobile apps. It supports major mobile platforms: Android, IOS, Web as well as the Unity and C++ platforms.&lt;/p&gt;
&lt;p&gt;Firebase provides the following services:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://firebase.google.com/products/firestore/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cloud Firestore&lt;/a&gt;&lt;/strong&gt;. Provides a NoSQL database for storing data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://firebase.google.com/products/ml-kit/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ML Kit&lt;/a&gt;&lt;/strong&gt;. Provides APIs for common Machine Learning (ML) related tasks such as recognizing text, detecting faces, scanning barcodes, labeling images and recognizing landmarks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://firebase.google.com/products/functions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cloud Functions&lt;/a&gt;&lt;/strong&gt;. Allows code to be executed in response to events such as new user signup, conversion related events in analytics, changes to data in real time database etc. The user specifies the code to execute in response to events. The code is run as single purpose JavaScript functions in a secure Node Js environment. The user does not have to bother with server provisioning&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://firebase.google.com/products/auth/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Authentication&lt;/a&gt;&lt;/strong&gt;. Firebase Authentication allows easily building secure authentication systems. It provides a flexible Drop-In user interface for adding authentication related features. It supports authentication providers such as email/password, Google, Twitter, Facebook, GitHub, Phone Auth and more.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Firebase provides several other services such as &lt;strong&gt;Hosting, Cloud Storage, Realtime Database, Crashlytics, Performance Monitoring, Test Lab, In-App Messaging, Google Analytics, Predictions, A/B Testing, Cloud Messaging, Remote Config, Dynamic Links and App Indexing&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The Ionic Framework is a useful platform for building cross platform applications. Combined with Firebase, it allows developing scalable apps easily and quickly.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Increasing web server timeout]]></title><description><![CDATA[If your website is based on PHP and is being served by Apache web server with Nginx as reverse proxy, then you may have experienced 504 Gateway Timeout errors. The error usually happens because some PHP script takes longer than usual to run.]]></description><link>https://pakjiddat.netlify.app//posts/increasing-web-server-timeout</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/increasing-web-server-timeout</guid><pubDate>Tue, 25 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If your website is based on PHP and is being served by Apache web server with Nginx as reverse proxy, then you may have experienced 504 Gateway Timeout errors. The error usually happens because some PHP script takes longer than usual to run. If you want to allow the PHP script to run for more than the default time of 30 seconds, then you have to make some changes to the Php.ini configuration and the nginx.conf and Nginx virtual host configuration.&lt;/p&gt;
&lt;p&gt;To increase timeout of PHP scripts, we need to increase the &lt;strong&gt;max_execution_time&lt;/strong&gt; settings in php.ini. The default value is 30 seconds. The changes will take affect after the Apache web server has been restarted&lt;/p&gt;
&lt;p&gt;The timeout also has to be configured on the Nginx reverse proxy. It requires disabling the keepalive probes sent by Nginx to Apache. This can be done by adding the ”&lt;strong&gt;Connection: ”&lt;/strong&gt; HTTP header with empty value. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;proxy_set_header Connection &quot;&quot;;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This needs to be set under the &lt;strong&gt;location&lt;/strong&gt; block of the virtual host file located under &lt;strong&gt;/etc/nginx/sites-available&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The fastcgi read timeout and proxy read timeout settings also need to be increased in the Nginx configuration. If you are trying to upload large files, then you need to increase the client_max_body_size setting. This can be done by adding the following:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;fastcgi_read_timeout 600;
proxy_read_timeout 600;
client_max_body_size 20M;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to &lt;strong&gt;/etc/nginx/nginx.conf&lt;/strong&gt;. After making the changes, nginx needs to be restarted.&lt;/p&gt;
&lt;p&gt;See the discussion &lt;a href=&quot;https://stackoverflow.com/questions/24453388/nginx-reverse-proxy-causing-504-gateway-timeout&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Nginx reverse proxy causing 504 Gateway Timeout&lt;/a&gt; for more information on how to increase web server timeout&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Publishing websites using Jekyll]]></title><description><![CDATA[Jekyll is a static site generator. It generates static HTML pages from content written in Mark Down or HTML. Its different from other website publishing tools in that it does not use a database.]]></description><link>https://pakjiddat.netlify.app//posts/publishing-websites-using-jekyll</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/publishing-websites-using-jekyll</guid><pubDate>Fri, 07 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Jekyll is a static site generator. It generates static html pages from content written in &lt;a href=&quot;https://en.wikipedia.org/wiki/Markdown&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mark Down&lt;/a&gt; or HTML. Its different from other website publishing tools in that it does not use a database.&lt;/p&gt;
&lt;p&gt;The user writes his content in text files using HTML or Mark Down. Jekyll converts these files to html. The benefit of this approach is that it avoids the security and performance related problems of database driven websites. In this article I will describe my experience with installing &lt;a href=&quot;https://dna.crisp.se/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Crisp DNA”&lt;/a&gt;, a website based on Jekyll.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Jekyll is based on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ruby_(programming_language)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Ruby programming language&lt;/a&gt;. It is actually distributed as a Ruby Gem, which means it can be installed easily using the &lt;strong&gt;gem install&lt;/strong&gt; command.&lt;/p&gt;
&lt;h4 id=&quot;installing-ruby&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-ruby&quot; aria-label=&quot;installing ruby permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Ruby&lt;/h4&gt;
&lt;p&gt;Ruby is an interpreted language with a focus on simplicity and productivity. It is similar to the Python language, but unlike Python is used mainly for developing websites. Ruby may be installed using the Ruby Version Manager (RVM). RVM allows installing multiple version of Ruby each with its own set of Ruby Gems.&lt;/p&gt;
&lt;p&gt;To install &lt;a href=&quot;https://rvm.io/rvm/install&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RVM&lt;/a&gt;, we need to first install the package signing keys using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gpg &lt;span class=&quot;token parameter variable&quot;&gt;--keyserver&lt;/span&gt; hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to install RVM using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-sSL&lt;/span&gt; https://get.rvm.io &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once RVM has been installed, we can use it to install Ruby. For example to list all the available versions of Ruby we can use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;rvm list known&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To install a specific version of ruby, for example version 2.5.1, we can use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;rvm &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; ruby-2.5.1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;installing-crisp-dna&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-crisp-dna&quot; aria-label=&quot;installing crisp dna permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Crisp DNA&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://dna.crisp.se/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Crisp DNA&lt;/a&gt; is a consulting company. It has released the source code of its website on Git Hub under the Creative Commons License. The website of Crisp DNA is based on Jekyll. The website provides a detailed description on how the Crisp DNA company works. The website text is provided in the form of Mark Down files.&lt;/p&gt;
&lt;p&gt;To install the website locally, we first need to download the website from Git Hub. Next we need to install the packages that are required to run the website.&lt;/p&gt;
&lt;p&gt;We can do this with the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gem &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; bundle&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;bundle &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;jekyll serve&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;from the root folder of the website. Alternately, we may run the &lt;strong&gt;./run&lt;/strong&gt; script which is provided with the website. This will start the Jekyll server on the localhost port 4000.&lt;/p&gt;
&lt;h3 id=&quot;structure-of-a-jekyll-website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#structure-of-a-jekyll-website&quot; aria-label=&quot;structure of a jekyll website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Structure of a Jekyll website&lt;/h3&gt;
&lt;p&gt;The installation and configuration of Jekyll is well documented on the &lt;a href=&quot;https://jekyllrb.com/docs/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jekyll quick start quide&lt;/a&gt;. A website based on Jekyll has the following main components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;_config.yml&lt;/strong&gt;. This is a configuration file for the website. It supports many options. Some of the useful settings are the &lt;strong&gt;host, port and baseurl&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;_includes&lt;/strong&gt;. This a folder that contains include files such as header, footer, sidebar etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;_layouts&lt;/strong&gt;. This a folder that contains the layout files for the website. A layout file is a base file which contains sections such as header, footer, main content, sidebar etc. A website may have several layout files.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;posts&lt;/strong&gt;. This is a folder that contains files with user content. The content may be formatted using HTML or Mark Down. Mark Down is a light weight markup language which is easy to use. A collection is a group of related files. The posts collection is a default collection. The user may create his own collections, which should be listed in the _config.yml file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;_site&lt;/strong&gt;. This folder contains the static HTML files. These files are auto generated by Jekyll. One of the useful features of Jekyll is that user content may be modified while Jekyll is running. The Jekyll server does not have to be restarted each time a file needs to be changed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A new Jekyll website may be created with the command: &lt;strong&gt;jekyll new website_name&lt;/strong&gt;. This command will create the default folder structure. The &lt;a href=&quot;https://jekyllrb.com/docs/structure/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;folder structure&lt;/a&gt; is well documented on the Jekyll website.&lt;/p&gt;
&lt;p&gt;Since Jekyll version 3.2, a default theme called &lt;a href=&quot;https://github.com/jekyll/minima&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;minima&lt;/a&gt; is provided which provides a default theme for new websites. To use this theme we need to add the lines:&lt;strong&gt;gem “minima”&lt;/strong&gt; to the Gemfile of the website and the line &lt;strong&gt;theme: minima&lt;/strong&gt; to the _config.yml file.&lt;/p&gt;
&lt;h3 id=&quot;jekyll-admin&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jekyll-admin&quot; aria-label=&quot;jekyll admin permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jekyll Admin&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/jekyll/jekyll-admin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jekyll Admin&lt;/a&gt; is a useful web based tool that allows editing Jekyll website files. The Jekyll Admin is a Ruby Gem. To install the Jekyll Admin, we just need to add the lines:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gem &lt;span class=&quot;token string&quot;&gt;&apos;jekyll-admin&apos;&lt;/span&gt;, group: :jekyll_plugins&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to the Gemfile used by the Jekyll website. Next we need to start the Jekyll server. The Jekyll Admin should then be accessible on the URL: &lt;strong&gt;&lt;a href=&quot;http://localhost:4000/admin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:4000/admin&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;jekyll-plugins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jekyll-plugins&quot; aria-label=&quot;jekyll plugins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jekyll Plugins&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://jekyllrb.com/docs/plugins/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The Jekyll plugin system&lt;/a&gt; allows us to add functionality to a Jekyll website without having to edit the Jekyll source code.&lt;/p&gt;
&lt;p&gt;The plugins can be grouped as Generators, Converters, Commands, Tags, Filters and Hooks. For example the &lt;a href=&quot;https://github.com/jekyll/jekyll-seo-tag&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jekyll SEO Tag&lt;/a&gt; plugin allows us to perform Search Engine Optimization (SEO) related tasks on our website.&lt;/p&gt;
&lt;p&gt;Jekyll also provides import tools for transferring content from popular content management platforms such as WordPress, Blogger, Drupal etc to Jekyll.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Jekyll provides a unique approach to serving website content. It is a popular tool supported by a large open source community.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Getting /etc/rc.local file to work on Debian 9 (Stretch)]]></title><description><![CDATA[Debian Stretch uses the rc.local service for executing commands on system startup. To use this service we need to run the following commands:]]></description><link>https://pakjiddat.netlify.app//posts/getting--etc-rc-local-file-to-work-on-debian-9--stretch-</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/getting--etc-rc-local-file-to-work-on-debian-9--stretch-</guid><pubDate>Wed, 05 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Debian Stretch uses the rc.local service for executing commands on system startup. To use this service we need to run the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the /etc/systemd/system/rc-local.service does not exist, then it should be created with following contents:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Give executable permissions to the /etc/systemd/system/rc-local.service file&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt; +x /etc/systemd/system/rc-local.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Gve executable permissions to the /etc/rc.local file&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Enable the rc-local service to start on boot&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; systemctl &lt;span class=&quot;token builtin class-name&quot;&gt;enable&lt;/span&gt; rc-local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Start the rc-local service&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; systemctl start rc-local.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Check the status of the rc-local service&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; systemctl status rc-local.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;If the rc.local file does not exit, then create it with the following contents:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will &quot;exit 0&quot; on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the discussion &lt;a href=&quot;https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to Enable /etc/rc.local with Systemd&lt;/a&gt; for more information on getting /etc/rc.local to work on Debian 9&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Making HTTP POST requests from Google Chrome]]></title><description><![CDATA[The Google Chrome developers toolbox is a useful tool that can be used to test HTTP POST requests. For example we may want to replay HTTP requests for testing APIS or debugging web pages.]]></description><link>https://pakjiddat.netlify.app//posts/making-http-post-requests-from-google-chrome</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/making-http-post-requests-from-google-chrome</guid><pubDate>Tue, 14 Aug 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The Google Chrome developers toolbox is a useful tool that can be used to test HTTP POST requests. For example we may want to replay HTTP requests for testing APIS or debugging web pages.&lt;/p&gt;
&lt;p&gt;To replay a HTTP GET or POST request in Google Chrome, we need to open the Chrome developers toolbox and then under the network panel right click on the URL to replay. It will give us the option to copy the request as a &lt;strong&gt;CURL command&lt;/strong&gt; or simply replay the request.&lt;/p&gt;
&lt;p&gt;If your URL request is over HTTPS, then your CURL command may give errors related to untrusted SSL certificates. The solution is to append the —insecure option to the CURL command.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://developers.google.com/web/tools/chrome-devtools/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;official Chrome Developers Tool&lt;/a&gt; documentation for more information about making HTTP POST requests.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using substr_compare function to find out if a file exists in a folder]]></title><description><![CDATA[The substr_compare function is a useful function that can be used to check if a given string occurs at the end of a larger string.]]></description><link>https://pakjiddat.netlify.app//posts/using-substr-compare-function-to-find-out-if-a-file-exists-in-a-folder</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-substr-compare-function-to-find-out-if-a-file-exists-in-a-folder</guid><pubDate>Sat, 04 Aug 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The &lt;a href=&quot;http://php.net/manual/en/function.substr-compare.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;substr_compare&lt;/a&gt; function is a useful function that can be used to check if a given string occurs at the end of a larger string.&lt;/p&gt;
&lt;p&gt;We can use the &lt;strong&gt;substr_compare&lt;/strong&gt; function to check if a given file name segment occurs at the end of a given path. It can be used to implement a function that checks recursively if a file segment is present in a folder&lt;/p&gt;
&lt;p&gt;The offset argument of the substr_compare function is set to the length of the file to search multiplied by -1. The length parameter is set to the length of the file name segment to be searched. The following code can be used. It checks if a string occurs at the end of a given string:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The file name segment is prefixed with &apos;/&apos; */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;         &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;/&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ltrim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The length of the file name */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$file_name_length&lt;/span&gt;  &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The offset at which to start the comparison. It is negative, so it is taken to be from the end of the string */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$offset&lt;/span&gt;            &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$file_name_length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;   
&lt;span class=&quot;token comment&quot;&gt;/** If the file name segment occurs at the end of the item path */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substr_compare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$item_path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$offset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$file_name_length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** The function returns true */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The function returns false */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Another option is to simply split the string into two parts using explode function and then check if the second array element matches the file name segment. The following code may be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** The larger string is split on the file name */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$path_segments&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$item_path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** If the second array element matches the file name, then the function returns true */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$path_segments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Installing latest version of Php]]></title><description><![CDATA[PHP is a popular programming language commonly used for building web based applications. Most Linux distributions provide PHP out of the box. However the version of PHP in most cases is not the current stable version.]]></description><link>https://pakjiddat.netlify.app//posts/installing-latest-version-of-php</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-latest-version-of-php</guid><pubDate>Thu, 28 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;PHP is a popular programming language commonly used for building web based applications. Most Linux distributions provide PHP out of the box. However the version of PHP in most cases is not the current stable version.&lt;/p&gt;
&lt;p&gt;To install the latest stable version of PHP, we need to use a third part package repository such as &lt;a href=&quot;https://deb.sury.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;deb.sury.org/&lt;/a&gt;. To use this repository we need to follow the instructions given on: &lt;a href=&quot;https://packages.sury.org/php/README.txt&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://packages.sury.org/php/README.txt&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After that we can install the latest version of PHP. For example to install PHP 7.2, we need to issue the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; php7.2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To revert to the version of PHP provided by the operating system, we need to remove the file: &lt;strong&gt;/etc/apt/sources.list.d/php.list&lt;/strong&gt;. We also need to remove the package singing key for deb.sury. Next we need to run the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; remove php7.2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to install the PHP package using:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; php&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install the version of PHP that is provided by the operating system&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Preventing spam messages with Contact Form 7 WordPress plugin]]></title><description><![CDATA[Contact Form 7 is a plugin for WordPress that allows website visitors to contact website owners. It is one of the most popular WordPress plugins with over 5 million active installations.]]></description><link>https://pakjiddat.netlify.app//posts/preventing-spam-messages-with-contact-form-7-wordpress-plugin</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/preventing-spam-messages-with-contact-form-7-wordpress-plugin</guid><pubDate>Thu, 28 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Contact Form 7 is a plugin for WordPress that allows website visitors to contact website owners. It is one of the most popular WordPress plugins with over 5 million active installations.&lt;/p&gt;
&lt;p&gt;Different methods can be used to prevent spam messages from being sent through Contact 7 Forms. We need to first think about how spam is sent though the Contact 7 forms.&lt;/p&gt;
&lt;p&gt;Spam may be sent by an automated script or bot. This type of spam can be stopped using captcha. Fortunately Contact Form 7 has built in support for captcha. It allows users to easily insert captcha in forms.&lt;/p&gt;
&lt;p&gt;Another source of spam is human visitors that send junk email for different reasons. This type of spam may be stopped with the akismet configuration that is provided by Contact Form 7.&lt;/p&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://barn2.co.uk/stop-contact-form-7-spam/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;6 Ways to Stop Contact Form 7 Spam in WordPress – Updated for 2018&lt;/a&gt; for more information on how to prevent spam messages with Contact Form 7.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Upgrading R from version 3.0 to 3.5]]></title><description><![CDATA[R is a free software package for statistical computing. It is part of most Linux distributions. However the latest version of R is not always available. To install the latest version of R we need to add the URL of a CRAN mirror to a file in /etc/apt/sources.list.d.]]></description><link>https://pakjiddat.netlify.app//posts/upgrading-r-from-version-3-0-to-3-5</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/upgrading-r-from-version-3-0-to-3-5</guid><pubDate>Thu, 28 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;R is a free software package for statistical computing. It is part of most Linux distributions. However the latest version of R is not always available. To install the latest version of R we need to add the URL of a CRAN mirror to a file in &lt;strong&gt;/etc/apt/sources.list.d&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;CRAN is a network of ftp and web servers that provide upto date information on R such as documentation, source code and news about R development. To install R, we need to issue the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; r-base r-base-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To update R to a newer version we need to replace the CRAN URL in &lt;strong&gt;/etc/apt/sources.list.d&lt;/strong&gt;, with a URL that points to the newer version of R. After that we need to issue the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; upgrade&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since the new CRAN URL requires different package signing keys, we will get an error similar to: &lt;strong&gt;“following signatures couldn’t be verified because the public key is not available: NO_PUBKEY”&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The solution is to import the package signing keys for the new R package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; apt-key adv &lt;span class=&quot;token parameter variable&quot;&gt;--keyserver&lt;/span&gt; keyserver.ubuntu.com --recv-keys &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;key_name&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where key_name is the short signature of the missing key as indicated in the error message. After that the &lt;strong&gt;apt-get upgrade&lt;/strong&gt; command should work without problems.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://cran.r-project.org/bin/linux/debian/#secure-apt&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;R official documentation&lt;/a&gt; for more information.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Upgrading MySQL server from version 5.6 to 8.0]]></title><description><![CDATA[The latest version of MySQL server currently is 8.03. To upgrade MySQL server from a previous version we need to ensure that we are upgrading from the last stable release. For example from version 5.7 to 8.0.]]></description><link>https://pakjiddat.netlify.app//posts/upgrading-mysql-server-from-version-5-6-to-8-0</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/upgrading-mysql-server-from-version-5-6-to-8-0</guid><pubDate>Thu, 28 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The latest version of MySQL server currently is 8.03. To upgrade MySQL server from a previous version we need to ensure that we are upgrading from the last stable release.&lt;/p&gt;
&lt;p&gt;For example from version 5.7 to 8.0. To upgrade from 5.6 to 8.0 we need to first upgrade from 5.6 to 5.7 and then from 5.7 to 8.0. Upgrading directly from 5.6 to 8.0, will result in errors related to incompatible SQL or &lt;a href=&quot;https://stackoverflow.com/questions/49922023/mysql-8-0-unsupported-redo-log-format&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;log file formats&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;installing-latest-version-of-mysql-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-latest-version-of-mysql-server&quot; aria-label=&quot;installing latest version of mysql server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing latest version of MySQL server&lt;/h3&gt;
&lt;p&gt;MySQL server is part of most Linux distributions. However the default version of MySQL server is usually outdated. We can install the latest version of MySQL server from the MySQL apt repository. The &lt;a href=&quot;https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MySQL online documentation&lt;/a&gt; provides detailed information on how to install and upgrade MySQL server and tools using the MySQL apt repository.&lt;/p&gt;
&lt;p&gt;To install the MySQL apt repository we need to first download the repository package from: &lt;a href=&quot;http://dev.mysql.com/downloads/repo/apt/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://dev.mysql.com/downloads/repo/apt/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Next we need to install the repository package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; dpkg &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; mysql-apt-config_w.x.y-z_all.deb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;During the installation of the package, we will be asked to choose the version of MySQL server and other tools. After the repository package has been installed we can install the MySQL server using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; mysql-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install the version of the MySQL server that we had selected during the repository package installation. To change the version of MySQL server that we have installed, we need to issue the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; dpkg-reconfigure mysql-apt-config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The version that we select here will be installed when we install the package from &lt;strong&gt;apt&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;upgrading-mysql-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#upgrading-mysql-server&quot; aria-label=&quot;upgrading mysql server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Upgrading MySQL server&lt;/h3&gt;
&lt;p&gt;As mentioned previously we should upgrade to the next stable release. For example from 5.6 to 5.7. To upgrade MySQL server we should first back up the database. We can do this by exporting the databases to SQL file using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;mysqldump &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; --all-databases &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; database_file.sql&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will export all databases to a SQL file. We may also back up the data directory located at: &lt;strong&gt;/var/lib/mysql&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next we need to remove the MySQL server using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; remove mysql-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will remove the MySQL server binaries from the system. To remove the MySQL data we need to substitute &lt;strong&gt;remove&lt;/strong&gt; with &lt;strong&gt;purge&lt;/strong&gt; in the previous command.&lt;/p&gt;
&lt;p&gt;After that we need to choose the new version of MySQL server from the MySQl apt configuration tool. We can access the tool with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; dpkg-reconfigure mysql-apt-config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to install the new version of the MySQL server with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; mysql-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;During installation we will be prompted for the root password for the MySQL server.&lt;/p&gt;
&lt;p&gt;If we had used the purge option while removing the MySQL server, then we will need to import the data back to the MySQL server. We can do this with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;mysql &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; database_file.sql&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After the installation has completed we need to upgrade the server using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;mysql_upgrade &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will upgrade the table formats to the version support by the new MySQL server.&lt;/p&gt;
&lt;h3 id=&quot;downgrading-mysql-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#downgrading-mysql-server&quot; aria-label=&quot;downgrading mysql server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Downgrading MySQL server&lt;/h3&gt;
&lt;p&gt;To downgrade MySQL server to a previous version, we need to follow the same procedure that we used for upgrading the server. The only change would be to select the older MySQL server version from the MySQL apt configuration tool.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;official MySQL documentation&lt;/a&gt; for more information.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Upgrading from Debian Jessie to Debian Stretch]]></title><description><![CDATA[Debian 9, also known as Debian Stretch is currently the latest stable version of the Debian operating system. It was released on 17th June 2017 as successor to Debian 8 also known as Debian Jessie.]]></description><link>https://pakjiddat.netlify.app//posts/upgrading-from-debian-jessie-to-debian-stretch</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/upgrading-from-debian-jessie-to-debian-stretch</guid><pubDate>Thu, 28 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Debian 9, also known as &lt;a href=&quot;https://wiki.debian.org/DebianStretch&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian Stretch&lt;/a&gt; is currently the latest stable version of the Debian operating system. It was released on 17th June 2017 as successor to Debian 8 also known as Debian Jessie.&lt;/p&gt;
&lt;p&gt;Under the &lt;a href=&quot;https://en.wikipedia.org/wiki/Debian#Release_cycle&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian release cycle&lt;/a&gt;, stable versions of the Debian operating system are released every two years. Updates are provided for a total of three years. The Debian Security Team is responsible for providing security updates for the Debian operating system. Once a release has reached its end of life, the &lt;a href=&quot;https://wiki.debian.org/LTS&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian LTS (Long Term Support) team&lt;/a&gt; takes over the job of providing security updates.&lt;/p&gt;
&lt;p&gt;Debian Jessie which was released on 26th April 2017, reached its end of life on 17th June 2018. While it is still possible to receive security updates after this period, it is recommended to upgrade to the next stable release which is Debian Stretch. Google Cloud support sent notifications to its customers asking them to upgrade to Debian Stretch as soon as possible.&lt;/p&gt;
&lt;p&gt;Debian Stretch contains numerous bug fixes as well as new updated versions of popular programming languages and servers. Upgrading to Debian Stretch is highly recommended. In this article I will describe my experience with upgrading the operating system of a server based in Google Cloud from Debian Jessie to Debian Stretch. I learned a few important lessons which should benefit system administrators.&lt;/p&gt;
&lt;h3 id=&quot;performing-the-upgrade&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#performing-the-upgrade&quot; aria-label=&quot;performing the upgrade permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Performing the upgrade&lt;/h3&gt;
&lt;p&gt;The process for upgrading from Debian Jessie to Debian Stretch is described in the &lt;a href=&quot;https://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.en.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian release notes&lt;/a&gt;. Although the upgrade guide is very detailed, the main steps are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;backup-data-and-configuration-information&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#backup-data-and-configuration-information&quot; aria-label=&quot;backup data and configuration information permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Backup data and configuration information&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should ensure that all useful data on your server is backed up before starting the upgrade.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;inform-users-in-advance-and-prepare-for-downtime-on-services&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#inform-users-in-advance-and-prepare-for-downtime-on-services&quot; aria-label=&quot;inform users in advance and prepare for downtime on services permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Inform users in advance and prepare for downtime on services&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should inform the users of your system about the downtime. Also prepare for downtime of the services running on the system, such as intranet websites.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;update-the-operating-system-packages-on-the-current-system&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#update-the-operating-system-packages-on-the-current-system&quot; aria-label=&quot;update the operating system packages on the current system permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Update the operating system packages on the current system&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This requires installing updates to packages and removing unused packages. This can be accomplished with the commands: &lt;strong&gt;apt-get update&lt;/strong&gt; followed by &lt;strong&gt;apt-get upgrade&lt;/strong&gt;. After running these two commands, all packages installed on your system through the Debian package manager will be updated to the latest version. You should also remove unused packages using the command: &lt;strong&gt;apt-get autoremove&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;update-apt-sources&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#update-apt-sources&quot; aria-label=&quot;update apt sources permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Update apt sources&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The file &lt;strong&gt;/etc/apt/sources.list&lt;/strong&gt; contains URLs of package repositories. The URLs should be updated so they point to the repositories containing Debian Stretch packages. Apt files for custom repositories which are in &lt;strong&gt;/etc/apt/sources.list.d&lt;/strong&gt; should also be updated.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;perform-minimal-system-upgrade&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#perform-minimal-system-upgrade&quot; aria-label=&quot;perform minimal system upgrade permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Perform minimal system upgrade&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This step involves installing minimum updates. This step is needed because the full upgrade process installs new version of all packages and also removes obsolete packages. It can sometimes remove useful packages.&lt;/p&gt;
&lt;p&gt;It is therefore recommended to first perform a minimal upgrade before performing the full upgrade. The minimal upgrade can be performed using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; upgrade
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; autoremove&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;perform-the-full-upgrade&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#perform-the-full-upgrade&quot; aria-label=&quot;perform the full upgrade permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Perform the full upgrade&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The full upgrade installs new versions of all packages. It also resolves dependencies between packages and may install new required packages and remove obsolete packages.&lt;/p&gt;
&lt;p&gt;The full upgrade can be done using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; dist-upgrade&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While installing new versions of packages, it may prompt the user to choose whether to overwrite existing configuration files with newer versions or to keep the current version.&lt;/p&gt;
&lt;p&gt;It may also provide an option for checking difference between new and current versions of the configuration files. After the full upgrade has completed, obsolete packages should be removed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; autoremove&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;followed by a system reboot.&lt;/p&gt;
&lt;h3 id=&quot;problems-with-updating-packages&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-with-updating-packages&quot; aria-label=&quot;problems with updating packages permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems with updating packages&lt;/h3&gt;
&lt;p&gt;The upgrade process described in the Debian documentation is easy to follow and should complete without issues. I was able to complete the operating system upgrade without problems. However I ran into issues when updating certain packages.&lt;/p&gt;
&lt;p&gt;The Debian package repository usually provides old versions of programming languages and applications which are stable and tested for Debian but are not the current stable version.&lt;/p&gt;
&lt;p&gt;The server I was upgrading had the following packages installed through custom repositories: R, PHP, MySQL and Postgresql. I thought it would be a good idea to upgrade these packages to the latest version.&lt;/p&gt;
&lt;p&gt;Unfortunately, I did not consider the possibility that the applications that depend on these packages may not work with the newer package versions.&lt;/p&gt;
&lt;p&gt;For instance the web based email management application, Mautic does not work with PHP 7.2. Also LimeSurvey does not seem to support MySQL 8.0. As a result several applications stopped working after the upgrade.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The saying: ”&lt;strong&gt;Dont fix what is not broken&lt;/strong&gt;”, is a useful reminder to system administrators. Updating packages may seem like a good idea, but its consequences should first be determined, since it can cause important applications to malfunction.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Improving WordPress Performance]]></title><description><![CDATA[Recently I had the opportunity of working on improving the performance of a WordPress website for a customer. I will describe my experience in this blog post. Slow website loading times can distract your website visitors and discourage them from visiting your website again.]]></description><link>https://pakjiddat.netlify.app//posts/improving-wordpress-performance</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/improving-wordpress-performance</guid><pubDate>Sat, 23 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of working on improving the performance of a WordPress website for a customer. I will describe my experience in this blog post. Slow website loading times can distract your website visitors and discourage them from visiting your website again.&lt;/p&gt;
&lt;p&gt;It is best to conduct a thorough performance tuning of your website &lt;strong&gt;before&lt;/strong&gt; it is launched to the public. You can create a development version of your website and test it for performance. After it has been tested you can make the website live.&lt;/p&gt;
&lt;h3 id=&quot;the-popularity-of-wordpress&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-popularity-of-wordpress&quot; aria-label=&quot;the popularity of wordpress permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The popularity of WordPress&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://wordpress.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WordPress&lt;/a&gt; is a very popular platform for hosting different types of websites. According to the article, &lt;a href=&quot;http://www.whoishostingthis.com/blog/2014/09/04/learn-to-code/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;What Code You Should Learn&lt;/a&gt;, over 19% of all websites are based on WordPress. WordPress has over 25,000 plugins and themes that perform just about any task you can expect of a website. &lt;a href=&quot;https://www.ukwebhostreview.com/blog/wordpress-statistics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;47 WordPress Statistics We Bet You Didn’t Know in 2020&lt;/a&gt; has some interesting statistics about WordPress.&lt;/p&gt;
&lt;h3 id=&quot;improving-wordpress-performance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#improving-wordpress-performance&quot; aria-label=&quot;improving wordpress performance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Improving WordPress performance&lt;/h3&gt;
&lt;p&gt;There are many factors that can slow down your WordPress website. Knowing exactly what is slowing down your website can be difficult. Fortunately there are several free on-line tools that can help you troubleshoot website performance problems.&lt;/p&gt;
&lt;h3 id=&quot;process-for-tuning-wordpress-performance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#process-for-tuning-wordpress-performance&quot; aria-label=&quot;process for tuning wordpress performance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Process for tuning WordPress performance&lt;/h3&gt;
&lt;p&gt;The process I used for tuning the performance of a WordPress website is very simple and can be described as follows. You need to run one or more on-line tools that analyze the performance of your website. These tools provide recommendations on how to improve your website. Implement these recommendations and run the tools again. Then implement the recommendations of these tools again. Continue doing this until the tool gives a good performance figure for your website.&lt;/p&gt;
&lt;h3 id=&quot;tools-for-performance-tuning&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#tools-for-performance-tuning&quot; aria-label=&quot;tools for performance tuning permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Tools for performance tuning&lt;/h3&gt;
&lt;p&gt;Some of the tools used for performance tuning are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;dotcom-monitor&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#dotcom-monitor&quot; aria-label=&quot;dotcom monitor permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.dotcom-tools.com/website-speed-test.aspx/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Dotcom monitor&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a useful service that checks your website in real web browsers in over 20 locations. It gives average load time and waterfall of your website for each location as well as an overall average loading time and waterfall for your website.&lt;/p&gt;
&lt;p&gt;A waterfall is a chart that provides detailed information about the resources on your website. For example it gives the size and loading time of each CSS, JavaScript and image file. It helps you to pinpoint the exact resource that is slowing down your website.&lt;/p&gt;
&lt;p&gt;With this tool you can also find out how much time your website takes to load for visitors from certain countries. The tool allows you to select the type of browser to be used for testing. Currently it supports Google Chrome, Firefox, Internet Explorer versions 7 and above, Iphone, Ipad, Ipod, IpadMini.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;google-webmasters-mobile-friendly-tool&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#google-webmasters-mobile-friendly-tool&quot; aria-label=&quot;google webmasters mobile friendly tool permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.google.com/webmasters/tools/mobile-friendly/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google webmasters mobile friendly tool&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a useful service that gives a measure of mobile friendliness of your website. The tool also provides reasons why your website is not mobile friendly. For example “Text is too small to read”, “Links too close together”, “Mobile view port not set”. Mobile friendliness is now an important criterion in Google search rankings. This was recently announced by Google in the article &lt;a href=&quot;http://www.webpronews.com/get-ready-for-googles-new-mobile-ranking-signal-2015-01&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Get Ready For Google’s New Mobile Ranking Signal”&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;google-pagespeed&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#google-pagespeed&quot; aria-label=&quot;google pagespeed permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://developers.google.com/speed/pagespeed/insights/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Pagespeed&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a useful service that runs Google Pagespeed tool on your website. The tool describes how your website runs on mobile devices and desktops.&lt;/p&gt;
&lt;p&gt;For mobile devices, the tool provides a score out of 100 for User Experience and Speed. It also highlights the areas in which your website is lacking and gives recommendations. The tool also gives an overall Pagespeed score out of 100 for Desktop devices.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;gtmetrix&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#gtmetrix&quot; aria-label=&quot;gtmetrix permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://gtmetrix.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GTmetrix&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a very useful service that provides a Performance Report of your website. It gives following information: Page Speed Grade, Y Slow Grade, Page load time, Total page size, Total number of requests and a Breakdown. The Breakdown gives recommendations on how to improve the page load time.&lt;/p&gt;
&lt;p&gt;It basically just gives the recommendation of the &lt;a href=&quot;https://developers.google.com/speed/pagespeed/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Page Speed tools&lt;/a&gt; and &lt;a href=&quot;http://yslow.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;YSlow&lt;/a&gt;. You can also export the performance report as PDF.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;pingdom-website-speed-test&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#pingdom-website-speed-test&quot; aria-label=&quot;pingdom website speed test permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://tools.pingdom.com/fpt/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Pingdom Website Speed Test&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is an excellent tool that gives a detailed description on the requests done to load a web page. For each request made for downloading a resource such as a CSS file, the tool gives detailed information such as time taken to load the resource including breakdown of the time taken and the size of the resource. The breakdown of the time taken includes time taken for DNS, Connect, Send, Wait and Receive and Total.&lt;/p&gt;
&lt;p&gt;The main features of the tool are a performance grade out of 100, number of requests made by the browser, page load time and page size. The tool also gives detailed information about the Waterfall, Performance grade, Page analysis and History.&lt;/p&gt;
&lt;p&gt;The level of information provided by all these tools is amazing. Although all tools provide similar information, it is good to run your website on all the tools so you get an overall measure of your website’s performance&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Ensuring good performance of your website is very important, especially if your website is the public image of a company and is visited by many visitors.&lt;/p&gt;
&lt;p&gt;Ensuring good performance of a website requires thorough research. Website performance improvement is a useful skill to learn that is well worth the effort.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Bad performance of virtio network drivers on Proxmox]]></title><description><![CDATA[This blog post is about my experience with trying to optimize network performance on a virtual machine managed by the Proxmox virtualization platform.]]></description><link>https://pakjiddat.netlify.app//posts/bad-performance-of-virtio-network-drivers-on-proxmox</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/bad-performance-of-virtio-network-drivers-on-proxmox</guid><pubDate>Sun, 20 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;This blog post is about my experience with trying to optimize network performance on a virtual machine managed by the &lt;a href=&quot;https://www.proxmox.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Proxmox virtualization platform&lt;/a&gt;. I described my experience with using Proxmox in an earlier article titled &lt;a href=&quot;/posts/proxmox---an-open-source-virtualization-platform&quot;&gt;Proxmox - An open source Virtualization Platform&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The conclusion of the article was that Proxmox is an excellent virtualization platform which supports LXC, OpenVZ and KVM virtual machines. It can be used to host a cloud platform delivering all kinds of services. Proxmox has an excellent user interface that allows managing virtual machines. Proxmox is very easy to install and administer. It also has an excellent support forum where you can get help on Proxmox related issues.&lt;/p&gt;
&lt;h3 id=&quot;problems-with-accessing-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-with-accessing-websites&quot; aria-label=&quot;problems with accessing websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems with accessing websites&lt;/h3&gt;
&lt;p&gt;The issue was that I had installed a database management script called &lt;a href=&quot;http://www.phpmyadmin.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PhpMyAdmin&lt;/a&gt; on a Proxmox KVM virtual machine. I was not able to access the script from a web browser. Finding the cause of the issue took me several days!.&lt;/p&gt;
&lt;h4 id=&quot;possible-issues&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#possible-issues&quot; aria-label=&quot;possible issues permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Possible issues&lt;/h4&gt;
&lt;p&gt;I had to consider a lot of issues. SELinux, Apache web server configuration, Gateway NAT configuration and TCP MTU settings on all the network devices. I even tested the bandwidth on the virtual machine. All those factors could have caused the issue. The most obvious cause of the issue seemed to be TCP MTU settings on a network device.&lt;/p&gt;
&lt;h4 id=&quot;problems-with-mtu&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-with-mtu&quot; aria-label=&quot;problems with mtu permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems with MTU&lt;/h4&gt;
&lt;p&gt;We had updated MTU settings on some of our servers with the hope of improving network performance. TCP MTU is the maximum size of data that can be transmitted in a single TCP/IP packet. TCP MTU is a very basic network parameter that should not be changed unless you know what you are doing. I thought that had to be the cause of the issue. I reset the MTU to default value on all the network servers, virtual machines, switch and gateway. But that did not help !. I was still getting a blank page when trying to access PhpMyAdmin from a browser.&lt;/p&gt;
&lt;p&gt;The page would take time to load and would end up blank. I ran &lt;a href=&quot;https://www.wireshark.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wireshark&lt;/a&gt; on my local computer and checked the network packets. Some of the packets were being re-transmitted so there seemed to be a problem in the network. I then tested the bandwidth on the virtual machine using &lt;a href=&quot;https://iperf.fr/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Iperf&lt;/a&gt; network performance testing tool. Iperf showed bandwidth of only 3Kbps!.&lt;/p&gt;
&lt;h4 id=&quot;solution-problems-with-virtio-network-interface-card&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#solution-problems-with-virtio-network-interface-card&quot; aria-label=&quot;solution problems with virtio network interface card permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Solution: Problems with Virtio Network Interface Card&lt;/h4&gt;
&lt;p&gt;I then decided to try my luck with changing the network interface card type from Virtio to E1000. E1000 is a stable Intel network driver. Virtio gives the virtual machine access to the local host hardware and is supposed to be much faster then E1000. In this case it proved to be the opposite. As soon as I replaced the Virtio network card with E1000 the bandwidth on the virtual machine jumped up to 5Mbps !. And guess what the PhpMyAdmin started working !.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Changing the MTU on a network can make it difficult to troubleshoot network related problems. Its best to keep the MTU at its default value. Virtio network drivers usually have excellent performance. We were using VLANs with our virtual machine so that could have been a factor. I could not find the issue mentioned on the Proxmox forums so I reported it on &lt;a href=&quot;https://bugzilla.proxmox.com/show_bug.cgi?id=583&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Proxmox Bug tracking system&lt;/a&gt;. Its a good idea to contribute to the open source community, especially if you are a big user of open source software.&lt;/p&gt;
&lt;p&gt;If you are interested in website monitoring applications, then checkout the &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.freewebsitemonitor&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Free Website Monitor App&lt;/a&gt;. It allows you to monitor the status of your websites from your phone.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Backing up and restoring LXD containers]]></title><description><![CDATA[LXD containers can be backed up by creating snapshots or by creating an image from the container. The first method which is creating snapshots is useful for taking quick incremental backups of containers. However it does not provide a full backup. The second method allows creating full backup.]]></description><link>https://pakjiddat.netlify.app//posts/backing-up-and-restoring-lxd-containers</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/backing-up-and-restoring-lxd-containers</guid><pubDate>Tue, 01 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;LXD containers can be backed up by creating snapshots or by creating an image from the container. The first method which is creating snapshots is useful for taking quick incremental backups of containers. However it does not provide a full backup. The second method allows creating full backup.&lt;/p&gt;
&lt;p&gt;To take a full backup of a container we need to run the following commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;// generates an image from the container
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc publish &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;container_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--force&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--alias&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;image_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
// saves the image as a file. the &lt;span class=&quot;token function&quot;&gt;file&lt;/span&gt; can be copied to secondary storage such as usb
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc image &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;image_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To restore the backup, we need to first manually import the image using the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc image &lt;span class=&quot;token function&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--alias&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;image-name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to launch a container from the image using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; lxc launch &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;image-name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;container-name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://discuss.linuxcontainers.org/t/how-to-properly-backup-restore-lxd-containers-with-zfs-backend/417&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to properly backup+restore LXD containers with ZFS backend?&lt;/a&gt; for more information on how to backup and restore LXD container&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Adding event listeners using JavaScript]]></title><description><![CDATA[The addEventListener function can be used to listen for events. The function can be called on any HTML DOM object such as HTML elements, HTML document, the window object or objects that support events such as xmlHttpRequest. The following example shows how to attach event listener to the window object:]]></description><link>https://pakjiddat.netlify.app//posts/adding-event-listeners-using-javascript</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/adding-event-listeners-using-javascript</guid><pubDate>Wed, 04 Apr 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The addEventListener function can be used to listen for events. The function can be called on any HTML DOM object such as HTML elements, HTML document, the window object or objects that support events such as xmlHttpRequest. The following example shows how to attach event listener to the window object:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;resize&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;demo&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; sometext&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code sets the inner HTML of the HTML element with id ‘demo’ to some text. The first parameter of the addEventListener function is the name of the event to monitor. The second argument is the handler function. An optional third argument allows specifying the event propagation method.&lt;/p&gt;
&lt;p&gt;Two event propagation methods are supported. “Bubbling” and “Capturing”. The Bubbling method implies that the events are handled from inside out. For example if a div tag contains a paragraph tag, and the paragraph tag is clicked, then the event handler for the paragraph tag will be called first and then the event handler for the div tag will be called.&lt;/p&gt;
&lt;p&gt;In the “Capturing” method of event propagation, the events are handled from the outside in. In the previous example, if we click on the paragraph tag, the event handler for the div tag will be called first, followed by the event handler for the paragraph tag.&lt;/p&gt;
&lt;p&gt;See the W3schools article &lt;a href=&quot;https://www.w3schools.com/js/js_htmldom_eventlistener.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JavaScript HTML DOM EventListener&lt;/a&gt; for more information&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating custom playlists for MediaElementPlayer]]></title><description><![CDATA[MediaElement Player is a HTML/CSS Video/Audio player for the web. It is based on MediaElement.js media framework library. Both player and library are available as open source and free of cost under the MIT license.]]></description><link>https://pakjiddat.netlify.app//posts/creating-custom-playlists-for-mediaelementplayer</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-custom-playlists-for-mediaelementplayer</guid><pubDate>Sat, 24 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mediaelement/mediaelement&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MediaElement Player&lt;/a&gt; is a HTML/CSS Video/Audio player for the web. It is based on &lt;a href=&quot;http://www.mediaelementjs.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MediaElement.js&lt;/a&gt; media framework library. Both player and library are available as open source and free of cost under the MIT license.&lt;/p&gt;
&lt;p&gt;MediaElement Player allows playing audio and video from different sources such as YouTube, SoundCloud, DailyMotion, Facebook, MP4, FLV and more. The player is easy to setup and configure.&lt;/p&gt;
&lt;p&gt;For browsers that do not support html5 or certain media codecs such as H.264, MediaElement Player provides a flash based UI. The flash based UI provides the required media codecs or the missing html5 features.&lt;/p&gt;
&lt;p&gt;MediaElement Player supports IE11+, MS Edge, Chrome, Firefox, Safari, iOS 8+ and Android 4.0+.&lt;/p&gt;
&lt;h3 id=&quot;installation-and-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation-and-configuration&quot; aria-label=&quot;installation and configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation and configuration&lt;/h3&gt;
&lt;p&gt;To install MediaElement Player, we need to first clone the &lt;a href=&quot;https://github.com/mediaelement/mediaelement&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mediaelement git repository&lt;/a&gt;. After that we need to copy the contents of the build folder to the document root.&lt;/p&gt;
&lt;p&gt;To create a sample page showing the player, we need to include following CSS file in the head section of the html page:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;stylesheet&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text/css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mediaelementplayer.min.css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We also need to include the following file just above the closing &lt;strong&gt;body&lt;/strong&gt; tag:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;script src&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;mediaelement-and-player.min.js&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;script&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next, we need to instantiate the video player using the following code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;player&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;video&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;player1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;640&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;360&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;preload&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;none&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
     &lt;span class=&quot;token special-attr&quot;&gt;&lt;span class=&quot;token attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token value css language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
     &lt;span class=&quot;token attr-name&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;poster&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;images/big_buck_bunny.jpg&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;playsinline&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;webkit-playsinline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
     &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;source&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;video/mp4&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
     &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;track&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;dist/mediaelement.vtt&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;srclang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;English&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;subtitles&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;text/vtt&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code will create a video player and load it with the a sample mp4 file with subtitles.&lt;/p&gt;
&lt;h3 id=&quot;mediaelement-player-plugins-vast-vpaid-postroll-and-google-analytics&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mediaelement-player-plugins-vast-vpaid-postroll-and-google-analytics&quot; aria-label=&quot;mediaelement player plugins vast vpaid postroll and google analytics permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MediaElement Player plugins (VAST, VPAID, Postroll and Google Analytics)&lt;/h3&gt;
&lt;p&gt;The MediaElement.js provides several &lt;a href=&quot;https://github.com/mediaelement/mediaelement-plugins&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;plugins&lt;/a&gt;. Some useful plugins include postroll, which allows displaying custom html at the end of the video and the ads plugin, which along with the vast/vpaid plugin allows displaying video ads.&lt;/p&gt;
&lt;p&gt;VAST (Video Ad Serving Template) is a specification released by the Interactive Advertising Bureu (IAB), which describes the communication standard between video players and ad servers. For example, in order to play a video ad, the video player sends a request to an ad server, which returns the XML conforming to the VAST standard. The xml structure describes the details for displaying the video ads.&lt;/p&gt;
&lt;p&gt;VPAID (Video player ad-serving interface definition) is a specification by the IAB which describes interactive communication between ad server and video player. It allows video players to display interactive video ads&lt;/p&gt;
&lt;p&gt;The Google Analytics plugin allows recording video events such as play, pause and end. These events are recorded by Google Analytics and can be viewed from the Google Analytics console.&lt;/p&gt;
&lt;h3 id=&quot;creating-custom-playlist-for-the-mediaelement-player&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-custom-playlist-for-the-mediaelement-player&quot; aria-label=&quot;creating custom playlist for the mediaelement player permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating custom playlist for the MediaElement Player&lt;/h3&gt;
&lt;p&gt;We needed a html5 video player with support for YouTube playlists. MediaElement Player was the best option, but its playlist plugin did not support YouTube videos. Also the playlist layout was not good.&lt;/p&gt;
&lt;p&gt;Fortunately the source code for the playlist demo was easy to customize. The &lt;a href=&quot;https://github.com/mediaelement/mediaelement/blob/master/docs/api.md&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MediaElement Player API&lt;/a&gt; describes the different JavaScript functions for controlling the player and also player configuration options. I came across a couple of issues while using the player.&lt;/p&gt;
&lt;p&gt;The first issue was that the player did not allow &lt;a href=&quot;https://github.com/mediaelement/mediaelement-plugins/issues/117&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;setting the YouTube configuration dynamically&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Second issue was a &lt;a href=&quot;https://github.com/mediaelement/mediaelement/issues/2496&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;full screen error when using the playlist plugin&lt;/a&gt;. The error was that in the playlist demo sample, when the player is in full screen mode and the big play button is clicked, the player resizes without properly exiting the full screen mode.&lt;/p&gt;
&lt;p&gt;We used the playlist plugin to develop our own YouTube playlist. See the &lt;a href=&quot;/posts/youtube-playlist&quot;&gt;YouTube Playlist article&lt;/a&gt; for details on how the YouTube playlist works.&lt;/p&gt;
&lt;p&gt;We felt that the YouTube Playlist project could benefit from the open source community’s support. We therefore decided to publish the source code for the project on &lt;a href=&quot;https://github.com/pakjiddat/youtube-playlist&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;MediaElement Player is a useful video and audio player for the web. It is being actively developed and is supported by a large open source community&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Displaying contents of an array in NXM html table]]></title><description><![CDATA[The following code allows displaying the contents of an array containing X number of elements in a HTML table. The HTML table contains N rows and M columns. The values of X, N and M can be configured:]]></description><link>https://pakjiddat.netlify.app//posts/displaying-contents-of-an-array-in-nxm-html-table</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/displaying-contents-of-an-array-in-nxm-html-table</guid><pubDate>Sat, 24 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The following code allows displaying the contents of an array containing X number of elements in a HTML table. The html table contains N rows and M columns. The values of X, N and M can be configured:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The column counter */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$column_counter&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The row counter */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$row_counter&lt;/span&gt;    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The total counter */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$total_counter&lt;/span&gt;  &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The maximum number of columns to show */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$max_columns&lt;/span&gt;    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The maximum number of rows */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$max_rows&lt;/span&gt;       &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** A two dimensional array for storing the data */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt;           &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The sample data */&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$model&lt;/span&gt;          &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;array_fill&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** Convert the $model array into a two dimensional array */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$model&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;/** The data is added to array */&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$row_counter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$column_counter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;/** The total counter is increased by 1 */&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$total_counter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;/** The row counter is increased by 1 */&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$row_counter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;/** If the total counter is divisible by $max_rows, then column counter is increased by 1 and row counter is set to 0 */&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$total_counter&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$max_rows&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$column_counter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$row_counter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** The start table tag */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;table&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** Display the two dimensional data in html table. Each row is checked */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$count1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$max_rows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$count1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;/** The row start tag is displayed */&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;tr&gt;\n&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count2&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$count2&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$max_columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$count2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;/** If the column does not exist, then empty column is shown */&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$column_data&lt;/span&gt;   &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$count2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;/** The column data is shown */&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;td&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$column_data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;/td&gt;\n&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;token comment&quot;&gt;/** The row end tag is displayed */&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;/tr&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** The end table tag */&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&amp;lt;/table&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token delimiter important&quot;&gt;?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the discussion &lt;a href=&quot;https://stackoverflow.com/questions/49441466/3-column-layout-how-to-have-a-limit-in-each-column&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;3 column layout - how to have a limit in each column&lt;/a&gt; for more information about how to display contents of an array in a HTML table&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using Prefetch, Preload and Preconnect for speeding page load times]]></title><description><![CDATA[Prefetch, Preload and Preconnect are mechanisms supported by modern web browsers that allow efficient loading of web resources.]]></description><link>https://pakjiddat.netlify.app//posts/using-prefetch--preload-and-preconnect-for-speeding-page-load-times</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-prefetch--preload-and-preconnect-for-speeding-page-load-times</guid><pubDate>Mon, 19 Feb 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Prefetch, Preload and Preconnect are mechanisms supported by modern web browsers that allow efficient loading of web resources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Preload&lt;/strong&gt; allows controlling how resources such as images, CSS and JavaScript files are loaded on the current page. For each resource that we want to preload, we have to use a link tag with rel=“preload” attribute. The following examples show how to preload resources:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- allows preloading an image --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;preload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;image.png&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- allows preloading a font file --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;preload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;https://example.com/fonts/font.woff&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;font&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;crossorigin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- allows preloading css --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;preload&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;https://blog.keycdn.com/blog/css/mystyles.css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The main benefit of the preload directive is that it allows important resources to be loaded earlier. For example if there is a stylesheet or image that is required for a page to display properly, then it can be preloaded by adding the relevant link tags in the head section of the document.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prefetch&lt;/strong&gt; is similar to preload but allows efficient loading of resources that are likely to be accessed by the user, such as a next or previous link. A drawback of prefetch is that it can cause certain page metrics such as ad statistics, visitor count etc to be miscalculated. For example &lt;a href=&quot;https://www.scl.com/insights/blog/google-chrome-prefetchprerender-inflating-web-analytics-stats/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Chrome has been known to miscalculate web analytics stats&lt;/a&gt;. There are three types of prefetch directives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;link-prefetch&lt;/strong&gt;. It allows a link to be fetched in advance before it has been clicked by the user. The contents of the link are saved to the browser cache&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;dns-prefetch&lt;/strong&gt;. It allows the host name of the resource to be resolved in advance. It eliminates the dns resolution step when the resource is requested by the user&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pre-render&lt;/strong&gt;. It allows a resource to be fetched and processed before being requested by the user. For example a link marked with the directive &lt;strong&gt;rel=“prerender”&lt;/strong&gt; will be fetched and processed by the browser. It should be used with caution as it can consume resources on mobile devices&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;preconnect&lt;/strong&gt;. The preconnect directive allows establishing tcp connections for a resource before it is actually requested. For example tls negotiations, tcp handshake and dns resolutions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://www.keycdn.com/blog/resource-hints&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Resource Hints - What is Preload, Prefetch, and Preconnect?&lt;/a&gt; for more information on using Prefetch, Preload and Preconnect.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Securing Linux servers with SeLinux, ClamAV, SpamAssassin and RkHunter]]></title><description><![CDATA[Securing your servers is a very important task that can save your organization a lot of problems. Recently there have been a lot of cases where insecure servers belonging to high profile organizations have been exploited and used for nefarious purpose. It is therefore important to secure your servers.]]></description><link>https://pakjiddat.netlify.app//posts/securing-linux-servers-with-selinux--clamav--spamassassin-and-rkhunter</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/securing-linux-servers-with-selinux--clamav--spamassassin-and-rkhunter</guid><pubDate>Sun, 28 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Securing your servers is a very important task that can save your organization a lot of problems. Recently there have been a lot of cases where insecure servers belonging to high profile organizations have been exploited and used for nefarious purpose. It is therefore important to secure your servers.&lt;/p&gt;
&lt;p&gt;Recently I had the opportunity of securing Linux based servers using the tools &lt;a href=&quot;https://en.wikipedia.org/wiki/Security-Enhanced_Linux&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SELinux&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Clam_AntiVirus&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ClamAV&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/SpamAssassin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SpamAssassin &lt;/a&gt;and &lt;a href=&quot;https://en.wikipedia.org/wiki/Rkhunter&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RkHunter&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;securing-your-linux-servers-using-selinux&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#securing-your-linux-servers-using-selinux&quot; aria-label=&quot;securing your linux servers using selinux permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Securing your Linux servers using SELinux&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Security-Enhanced_Linux%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SELinux&lt;/a&gt; is a mandatory access control system for operating systems based on the Linux Kernel. It is implemented as a Linux kernel security module.&lt;/p&gt;
&lt;h4 id=&quot;mandatory-access-control-vsdiscretionary-access-control&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#mandatory-access-control-vsdiscretionary-access-control&quot; aria-label=&quot;mandatory access control vsdiscretionary access control permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Mandatory access control vs Discretionary access control&lt;/h4&gt;
&lt;p&gt;Mandatory access control implies the system administrator enforces access control for resources. This is in contrast to Discretionary access control, where the access control is enforced by the owner of the resource.&lt;/p&gt;
&lt;p&gt;Discretionary access control is the default in Linux. It involves assigning permissions on files using the commands &lt;strong&gt;chmod&lt;/strong&gt; and &lt;strong&gt;chown&lt;/strong&gt;. SELinux is applied after the normal discretionary access control. If access to a resource is denied by discretionary access control system, then SELinux is not even consulted.&lt;/p&gt;
&lt;h4 id=&quot;similarity-with-apparmor&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#similarity-with-apparmor&quot; aria-label=&quot;similarity with apparmor permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Similarity with AppArmor&lt;/h4&gt;
&lt;p&gt;SELinux is similar to AppArmor, which is used by SuSe and Ubuntu operating systems. AppArmor is also implemented as a Linux kernel security module and provides mandatory access control but the main difference with SELinux is that it works with file system paths whereas SELinux works with Inodes.&lt;/p&gt;
&lt;p&gt;SELinux uses extended attributes of file systems so it does not work on file systems that do not support extended attributes such as file systems mounted over NFS. Most users find SeLinux more difficult to administer. However SELinux offers more fine grained control and is included by default in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linux_kernel#MAINLINE&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Linux Mainline Kernel&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;selinux-contexts&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#selinux-contexts&quot; aria-label=&quot;selinux contexts permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SELinux Contexts&lt;/h4&gt;
&lt;p&gt;The term SELinux context is often referred to as SELinux label. The &lt;a href=&quot;https://wiki.gentoo.org/wiki/SELinux&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Gentoo Wiki has excellent information about SELinux&lt;/a&gt;. According to the wiki, SELinux uses contexts to identify resources. A context has 3 and sometimes 4 parts. These parts are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;** SELinux user**&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SELinux role&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SELinux type&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SELinux sensitivity&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The SELinux user and role is usually same for different uses and processes. In most cases the SELinux type differentiates the security context. It is sometimes referred to as the SELinux context. The SELinux sensitivity is also called Multi-level security. It provides classification of data. e.g strictly confidential data, confidential data, internal data and public data.&lt;/p&gt;
&lt;p&gt;An example of a SELinux context is: &lt;strong&gt;user_u:user_r:user_t:s0&lt;/strong&gt;. Contexts are applied to all system resources including sockets, ports, files and directories.&lt;/p&gt;
&lt;p&gt;SELinux also adds a new option usually a -Z switch to resource monitoring tools such as &lt;strong&gt;ls, id, ps and stat&lt;/strong&gt;. For example to view the SELinux context of the current user, use the command **id -Z. **To view the SELinux context of files use the command: &lt;strong&gt;ls -Z file_name&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The SELinux security system checks all resource access against a policy. If the policy disallows the access, then the access is denied and a message is logged to a file such as &lt;strong&gt;/var/log/audit.log&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;activating-selinux&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#activating-selinux&quot; aria-label=&quot;activating selinux permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Activating SELinux&lt;/h4&gt;
&lt;p&gt;SELinux is activated by default. To check if its activated use the command &lt;strong&gt;getenforce&lt;/strong&gt;. To enable SELinux temporarily use the command &lt;strong&gt;setenforce 1&lt;/strong&gt;. To permanently enable/disable SELinux edit the file &lt;strong&gt;/etc/selinux/config&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Many system administrators choose to disable SELinux because it causes problems with certain applications. I think this is a big mistake, because SELinux is not designed to block applications but to secure them. A basic understanding of SELinux can easily help to troubleshoot these problems.&lt;/p&gt;
&lt;h4 id=&quot;changing-selinux-context&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#changing-selinux-context&quot; aria-label=&quot;changing selinux context permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changing SELinux Context&lt;/h4&gt;
&lt;p&gt;The most common system administration task for SELinux is to allow a process access to a file or directory. e.g Apache web server has access to only files and directories with a certain SELinux context. If you want to allow Apache access to other files or directories then you need to update the SELinux context of those files and directories.&lt;/p&gt;
&lt;p&gt;To update the SELinux context of a file or directory temporarily we can use the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;chcon &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; net_conf_t /etc/puppet-resolv.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command sets the context of the file &lt;strong&gt;puppet-resolv.conf&lt;/strong&gt; to &lt;strong&gt;net_conf_t&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To make the change permanent we need to update the SELinux user space definition list and then relabel the files. We can update the user space definition list with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;semanage fcontext &lt;span class=&quot;token parameter variable&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; net_conf_t &lt;span class=&quot;token string&quot;&gt;&quot;/etc/puppet-resolv\.conf&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To relabel the list we use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;restorecon &lt;span class=&quot;token parameter variable&quot;&gt;-R&lt;/span&gt; /etc/puppet-resolv.conf /usr/lib/portage/bin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will permanently change the SELinux context of the file. Errors caused by SELinux can be seen in the file &lt;strong&gt;/var/log/audit.log&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://wiki.centos.org/HowTos/SELinux&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Centos Wiki&lt;/a&gt; also has some useful information on SELinux. According to the wiki we can use the &lt;strong&gt;setroubleshoot&lt;/strong&gt; package for troubleshooting SELinux related issues. This package provides the &lt;strong&gt;sealert&lt;/strong&gt; command which gives a user friendly version of the contents of the &lt;strong&gt;audit.log file&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;clamav&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#clamav&quot; aria-label=&quot;clamav permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ClamAV&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Clam_AntiVirus&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ClamAV&lt;/a&gt; is a well known anti virus program that is available for several operating systems including Windows, Linux, BSD, AIX and Solaris. ClamAV contains the following components: command-line scanner, automatic database updater and a scalable multi-threaded server.&lt;/p&gt;
&lt;p&gt;ClamAV also contains a &lt;a href=&quot;https://en.wikipedia.org/wiki/Milter&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Milter interface&lt;/a&gt; that allows applications that support the Milter extension such as Postfix and Sendmail to use the ClamAV for checking for viruses.&lt;/p&gt;
&lt;p&gt;The ClamAV website has complete information on &lt;a href=&quot;http://www.clamav.net/doc/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installing ClamAV&lt;/a&gt;. There are many on-line tutorials that describe how to use ClamAV. For example ”&lt;a href=&quot;https://www.lisenet.com/2014/automate-clamav-to-perform-daily-system-scan-and-send-email-notifications-on-linux/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Automate ClamAV to Perform Daily System Scan and Send Email Notifications on Linux&lt;/a&gt;” and ”&lt;a href=&quot;https://www.centosblog.com/how-to-install-clamav-and-configure-daily-scanning-on-centos/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to Install ClamAV and Configure Daily Scanning on CentOS&lt;/a&gt;“.&lt;/p&gt;
&lt;h3 id=&quot;rootkit-hunter&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rootkit-hunter&quot; aria-label=&quot;rootkit hunter permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Rootkit Hunter&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://rkhunter.sourceforge.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rootkit Hunter&lt;/a&gt; or Rkhunter is a well known tool that scans for rootkits, backdoors and possible local exploits. It does this by comparing file signatures of well known files with signatures in an on-line database. If the signatures do not match then the Rkhunter reports an error.&lt;/p&gt;
&lt;p&gt;Rkhunter installation is simple and is well documented on &lt;a href=&quot;http://www.woktron.com/secure/knowledgebase/79/Installation-Rootkit-Hunter-rkhunter-on-CentOS-5-and-6.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installation Rootkit Hunter (rkhunter) on CentOS 5 and 6&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;spamassassin&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#spamassassin&quot; aria-label=&quot;spamassassin permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SpamAssassin&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/SpamAssassin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SpamAssassin&lt;/a&gt; is a well known spam filtering program that can be run on different operating systems including Linux and Windows and is compatible with most email servers. SpamAssassin can be run as a standalone server or integrated with email servers.&lt;/p&gt;
&lt;p&gt;The SpamAssassin wiki has a useful &lt;a href=&quot;http://wiki.apache.org/spamassassin/SingleUserUnixInstall&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;guide for installing SpamAssassin&lt;/a&gt;. Installation of SpamAssassin is simple. On Centos it can be installed with the command &lt;strong&gt;yum install spamassassin.&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;integrating-spamassassin-with-postfix&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#integrating-spamassassin-with-postfix&quot; aria-label=&quot;integrating spamassassin with postfix permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Integrating SpamAssassin with Postfix&lt;/h4&gt;
&lt;p&gt;To integrate SpamAssassin with Postfix we need to first edit the file &lt;strong&gt;/etc/mail/spamassassin/local.cf&lt;/strong&gt; and configure the score for spam messages, the text to append to the email subject, whether to move the email to the inbox or delete the email and the spam score for all email that is sent out by SpamAssassin.&lt;/p&gt;
&lt;p&gt;After editing the configuration file, we need to add a system user for SpamAssassin and then configure Postfix so it uses SpamAssassin. After that we need to run a cron job that updates the SpamAssassin rules and reloads SpamAssassin.&lt;/p&gt;
&lt;p&gt;Installation of SpamAssassin and integration with Postfix is described on &lt;a href=&quot;http://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Integrating SpamAssassin into Postfix using spamd&lt;/a&gt;, &lt;a href=&quot;http://wiki.apache.org/spamassassin/IntegratePostfixViaSpampd&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Integrating SpamAssassin into Postfix using spampd&lt;/a&gt; and &lt;a href=&quot;http://wiki.apache.org/spamassassin/IntegratedInPostfixWithAmavis&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SpamAssassin Integration with Postfix, using Amavis&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Integration with other Mail Transfer Agents is described on &lt;a href=&quot;http://wiki.apache.org/spamassassin/IntegratedInMta&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Integrated into several varieties of MTA&lt;/a&gt;. The article &lt;a href=&quot;http://www.rackspace.com/knowledge_center/article/installing-and-configuring-spamassassin-on-centos&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installing and configuring Spamassassin on CentOS&lt;/a&gt; contains useful information on how to configure SpamAssassin with Postfix.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Securing your server is a very important task that should always be considered during server administration. A secure server can save you and your organization lots of problems.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Understanding Meltdown and Spectre vunerabilities]]></title><description><![CDATA[Meltdown and Spectre are hardware vulnerabilities that affect all microprocessors based on Intel and some based on ARM and AMD.]]></description><link>https://pakjiddat.netlify.app//posts/understanding-meltdown-and-spectre-vunerabilities</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/understanding-meltdown-and-spectre-vunerabilities</guid><pubDate>Sun, 28 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Meltdown&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Spectre&lt;/a&gt; are hardware vulnerabilities that affect all microprocessors based on Intel and some based on ARM and AMD.&lt;/p&gt;
&lt;p&gt;The vulnerabilities have been under research since last several years but were made public in January 2018. Security experts consider the threats posed by these vulnerabilities as very severe.&lt;/p&gt;
&lt;h3 id=&quot;virtual-memory-and-paging-tables&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#virtual-memory-and-paging-tables&quot; aria-label=&quot;virtual memory and paging tables permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Virtual Memory and Paging Tables&lt;/h3&gt;
&lt;p&gt;In order to understand the Meltdown and Spectre vulnerabilities, it is helpful to know technical terms such as Virtual Memory and Paging. &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_memory&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Virtual Memory&lt;/a&gt; is a contiguous address space that is used by processes.&lt;/p&gt;
&lt;p&gt;It works as an abstraction layer over physical memory. It gives each process, the impression that it is the only process running on the system. Even though each process has its own virtual memory space, the physical address space of processes may overlap.&lt;/p&gt;
&lt;p&gt;Virtual Memory is mapped to physical memory using paging tables. It is maintained by the operating system. Depending on the operating system, all processes may share a paging table or each process can have its own paging table.&lt;/p&gt;
&lt;p&gt;Data is read in fixed sized blocks called pages from I/O devices and loaded to memory. If a process needs access to data and there is not enough memory to store the data, then existing pages of data are written back to the I/O device and the required data is read and stored in memory. This is called swapping.&lt;/p&gt;
&lt;p&gt;Thrashing is said to occur, when a process repeatedly swaps data in and out of memory because of insufficient physical memory. It can be prevented by adding more memory or by optimizing the application or operating system&lt;/p&gt;
&lt;h3 id=&quot;the-meltdown-vulnerability&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-meltdown-vulnerability&quot; aria-label=&quot;the meltdown vulnerability permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Meltdown vulnerability&lt;/h3&gt;
&lt;p&gt;Meltdown vulnerability allows a process to access memory location that is is not authorized to access. An example of an attack based on meltdown is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A rouge process uses indirect addressing to access a memory location. The instruction consists of a base value, for example 5000 and a memory address for example 2000. This address is out of bound to the process. The contents of this address is 4 and has size of 1 byte. The indirect instruction is therefore supposed to fetch the contents of memory location 5004.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When the CPU tries to fetch the contents of a memory location, it has to check whether the process should have access to this location. However this check which is known as a privilege check is performed in parallel with the memory fetch operation in order to speed up instruction execution.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As part of the memory fetch operation, the contents of the memory which is 4 is saved to the CPU cache. The next time address 5004 needs to be read, its value will be read and saved to cache before the privilege check completes. The read instruction itself fails and the process never gets direct access to memory location 2000 or the contents of the CPU cache.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The rouge process then uses a cache timing attack which is a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Side-channel_attack&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;side channel attack&lt;/a&gt; to determine that request for address 5004 takes less time to return as compared with requests for other addresses. The process can then conclude that memory location 2000 contains the value 4, even though the location is out of bounds to the process.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-spectre-vulnerability&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-spectre-vulnerability&quot; aria-label=&quot;the spectre vulnerability permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Spectre Vulnerability&lt;/h3&gt;
&lt;p&gt;The Spectre vulnerability is based on exploiting the side affects of &lt;strong&gt;speculative execution&lt;/strong&gt;, in particular &lt;strong&gt;branch prediction&lt;/strong&gt; which is a special case of speculative execution.&lt;/p&gt;
&lt;p&gt;Speculative execution is an optimization technique that is used to complete work before it is known that the work is needed or not. Branch prediction is used by the CPU to predict the outcome of a condition which results in execution of a certain block of code. Unlike Meltdown, Spectre is based on a more general concept and is more difficult to protect against.&lt;/p&gt;
&lt;h3 id=&quot;which-devices-can-be-affected&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#which-devices-can-be-affected&quot; aria-label=&quot;which devices can be affected permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Which devices can be affected?&lt;/h3&gt;
&lt;p&gt;The Meltdown and Spectre vulnerabilities affect all servers, desktops, laptops, mobiles and embedded devices. Cloud service providers are affected by Meltdown in a limited way.&lt;/p&gt;
&lt;p&gt;The Meltdown vulnerability allows rouge processes running on the host to access guest virtual machines, but does not allow guest virtual machines to access other guests or the host.&lt;/p&gt;
&lt;p&gt;Web Browsers that use Just In Time (JIT) JavaScript compilation which include all modern web browsers can be affected by Meltdown and Spectre. For example Meltdown can be used by a website to determine the information of another website that has been loaded by a user in a different tab.&lt;/p&gt;
&lt;h3 id=&quot;steps-taken-to-mitigate-the-affects-of-meltdown-and-spectre&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#steps-taken-to-mitigate-the-affects-of-meltdown-and-spectre&quot; aria-label=&quot;steps taken to mitigate the affects of meltdown and spectre permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Steps taken to mitigate the affects of Meltdown and Spectre&lt;/h3&gt;
&lt;p&gt;Kernel Page Table Isolation (KPTI) is a measure taken to reduce the impact of Meltdown. It involves isolating kernel memory from user mode processes. KPTI patches have been developed for the Linux Kernel 4.15 and also for older versions of the kernel. These patches have been merged with the main kernel.&lt;/p&gt;
&lt;p&gt;The KPTI patches have been developed by all major Linux vendors including RedHat. Apple and Microsoft have also released security updates containing KPTI patches.&lt;/p&gt;
&lt;p&gt;The KPTI patches are known to reduce computer performance. However the performance impact affects certain workloads more than others. For example the performance of I/O intensive applications such as PostGres database server is more affected by KPTI patches.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The Meltdown and Spectre vulnerabilities are serious threats which affect almost all microprocessors. No known threats based on these vulnerabilities have yet been discovered. Given the severity of the threats, attacks based on Meltdown and Spectre may soon surface.&lt;/p&gt;
&lt;p&gt;Proof of concept code which demonstrates Meltdown and Spectre is already available publicly. Attacks based on Meltdown cannot be detected. Attacks based on Spectre are even more difficult to predict and affect a wider range of devices.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Laravel Spark, GitScrum and IceCoder on Debian Stetch]]></title><description><![CDATA[Laravel Spark is a non-free but open source application for the Laravel PHP Framework. It provides features that are commonly found in web applications such as user subscription, billing plans, invoicing and payment processing.]]></description><link>https://pakjiddat.netlify.app//posts/installing-laravel-spark--gitscrum-and-icecoder-on-debian-stetch</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-laravel-spark--gitscrum-and-icecoder-on-debian-stetch</guid><pubDate>Sat, 13 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Laravel Spark is a non-free but open source application for the Laravel PHP Framework. It provides features that are commonly found in web applications such as user subscription, billing plans, invoicing and payment processing.&lt;/p&gt;
&lt;p&gt;Laravel GitScrum is a free and open source application that provides graphical statistics on GitLab accounts. It allows synchronizing project and issue information with GitLab.&lt;/p&gt;
&lt;p&gt;In this article, I will describe my experience with Installing and configuring Laravel Spark and Laravel GitScrum. I will also describe how to add a custom theme to the Laravel Framework&lt;/p&gt;
&lt;h3 id=&quot;installing-laravel-spark&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-laravel-spark&quot; aria-label=&quot;installing laravel spark permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Laravel Spark&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://spark.laravel.com/docs/5.0/installation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Laravel Spark installation&lt;/a&gt; is well documented on the Laravel Spark website. The main pre-requisites for the installation are: &lt;strong&gt;Composer, NodeJS &amp;#x26; NPM&lt;/strong&gt;. Composer is a packager manager for Php, while NPM is a package manager for NodeJs. NodeJs is a server side JavaScript runtime environment which allows Javascript code to be executed on the server.&lt;/p&gt;
&lt;h3 id=&quot;installing-nodejs-and-npm&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-nodejs-and-npm&quot; aria-label=&quot;installing nodejs and npm permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing NodeJs and NPM&lt;/h3&gt;
&lt;p&gt;NodeJs and NPM can be installed using the Node Version Management (NVM) script. The script can be downloaded from its &lt;a href=&quot;https://github.com/creationix/nvm#installation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Git Hub repository&lt;/a&gt;. NVM can be installed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install NVM in the home directory. The install location can be customized using the &lt;strong&gt;NVM_DIR&lt;/strong&gt; environment variable.&lt;/p&gt;
&lt;p&gt;Once NVM has been installed, we can use it for installing our required version of NodeJs and NPM. NVM allows installing multiple versions of NodeJS. For example to install the latest version of NodeJs, we can use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;nvm &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To check the version of NodeJs we can use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-v&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once the pre-requisites have been installed, we can start installing Laravel Spark. The command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; global require laravel/installer&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will install Laravel globally using Composer.&lt;/p&gt;
&lt;p&gt;Next we need to clone the &lt;a href=&quot;https://github.com/laravel/spark-installer&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;laravel/spark-installer&lt;/a&gt; repository from Git Hub. Once the repository has cloned, we need to install the dependencies for Laravel Spark using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command should be issued from the root of the cloned repository. The cloned repository path should be added to the &lt;strong&gt;$PATH&lt;/strong&gt; environment variable, so the spark command can be run from any folder on the system&lt;/p&gt;
&lt;p&gt;Next we need to register our application with the Spark installer. To do this, we need to generate an API token from our Spark account. We can then register our API token using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;spark register token-value&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where token-value is the generated token&lt;/p&gt;
&lt;p&gt;We can now create new Laravel Spark projects by issuing the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;spark new project-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where project-name is the name of the folder where the Spark application should be installed. Once we have created a new Spark project, we need to migrate the database for the new project using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;php artisan migrate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will create new database tables. Before running this command, we need to enter our database credentials in &lt;strong&gt;.env file.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We should then be able to access the Laravel Spark frontend page at the url configured in the virtual host configuration file. The frontend page has two buttons for logging in and registering. When the user logs in, he is taken to his application dashboard. He will also be able to view his personal information and subscription information.&lt;/p&gt;
&lt;p&gt;Laravel Spark supports the Stripe and BrainTree payment processors&lt;/p&gt;
&lt;h3 id=&quot;installing-laravel-gitscrum&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-laravel-gitscrum&quot; aria-label=&quot;installing laravel gitscrum permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Laravel GitScrum&lt;/h3&gt;
&lt;p&gt;Laravel GitScrum is a free open source application that essentially works as an agile frontend for the GitLab API. It allows importing projects and issues from GitLab.&lt;/p&gt;
&lt;p&gt;It also displays charts and graphs describing project and issue progress. It provides product backlog, sprint backlog and user stories. GitScrum requires Php 7.1 or higher. It can use MySQL or Mariadb as the database server.&lt;/p&gt;
&lt;p&gt;GitScrum installation is well documented on the &lt;a href=&quot;https://github.com/gitscrum-community-edition/laravel-gitscrum#installation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GitScrum repository front page&lt;/a&gt;. To install GitScrum, we need to first clone the GitScrum source code repository by issuing the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone &lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; https://github.com/gitscrum-community-edition/laravel-gitscrum.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to install the GitScrum dependencies using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; laravel-gitscrum &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; update
&lt;span class=&quot;token function&quot;&gt;composer&lt;/span&gt; run-script post-root-package-install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to set the Application URL by editing the constant APP_URL in .env file. The database connection information should also be added to the .env file.&lt;/p&gt;
&lt;p&gt;Next we need to create the database tables for GitScrum by running the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;php artisan migrate &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; php artisan db:seed &lt;span class=&quot;token parameter variable&quot;&gt;--class&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;SettingSeeder&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to enter our GitLab key and secret in .env file. To fetch the key and secret values, we need to first create a new GitLab app and fetch the application Id and Secret.&lt;/p&gt;
&lt;h3 id=&quot;installing-icecoder&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-icecoder&quot; aria-label=&quot;installing icecoder permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing IceCoder&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://icecoder.net/downloads&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;IceCoder&lt;/a&gt; is a simple web based code editor. It can be used to edit source code files on the server. It has a user friendly interface and can be configured to display files in any folder, provided the user under which the web server is running has permissions to read/write the files. It only requires PHP and does not use a database.&lt;/p&gt;
&lt;p&gt;To install IceCoder, we simple need to download the files from the IceCoder website. Once the files have been downloaded, we need to extract them to the document root of the virtual host. The extracted files should be owned by the user under which the web server is running. We should then be able to access the IceCoder from browser by navigating to the server URL given in the server virtual host configuration.&lt;/p&gt;
&lt;p&gt;We can configure the root folder that will be served by the IceCoder. This can be done by setting the docRoot configuration in &lt;strong&gt;lib/config___settings.php&lt;/strong&gt;. By default it is set to the virtual host document root.&lt;/p&gt;
&lt;p&gt;The IceCoder also supports viewing and editing files remotely such as over ftp or GitHub.&lt;/p&gt;
&lt;h3 id=&quot;adding-template-files-to-laravel-framework&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-template-files-to-laravel-framework&quot; aria-label=&quot;adding template files to laravel framework permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding template files to Laravel Framework&lt;/h3&gt;
&lt;p&gt;The Laravel Framework has a built in template engine called &lt;a href=&quot;https://laravel.com/docs/5.5/blade#introduction&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Blade&lt;/a&gt;. It allows html templates to be easily added to the Laravel Framework.&lt;/p&gt;
&lt;p&gt;To quickly add a template file to Laravel framework, we need to first add a route over which the file will be served. We can do this by adding the following to &lt;strong&gt;routes/web.php&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token class-name static-context&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;/custom/home1&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will cause the file &lt;strong&gt;home1.blade.php&lt;/strong&gt; inside the folder &lt;strong&gt;views/custom/&lt;/strong&gt; to be served.&lt;/p&gt;
&lt;p&gt;Blade template files need to end with &lt;strong&gt;.blade.php&lt;/strong&gt;. They contain plain HTML but can optionally contain configuration directives. For example the statement: &lt;strong&gt;@extends(‘layouts.main’)&lt;/strong&gt; will cause the current view file to use the layout file: &lt;strong&gt;layouts/main.blade.php&lt;/strong&gt;. The directive: &lt;strong&gt;@section(‘title’, ‘Welcome to ValueHub’)&lt;/strong&gt; will case the page title to be set to: &lt;strong&gt;‘Welcome to ValueHub’&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The template file can also contain sections with content that is auto inserted into other template files. For example the main layout file &lt;strong&gt;layouts/main.blade.php&lt;/strong&gt; can contain the code: &lt;strong&gt;@yied(‘content’)&lt;/strong&gt;. Each view file that contains content should have code which starts with &lt;strong&gt;@section(‘content’)&lt;/strong&gt; and end with: &lt;strong&gt;@stop&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Template files can also include other template files. For example the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;@&lt;span class=&quot;token keyword&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;custom.header&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will cause the template file: &lt;strong&gt;views/custom/header.blade.php&lt;/strong&gt; to be included. This can be useful for including a header or footer template file.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Laravel Spark provides the scaffolding for developing applications that require subscription and payment processing. It a useful starting point for developing applications.&lt;/p&gt;
&lt;p&gt;GitScrum provides tools for developing applications according to agile methodology. It provides Burn Down charts, Backlogs and Kanban boards for managing application development. Both applications can be used in the development of custom applications.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using cookies in Javascript]]></title><description><![CDATA[Cookies allow websites to store information on the user browsers. They are usually used to store website session related information.]]></description><link>https://pakjiddat.netlify.app//posts/using-cookies-in-javascript</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-cookies-in-javascript</guid><pubDate>Sat, 16 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Cookies allow websites to store information on the user browsers. They are usually used to store website session related information. To set a cookie using JavaScript we can use:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cookie&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;cookie_name=cookie_value&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Multiple cookie values should be separated by ’;‘.&lt;/p&gt;
&lt;p&gt;The cookie string can contain the date of expiry of the cookie as well as the URL path for which the cookie is valid. By default the cookie belongs to the current page. An example of setting a cookie using JavaScript:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cookie &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To fetch the value of a cookie we can assign the document.cookie property to a variable. For example: &lt;strong&gt;var cookies = document.cookie&lt;/strong&gt;. We will then have to parse the values of the individual cookies&lt;/p&gt;
&lt;p&gt;To delete a cookie, we need to set the value of the cookie to an empty string and the value of the expires property to the required value&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.guru99.com/cookies-in-javascript-ultimate-guide.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cookies in JavaScript: Ultimate Guide&lt;/a&gt; is a useful guide that describes the relevance of cookies and how to create, access and remove cookies in JavaScript.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Wireshark on Ubuntu Artful]]></title><description><![CDATA[Wireshark is a network protocol analyzer which allows inspecting network traffic at different levels. It supports all the well known network protocols and is commonly used for troubleshooting network related problems.]]></description><link>https://pakjiddat.netlify.app//posts/installing-wireshark-on-ubuntu-artful</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-wireshark-on-ubuntu-artful</guid><pubDate>Fri, 01 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Wireshark is a network protocol analyzer which allows inspecting network traffic at different levels. It supports all the well known network protocols and is commonly used for troubleshooting network related problems. In this article I will describe my experience with installing Wireshark and using it for finding problems with web applications&lt;/p&gt;
&lt;h3 id=&quot;installing-wireshark&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-wireshark&quot; aria-label=&quot;installing wireshark permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Wireshark&lt;/h3&gt;
&lt;p&gt;Wireshark may be installed from source code or from a package management repository. Wireshark installation is described on the &lt;a href=&quot;https://www.wireshark.org/download.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wireshark download page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Installation from package management repository is the simplest option but does not allow the same level of customization as installing from source code. Installing from package management repository on Debian and Ubuntu requires running the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; wireshark-gtk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To install from source code, we need to first download the Wireshark source code. We have two options for installing Wireshark from source code. Either we can compile the code and generate a binary file or we can generate a package for the current operating system. The latter option is more suitable for installing Wireshark on several computers with identical operating system.&lt;/p&gt;
&lt;h3 id=&quot;compiling-the-source-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#compiling-the-source-code&quot; aria-label=&quot;compiling the source code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Compiling the source code&lt;/h3&gt;
&lt;p&gt;Wireshark supports two graphical interfaces. One is based on &lt;strong&gt;GTK+&lt;/strong&gt;, while the other is based on &lt;strong&gt;QT&lt;/strong&gt;. To generate the Wireshark binary based on GTK+, we need to run the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; pkg-config
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; gtk+-3
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; libgtk-3-dev
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; libpcap-dev
./configure --with-gtk&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;yes
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After running the &lt;strong&gt;make&lt;/strong&gt; command, the wireshark-gtk binary file will be generated in the current directory. The make install command will copy the binary file to &lt;strong&gt;/usr/local/bin/&lt;/strong&gt; (on Ubuntu Artful). After that we should be able to run the Wireshark using the command &lt;strong&gt;wireshark-gtk&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Running the command may give the following error:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;wireshark: error while loading shared libraries: libwiretap.so.1: cannot open shared object&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The error can be fixed by entering the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ldconfig&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we should be able to run the Wireshark from command line using &lt;strong&gt;wireshark-gtk&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;Wireshark also has a command line client called &lt;strong&gt;tshark&lt;/strong&gt; which is installed along with the wireshark-gtk binary. We can give various command line options to the &lt;strong&gt;configure&lt;/strong&gt; command for customizing our Wireshark installation. For example the &lt;strong&gt;—with-qt&lt;/strong&gt; option allows generating Wireshark with a QT based frontend.&lt;/p&gt;
&lt;h3 id=&quot;generating-package-for-the-operating-system&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-package-for-the-operating-system&quot; aria-label=&quot;generating package for the operating system permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating package for the operating system&lt;/h3&gt;
&lt;p&gt;To generate a package for the current operating system for example Debian, we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dpkg-buildpackage &lt;span class=&quot;token parameter variable&quot;&gt;-us&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-uc&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-rfakeroot&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command requires several dependencies which may be installed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; qtbase5-dev qtbase5-dev-tools qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5svg5-dev flex python-ply &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
libc-ares-dev xsltproc docbook-xsl docbook-xml libxml2-utils libcap2-dev libcap-dev bison quilt libparse-yapp-perl portaudio19-dev &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
libkrb5-dev liblua5.2-dev libsmi2-dev libgeoip-dev libnl-genl-3-dev libnl-route-3-dev asciidoc cmake w3m libsbc-dev libnghttp2-dev&lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
libssh-gcrypt-dev liblz4-dev libsnappy-dev libspandsp-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;troubleshooting-application-problems-using-wireshark-and-tcpdump&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#troubleshooting-application-problems-using-wireshark-and-tcpdump&quot; aria-label=&quot;troubleshooting application problems using wireshark and tcpdump permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Troubleshooting application problems using Wireshark and TCPDump&lt;/h3&gt;
&lt;p&gt;The problem I had was that my PHP script was making requests to Amazon Product API. The API was throttling the requests at random intervals and giving the error message that my application is sending requests too quickly.&lt;/p&gt;
&lt;p&gt;Amazon Product API allows maximum of one request to be sent per second. My application was sending one request every 4 seconds so there should not be a problem.&lt;/p&gt;
&lt;p&gt;I posted the error to the Amazon API forums. A similar error was reported by other users. Amazon support staff asked me to check my application using a low level tool. I decided to use &lt;a href=&quot;http://www.tcpdump.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;TCPDump&lt;/a&gt; for capturing network packets while my application was running.&lt;/p&gt;
&lt;p&gt;I ran the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;tcpdump &lt;span class=&quot;token parameter variable&quot;&gt;-w&lt;/span&gt; tdump.pcap &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; venet0 dst &lt;span class=&quot;token number&quot;&gt;52.94&lt;/span&gt;.216.120&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;for capturing the packets. The packets were captured from interface &lt;strong&gt;venet0&lt;/strong&gt; and saved to &lt;strong&gt;tdump.pcap&lt;/strong&gt; file. Only packets sent to the IP 52.94.216.120 were captured, which is the IP address of the Amazon Product API. The address appears to change every few minutes so I had to ping the API host &lt;strong&gt;ecs.amazonaws.de&lt;/strong&gt; immediately before running the command in order to get the IP address.&lt;/p&gt;
&lt;p&gt;After capturing the packets, I downloaded the tdump.pcap file from the server and opened it using Wireshark. The Wireshark displayed details of each captured packet. The Wireshark showed that the &lt;strong&gt;TLS Hello Client&lt;/strong&gt; package which is sent at the start of the TLS handshake was being sent with an interval of 4 seconds. This showed that my application was sending requests to the API server with sufficient pause. I posted the tdump.pcap file to the Amazon API forums.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Wireshark is a useful tool for troubleshooting network related problems. It supports hundreds of network protocols and has excellent features for analyzing and presenting network protocol information.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Running multiple versions of mailx command]]></title><description><![CDATA[Certain commands in Linux can be provided by multiple packages. The command provided by each package may differ. For example the mailx command is provided by the bsd-mailx package as well as the heirloom-mailx package. The mailx command provided by the packages use different command line parameters.]]></description><link>https://pakjiddat.netlify.app//posts/running-multiple-versions-of-mailx-command</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/running-multiple-versions-of-mailx-command</guid><pubDate>Fri, 24 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Certain commands in Linux can be provided by multiple packages. The command provided by each package may differ. For example the mailx command is provided by the &lt;strong&gt;bsd-mailx&lt;/strong&gt; package as well as the &lt;strong&gt;heirloom-mailx&lt;/strong&gt; package. The mailx command provided by the packages use different command line parameters.&lt;/p&gt;
&lt;p&gt;To force the system to use a command from a specific package we can use the &lt;strong&gt;update-alternatives&lt;/strong&gt; command. For example the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;update-alternatives &lt;span class=&quot;token parameter variable&quot;&gt;--set&lt;/span&gt; mailx /usr/bin/heirloom-mailx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will set the mailx provided by heirloom-mailx as the default mailx command. So when we enter mailx on the command line, it will run the mailx provided by heirloom-mailx package.&lt;/p&gt;
&lt;p&gt;The above command may give an error on Debian Stretch. If the error suggests that the mailx package has not been registered, then the error can be corrected by registering the heirloom-mailx package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;update-alternatives &lt;span class=&quot;token parameter variable&quot;&gt;--install&lt;/span&gt; /usr/bin/mailx mailx /usr/bin/heirloom-mailx &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the discussion on &lt;a href=&quot;https://serverfault.com/questions/666334/how-to-change-mailx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to change mailx?&lt;/a&gt;, for more information on how to run multiple versions of mailx.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Resizing Linux root partitions without unmount on Google Cloud]]></title><description><![CDATA[Virtual machines often run out of disk space and require resizing. Resizing root partitions without unmounting is always risky. It is recommended to take a backup of the partition's useful data before resizing the partition.]]></description><link>https://pakjiddat.netlify.app//posts/resizing-linux-root-partitions-without-unmount-on-google-cloud</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/resizing-linux-root-partitions-without-unmount-on-google-cloud</guid><pubDate>Thu, 23 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Virtual machines often run out of disk space and require resizing. Resizing root partitions without unmounting is always risky. It is recommended to take a backup of the partition’s useful data before resizing the partition.&lt;/p&gt;
&lt;p&gt;To resize the root partition we need to first increase the disk size in the virtual machine configuration. Next we need to enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;fdisk&lt;/span&gt; /dev/&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;root_partition_name&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will open the root partition in the fdisk program.&lt;/p&gt;
&lt;p&gt;The next step is to print the partition table using the command ’&lt;strong&gt;p&lt;/strong&gt;’. Note the starting block number of the root partition. Next we need to delete the root partition using the command ’&lt;strong&gt;d&lt;/strong&gt;’. Next we need to create the root partition using the command ’&lt;strong&gt;n&lt;/strong&gt;’. We will need to enter the starting block number that we noted earlier. The size of the new partition should be set to the new size. Next we need to write the partition table using the ’&lt;strong&gt;w&lt;/strong&gt;’ command. After that we need to reboot the virtual machine.&lt;/p&gt;
&lt;p&gt;See the article &lt;a href=&quot;https://linuxconfig.org/how-to-resize-ext4-root-partition-live-without-umount&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to resize ext4 root partition live without umount on Linux&lt;/a&gt; for more information on how to resize Linux root partitions without unmount on Google Cloud&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Configuring Apache mod status]]></title><description><![CDATA[Apache Mod Status is an Apache module that provides useful information about the requests being sent to Apache.]]></description><link>https://pakjiddat.netlify.app//posts/configuring-apache-mod-status</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/configuring-apache-mod-status</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://httpd.apache.org/docs/2.4/mod/mod_status.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Mod Status&lt;/a&gt; is an Apache module that provides useful information about the requests being sent to Apache.&lt;/p&gt;
&lt;p&gt;It provides information such as the PID of Apache processes, the number of active and idle threads in each process, the thread id and request handled for each thread&lt;/p&gt;
&lt;p&gt;Apache mod_status is available by default in most Apache servers installations. To enable mod_status, we need to enable the mod_status Apache module. We then need to enable the mod_status handle within a location directive. This directive can be placed within a virtual host block. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;Location /server-status&gt;
SetHandler server-status

Order Deny,Allow
Deny from all
Allow from .example.com
&amp;lt;/Location&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will allow the Apache status information to be accessed on the url: &lt;strong&gt;&lt;a href=&quot;http://localhost/server-status&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost/server-status&lt;/a&gt;&lt;/strong&gt;. If we add refresh=N to the URL, then the status page will refresh every N seconds. For example: &lt;strong&gt;&lt;a href=&quot;http://localhost/server-status?refresh=5&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost/server-status?refresh=5&lt;/a&gt;&lt;/strong&gt;. The &lt;strong&gt;ExtendedStatus&lt;/strong&gt; Apache directive allows extra information to be displayed with mod_status. This directive is used side wide and cannot be applied on a virtual host basis. It can slow down the server, so it should only be used if needed&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating custom themes for October CMS]]></title><description><![CDATA[October CMS is a content management system based on Laravel Php Framework. It allows developing websites and web applications. It supports custom themes and plugins. In this article I will describe my experience with developing a custom theme for the October CMS.]]></description><link>https://pakjiddat.netlify.app//posts/creating-custom-themes-for-october-cms</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-custom-themes-for-october-cms</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;October CMS is a content management system based on Laravel PHP Framework. It allows developing websites and web applications. It supports custom themes and plugins. In this article I will describe my experience with developing a custom theme for the October CMS.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;To install the October CMS, we need to first ensure that our server meets the minimum requirements. October CMS requires PHP 7 and higher and the following PHP extensions: PDO, CURL, OpenSSL, Mbstring, Zip and the PHP GD library.&lt;/p&gt;
&lt;p&gt;The first steps in the installation process is to download the installation zip file to the web root directory. The zip file should be unzipped and write permissions should be given to the extracted files and folders. Next the install.php script should be opened in the browser. This will start the installation wizard. The wizard will ask for the database information as well as the admin user name and password. The wizard will then download the main files. Once the wizard ends, the installation files should be removed from the server.&lt;/p&gt;
&lt;p&gt;October CMS supports task scheduling. For this it requires adding the following entry to the crontab file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;* * * * * php /path/to/artisan schedule:run &gt;&gt; /dev/null 2&gt;&amp;amp;1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://octobercms.com/features&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;main features of the October CMS&lt;/a&gt; are described on the October CMS website. October CMS is built on top of the Laravel PHP framework.&lt;/p&gt;
&lt;p&gt;It supports the Twig template engine which is used to render web pages. It supports building pages using page components. A page component can be an item such as list of most recent posts. The October CMS can be extended using plugins. It has an easy to use administrative interface and supports easy creation of back-end pages for plugins.&lt;/p&gt;
&lt;p&gt;The October CMS provides a simple Ajax framework. It also provides the &lt;strong&gt;Builder plugin&lt;/strong&gt;, which allows easily creating fully functional plugins. The October CMS uses file based templates. It also includes a built in asset combiner which allows combining CSS and JavaScript files.&lt;/p&gt;
&lt;p&gt;The October CMS provides a marketplace for third party plugins and themes. Another useful features of the October CMS is that it allows plugin and core updates to be installed easily. It also has a translate plugin that allows easy translation of content&lt;/p&gt;
&lt;h3 id=&quot;developing-custom-themes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#developing-custom-themes&quot; aria-label=&quot;developing custom themes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Developing custom themes&lt;/h3&gt;
&lt;p&gt;Developing a custom theme for October CMS is quite easy. The CMS provides a built in theme called demo. A good starting point for developing the custom theme is to copy the demo theme folder and change the name of the folder to the new theme name.&lt;/p&gt;
&lt;p&gt;The theme folder contains the following subfolders:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;assets&lt;/strong&gt;. This folder contains the theme assets such as CCS files, JavaScript files, Images and Fonts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;content&lt;/strong&gt;. This folder contains the textual content of the website pages&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;layouts&lt;/strong&gt;. This folder contains the layout files for the theme. A layout file is a file with .htm extension. It contains the basic HTML page and placeholders for pages and partials. The top of the layout file has a configuration section that can contain information such as the description of the layout. The configuration section is read by the CMS and ends with ’&lt;strong&gt;==&lt;/strong&gt;’ on a new line.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pages&lt;/strong&gt;. This folder contains the page files. A page file has a .htm extension. It also starts with a configuration section which can contain information such as the page title, URL and layout. The page file is rendered in the given layout and is applied to the layout automatically when the given URL is accessed by the user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;partials&lt;/strong&gt;. This folder contains partial files. A partial file is a file ending with .htm that can be reused in other layouts, pages or partials. Examples of partial files are header and footer files that are common to several pages.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;readme.md and theme.yaml&lt;/strong&gt;. The readme.md file contains information about the theme in markdown format. The theme.yaml file contains theme information that is used by the CMS. Both files should exist in the theme root directory&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The templates files inside the layout, page and partial folders can contain upto three sections, which are configuration, PHP and Twig sections. Each section should end with ‘&amp;#x3C;b&gt;==&amp;#x3C;/b&gt;’ on a new line.&lt;/p&gt;
&lt;p&gt;Each theme can be managed from the October CMS back-end. The back-end allows editing the template files in a HTML editor as well as placing the theme in maintenance mode.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The October CMS is a feature rich CMS that is easy to use and extend. It is suitable for developing websites and web applications&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Disabling output buffering with mod_fcgid]]></title><description><![CDATA[Output buffering in PHP allows output from a PHP script to be stored in a buffer. When the buffer is flushed, the output is displayed to the user. Sometimes we may want to disable output buffering, so we can quickly access the output from a PHP script. For example it is useful to be able to view the output from long running scripts.]]></description><link>https://pakjiddat.netlify.app//posts/disabling-output-buffering-with-mod-fcgid</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/disabling-output-buffering-with-mod-fcgid</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Output buffering in PHP allows output from a PHP script to be stored in a buffer. When the buffer is flushed, the output is displayed to the user. Sometimes we may want to disable output buffering, so we can quickly access the output from a PHP script. For example it is useful to be able to view the output from long running scripts.&lt;/p&gt;
&lt;p&gt;The output from a PHP script can be buffered by other tools such as the web server, intermediate proxy servers, web server modules, web browser, PHP Interpreter etc.&lt;/p&gt;
&lt;p&gt;Disabling PHP output buffering is simple when using mod_php. We only need to disable the output buffering in the php.ini configuration, but when using PHP in a CGI or FastCGI environment it can be a bit tricky. Apache can use different modules for communicating with PHP in a FastCGI environment. For example mod_fcgid&lt;/p&gt;
&lt;p&gt;To disable output buffering in a FastCGI environment, the following steps can be taken:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;output buffering can be disabled for PHP by adding these lines to&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;php.ini:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;zlib.output_compression = 0;
output_buffering = 0;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;The mod_fcgid buffering can be disabled by adding: &lt;strong&gt;FcgidOutputBufferSize 0&lt;/strong&gt; to the virtual host configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The buffering by Apache can be disabled by disabling the mod_deflate Apache module.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The question &lt;a href=&quot;https://stackoverflow.com/questions/13751772/php-output-buffer-not-flushing&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PHP output buffer not flushing&lt;/a&gt; on Stackoverflow provides useful information on PHP output buffering problems.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Exo Platform - Intranet portal and collaboration]]></title><description><![CDATA[Exo Platform is an Intranet portal with collaboration features written in Java language. It is available as open source. It allows employees to collaborate effectively and productively. Its main features are an activity stream, documents, wiki, calendar, forums, contacts and spaces.]]></description><link>https://pakjiddat.netlify.app//posts/exo-platform---intranet-portal-and-collaboration</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/exo-platform---intranet-portal-and-collaboration</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Exo Platform is an Intranet portal with collaboration features written in Java language. It is available as open source. It allows employees to collaborate effectively and productively. Its main features are an &lt;strong&gt;activity stream, documents, wiki, calendar, forums, contacts and spaces&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Exo Platform installation is well documented in this &lt;a href=&quot;https://docs.exoplatform.org/PLF50/PLFAdminGuide.InstallationAndStartup.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installation and Startup guide&lt;/a&gt;. The Exo Platform is installed using a Docker image. Developers can install the Exo Platform from source code using the &lt;a href=&quot;https://github.com/exoplatform/platform-public-distributions&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Exo Platform GitHub repository&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;installing-as-a-docker-image&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-as-a-docker-image&quot; aria-label=&quot;installing as a docker image permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing as a Docker image&lt;/h4&gt;
&lt;p&gt;The &lt;a href=&quot;https://docs.exoplatform.org/PLF50/PLFAdminGuide.InstallationAndStartup.CommunityEdition.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installing eXo Platform Community Edition&lt;/a&gt; guide describes how to install Exo Platform community edition from a Docker image. The &lt;a href=&quot;https://hub.docker.com/r/exoplatform/exo-community/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Exo Platform page on DockerHub&lt;/a&gt; is a useful resource for installing Exo Platform community edition.&lt;/p&gt;
&lt;p&gt;To install the Exo Platform from Docker image, we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;:8080 &lt;span class=&quot;token parameter variable&quot;&gt;--name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;exo exoplatform/exo-community:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will download the latest community edition of Exo Platform and start it on port 8080.&lt;/p&gt;
&lt;p&gt;By default the Exo Platform uses HSQL database. It is recommended to use MySQL database for production environments. The database connection information, port numbers and other parameters can be set by passing environment variables to the Docker container. For example the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;:8080 &lt;span class=&quot;token parameter variable&quot;&gt;--name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;exo &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;EXO_ADDONS_LIST&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;exo-tasks:1.0.0,exo-answers&quot;&lt;/span&gt; exoplatform/exo-community:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will install the task and answers addons and start the Exo Platform on port 8080. The different customization options are described on the &lt;a href=&quot;https://hub.docker.com/r/exoplatform/exo-community/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Exo Platform page on DockerHub&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;installing-from-source&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-from-source&quot; aria-label=&quot;installing from source permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing from source&lt;/h4&gt;
&lt;p&gt;To install the Exo Platform from source we need to clone the &lt;a href=&quot;https://github.com/exoplatform/platform-public-distributions&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Exo Platform source code repository&lt;/a&gt;. In order to install from source, we need to have Apache Maven installed.&lt;/p&gt;
&lt;p&gt;Apache Maven is a build tool for Java. Once we have installed the Apache Maven, we need to change to the cloned source code repository. Next we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;mvn &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start the build process which will create the required executable scripts. The build process installs the Exo Platform as a Tom Cat application.&lt;/p&gt;
&lt;p&gt;To start the Exo Platform we need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;plf-community-tomcat-standalone/target/platform-community-{CURRENT_VERSION}/platform-community-{CURRENT_VERSION}/start_eXo.(sh|bat)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start the Exo Platform on the default port 8080 with &lt;strong&gt;HSQL&lt;/strong&gt; as the database&lt;/p&gt;
&lt;p&gt;The platform can be configured by editing the configuration files in the conf folder located in the same folder as the executable scripts. For example the file &lt;strong&gt;server.xml&lt;/strong&gt; contains configuration information for the HSQL database.&lt;/p&gt;
&lt;p&gt;To use MySQL instead of HSQL, we need to replace the HSQL configuration lines in server.xml with the contents of server-mysql.xml. This is described in the &lt;a href=&quot;https://docs.exoplatform.org/PLF50/PLFAdminGuide.Database.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;database configuration guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When we start the Exo Platform for the first time, we should use the command: &lt;strong&gt;start_eXo.sh&lt;/strong&gt;. This will run the application in the foreground allowing us to see if there are any errors. The application can be stopped using the command: &lt;strong&gt;stop_eXo.sh&lt;/strong&gt;. To run the application in the background we can use the command: &lt;strong&gt;start_eXo.sh -b&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;addons&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#addons&quot; aria-label=&quot;addons permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Addons&lt;/h3&gt;
&lt;p&gt;The addon command is used to manage the Exo Platform addons. To list the available addons, we need to run the command: &lt;strong&gt;./addon list&lt;/strong&gt; from the same folder as the &lt;strong&gt;start_eXo.sh&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;This will list all the addons that can be installed on the currently installed version of the Exo Platform. An addon can be installed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;./addon &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; exo-tasks:1.2.4&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install the addon exo-task version 1.2.4. To install addons in a Docker based installation, we need to pass environment variables to the docker run command.&lt;/p&gt;
&lt;p&gt;The Exo Platform has some useful addons such as &lt;strong&gt;exo-tasks, exo-chat and exo-onlyoffice&lt;/strong&gt;. These addons are still under development for the current v5 of the Exo Platform. Stable version of these addons are available for v4.4 of the Exo Platform.&lt;/p&gt;
&lt;p&gt;The exo-task addon adds project and task features to the Exo Platform. The exo-chat addon adds text messaging and document sharing features. The video-calls addon adds video chat features to the exo-chat addon allowing groups to video chat. The exo-chat addon integrates with the calendar, task and wiki features allowing tasks and events to be posted to the calendar and wiki.&lt;/p&gt;
&lt;p&gt;The exo-onlyoffice addon allows office documents such as Power Point Presentations, Word Documents, SpreadSheets etc to be opened within Exo Platform. The addon basically opens the documents using the API of an Only Office server. The Only Office server needs to be installed before using this addon.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;Exo Platform has two main sections. One is the company intranet and the other are spaces. Spaces are groups that may be created for special purposes. For example one space may be created for each department in a company.&lt;/p&gt;
&lt;p&gt;Both the company intranet and spaces support &lt;strong&gt;activity streams, documents, wiki, calendar, forums and contacts&lt;/strong&gt;. The task addon can be used to add task and project capabilities to both the company intranet and spaces.&lt;/p&gt;
&lt;p&gt;The Exo Platform also allows creating multiple sites. Each site can belong to a specific product or company department. All features of the Exo Platform can be customized and configured from the administration area. The administration area also allows managing gadgets and portlets.&lt;/p&gt;
&lt;p&gt;Gadgets and Portlets are small applications that can be added to pages or the Dashboard. Before a Gadget or Portlet can be used, it has to be added to one or more categories. This can be done by going to: Administration —&gt; Application.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The Exo Platform is a comprehensive feature rich application for developing Intranet portals. It has excellent &lt;a href=&quot;https://docs.exoplatform.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;documentation&lt;/a&gt; and is being actively developed&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Docker on Debian Jessie]]></title><description><![CDATA[Docker is a solution for managing light weight containers. To install Docker on Debian Jessie, we need to first install packages to allow apt to use a repository over HTTPS. We can do this using the command:]]></description><link>https://pakjiddat.netlify.app//posts/installing-docker-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-docker-on-debian-jessie</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Docker is a solution for managing light weight containers. To install Docker on Debian Jessie, we need to first install packages to allow apt to use a repository over HTTPS. We can do this using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
     apt-transport-https &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
     ca-certificates &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
     &lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
     gnupg2 &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
     software-properties-common&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to add Docker’s official GPG key using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-fsSL&lt;/span&gt; https://download.docker.com/linux/&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; /etc/os-release&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$ID&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;/gpg &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; apt-key &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to install the apt repository using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; add-apt-repository &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
   &lt;span class=&quot;token string&quot;&gt;&quot;deb [arch=amd64] https://download.docker.com/linux/&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt; /etc/os-release&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$ID&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt; \
   &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;lsb_release &lt;span class=&quot;token parameter variable&quot;&gt;-cs&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt; \
   stable&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to install Docker Community Edition using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; docker-ce&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we can test the installation by running the hello world Docker Container. We can do this using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run hello-world&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;See the &lt;a href=&quot;https://docs.docker.com/engine/installation/linux/docker-ce/debian/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;official Docker installation guide for Debian&lt;/a&gt; for details on installing Docker on Debian Jessie&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Permanently authenticating with remote git repositories]]></title><description><![CDATA[Some times we need to non-interactively run scripts which commit to git source code repositories that are hosted remotely. For example we may want push changes to a git repository stored on Bit Bucket. Normally we will be asked to enter our Bit Bucket credentials, but this can be automated.]]></description><link>https://pakjiddat.netlify.app//posts/permanently-authenticating-with-remote-git-repositories</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/permanently-authenticating-with-remote-git-repositories</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Some times we need to non-interactively run scripts which commit to git source code repositories that are hosted remotely. For example we may want push changes to a git repository stored on Bit Bucket. Normally we will be asked to enter our Bit Bucket credentials, but this can be automated. There are two ways of doing this:&lt;/p&gt;
&lt;p&gt;We can use credential caching. This will cache our credentials for a given duration. For example use the following command to cache your git credentials for 1 hour:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; config &lt;span class=&quot;token parameter variable&quot;&gt;--global&lt;/span&gt; credential.helper &lt;span class=&quot;token string&quot;&gt;&apos;cache --timeout 3600&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Another option is to place a .netrc file in your home directory. This file is used by curl which is used by git when working with remote repositories. The format of this file is as follows:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;machine bitbucket.org
login your-bitbucket-username
password your-bitbucket-password&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above methods should work with any remote git hosting. The article: &lt;a href=&quot;https://confluence.atlassian.com/bitbucketserver/permanently-authenticating-with-git-repositories-776639846.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Permanently authenticating with Git repositories&lt;/a&gt; describes how to permanently authenticate with git repositories.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using Redir command for redirecting ports]]></title><description><![CDATA[Redir is a very useful command line script that allows port redirection. The script listens on the given TCP port and forwards incoming connection to the given IP address and port]]></description><link>https://pakjiddat.netlify.app//posts/using-redir-command-for-redirecting-ports</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-redir-command-for-redirecting-ports</guid><pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://linux.die.net/man/1/redir&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redir&lt;/a&gt; is a very useful command line script that allows port redirection. The script listens on the given TCP port and forwards incoming connection to the given IP address and port.&lt;/p&gt;
&lt;p&gt;One use case for the Redir command is to setup SSH access for a container that is running inside a host system. For example if you are running LXC containers on a server and you want to be able to SSH to a container from outside the server, then you can use the redir command to redirect incoming connections on SSH port 22 or some other port to the SSH port of your container.&lt;/p&gt;
&lt;p&gt;The following redir command listens on all available IP addresses and port 1000. It redirects all incoming connections to port 22 on host 192.168.1.6. The ’&amp;#x26;’ at the end of the command allows the command to run in the background.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;redir &lt;span class=&quot;token parameter variable&quot;&gt;--laddr&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.0&lt;/span&gt;.0.0  &lt;span class=&quot;token parameter variable&quot;&gt;--lport&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--caddr&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;192.168&lt;/span&gt;.1.6 &lt;span class=&quot;token parameter variable&quot;&gt;--cport&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;22&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Installing Zurmo CRM and Oxwell Social Network Platform]]></title><description><![CDATA[Zurmo CRM is a customer relationship management system with a wide range of features such as Contact Management, Activity Management, Deal Tracking and more. Oxwell social network platform allows creation of social networks and online communities. Both applications are written in PHP and MySQL. Both platforms are open source and free to use.]]></description><link>https://pakjiddat.netlify.app//posts/installing-zurmo-crm-and-oxwell-social-network-platform</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-zurmo-crm-and-oxwell-social-network-platform</guid><pubDate>Tue, 21 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Zurmo CRM is a customer relationship management system with a wide range of features such as Contact Management, Activity Management, Deal Tracking and more. Oxwell social network platform allows creation of social networks and online communities. Both applications are written in PHP and MySQL. Both platforms are open source and free to use.&lt;/p&gt;
&lt;h3 id=&quot;installing-zurmo-crm&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-zurmo-crm&quot; aria-label=&quot;installing zurmo crm permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Zurmo CRM&lt;/h3&gt;
&lt;p&gt;Zurmo CRM is based on the Yii framework. It also uses JQuery and RedBeansPhp ORM library. It requires Php 5.3 and above and also requires a few extensions. The installation is described in the &lt;a href=&quot;http://zurmo.org/wiki/installing-zurmo&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Zurmo installation guide&lt;/a&gt;. To install the Zurmo CRM, we need to first download the source code to the webroot and then extract the zip file. We then need to run the installer from the browser. This will start the installation wizard for Zurmo CRM.&lt;/p&gt;
&lt;p&gt;The installation wizard will ask for database connection information and the superadmin user credentials.&lt;/p&gt;
&lt;h3 id=&quot;installing-oxwell-social-network&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-oxwell-social-network&quot; aria-label=&quot;installing oxwell social network permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Oxwell Social Network&lt;/h3&gt;
&lt;p&gt;The installation of the Oxwell Social Network is similar to that of the Zurmo CRM. The installation is described in this &lt;a href=&quot;https://wiki.oxwall.com/install:manual_installation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;manual installation guide&lt;/a&gt;. We need to first download the source code and move it to the web root. Next we need to extract the source code and configure the virtual host for the new website.&lt;/p&gt;
&lt;p&gt;Next we need to run the installation wizard from the web browser. The wizard will ask us for the database information and the admin user name and password.&lt;/p&gt;
&lt;h3 id=&quot;zurmo-crm-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#zurmo-crm-features&quot; aria-label=&quot;zurmo crm features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Zurmo CRM features&lt;/h3&gt;
&lt;p&gt;Zurmo CRM features are described in this &lt;a href=&quot;http://zurmo.org/features&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;feature list&lt;/a&gt; on the Zurmo CRM website. The features include Contact Management, Activity Management, Deal Tracking, Gamification, Reporting, Workflow, Marketing Automation, Product Management, Internationalization and more. The Zurmo CRM has an &lt;a href=&quot;http://demo.zurmo.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;online demo&lt;/a&gt; which showcases all the features.&lt;/p&gt;
&lt;h3 id=&quot;oxwell-social-network-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#oxwell-social-network-features&quot; aria-label=&quot;oxwell social network features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Oxwell Social Network features&lt;/h3&gt;
&lt;p&gt;The Oxwell Social Network has many useful features for developing online social networks. The features are documented in this &lt;a href=&quot;https://www.oxwall.com/complete-feature-list&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;feature list&lt;/a&gt; on the Oxwell website.&lt;/p&gt;
&lt;p&gt;The core features include: Messages, Friends, Facebook Connect, Privacy, Contact us, Image slideshow and more. Other features include Facebook-like newsfeed, Photo sharing, Forums, Video embeds, User blogs, Groups, Social media sharing, Birthdays, Events, Chat and more.&lt;/p&gt;
&lt;p&gt;Oxwell Social Network supports several monetization options such as User credits, Membership levels, Banner rotation, PayPal integration and more.&lt;/p&gt;
&lt;p&gt;Administrative and Management features of the Oxwell Social Network include the ability to add new features with plugins, 1-click updates, Theme customization, Drag’n’drop CMS, Mobile CMS, Public/private site modes, Site translation, Statistics, User roles, Pre-moderate content, Appoint moderators, Mass-mail users, Code injection and more.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Oxwell Social Network Platform and Zurmo CRM are excellent applications for building social networks and managing customers. Both applications are feature rich and open source.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Canvas learning management system]]></title><description><![CDATA[Canvas LMS is a modern Learning Management System. It allows teachers and instructors to publish learning material online such as courses, quizzes, assignments, announcements, syllabus, modules, discussions, files, learning outcomes and more. Canvas is available as open source software and can be used free of charge.]]></description><link>https://pakjiddat.netlify.app//posts/installing-canvas-learning-management-system</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-canvas-learning-management-system</guid><pubDate>Wed, 15 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Canvas LMS is a modern Learning Management System. It allows teachers and instructors to publish learning material online such as courses, quizzes, assignments, announcements, syllabus, modules, discussions, files, learning outcomes and more. Canvas is available as open source software and can be used free of charge.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Canvas LMS is based on Ruby on Rails framework. It uses PostgreSQL server for the database. Its installation is a bit tricky and is well described in this &lt;a href=&quot;https://github.com/instructure/canvas-lms/wiki/Production-Start&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation guide for production environments&lt;/a&gt;. The main installation steps are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h3 id=&quot;database-installation-and-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#database-installation-and-configuration&quot; aria-label=&quot;database installation and configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Database installation and configuration&lt;/h3&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This involves installing PostgreSQL server and creating a database and database user that will be used to access the database. A system account with same name as the database user should be created and given superuser rights.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h3 id=&quot;downloading-the-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#downloading-the-code&quot; aria-label=&quot;downloading the code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Downloading the code&lt;/h3&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This involves downloading the source code of Canvas LMS using GIT or downloading the tarball or zip file. Once the code has been downloaded it needs to be placed in the correct directory.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h3 id=&quot;dependency-installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#dependency-installation&quot; aria-label=&quot;dependency installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dependency installation&lt;/h3&gt;
&lt;p&gt;This involves installing the software required to run Canvas LMS. Canvas requires atleast Ruby v2.4 and NodeJS v6. It also requires PostgreSQL v9.3 and above. Most of Canvas dependencies are &lt;strong&gt;Ruby Gems&lt;/strong&gt;. Certain NodeJs packages are also required. Ruby Gems are software packages for the Ruby language, which can be managed by the Gems package management system.&lt;/p&gt;
&lt;p&gt;Canvas uses the &lt;strong&gt;Bundler gem&lt;/strong&gt; for managing package dependencies. Bundler may be regarded as a versioned package management system that sits on top of Gems. Bundler can be installed by entering the following command from the root of the Canvas installation:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; gem &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; bundler &lt;span class=&quot;token parameter variable&quot;&gt;--version&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1.13&lt;/span&gt;.6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The packages required by Canvas can then be installed using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;bundle &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--path&lt;/span&gt; vendor/bundle&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Canvas also requires certain NodeJs packages which can be installed using the &lt;strong&gt;Yarn&lt;/strong&gt; package for NodeJs. Canvas prefers Yarn instead of the commonly used &lt;strong&gt;NPM&lt;/strong&gt; package management system. Yarn can be installed using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-sS&lt;/span&gt; https://dl.yarnpkg.com/debian/pubkey.gpg &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; apt-key &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; -
&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;deb https://dl.yarnpkg.com/debian/ stable main&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt; /etc/apt/sources.list.d/yarn.list
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; --allow-downgrades &lt;span class=&quot;token assign-left variable&quot;&gt;yarn&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.27&lt;/span&gt;.5-1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The NodeJs dependencies can then be installed using the command: &lt;strong&gt;yarn install&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;canvas-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#canvas-configuration&quot; aria-label=&quot;canvas configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Canvas Configuration&lt;/h4&gt;
&lt;p&gt;This steps involves copying the default configuration files to the config directory and then editing the main configuration files. The configuration files can be copied over using the following command from the installation root:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token for-or-select variable&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; amazon_s3 database &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
  delayed_jobs domain file_store outgoing_mail security external_migration&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;cp&lt;/span&gt; config/&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;.yml.example config/&lt;span class=&quot;token variable&quot;&gt;$config&lt;/span&gt;.yml&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;done&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The next step is to edit the most important configuration files. These are the &lt;strong&gt;database.yml&lt;/strong&gt;, &lt;strong&gt;domain.yml&lt;/strong&gt;, &lt;strong&gt;security.yml&lt;/strong&gt; and &lt;strong&gt;outgoing_mail.yml&lt;/strong&gt; files.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;generate-assets&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generate-assets&quot; aria-label=&quot;generate assets permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generate Assets&lt;/h4&gt;
&lt;p&gt;Once the configuration files have been copied and edited, the next step is the generate the website assets, which are basically optimized CSS and JavaScript files. The assets can be generated using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;canvas_root_folder&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; log tmp/pids public/assets app/stylesheets/brandable_css_brands
&lt;span class=&quot;token function&quot;&gt;touch&lt;/span&gt; app/stylesheets/_brandable_variables_defaults_autogenerated.scss
&lt;span class=&quot;token function&quot;&gt;touch&lt;/span&gt; Gemfile.lock
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-R&lt;/span&gt; canvasuser config/environment.rb log tmp public/assets &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
                              app/stylesheets/_brandable_variables_defaults_autogenerated.scss &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
                              app/stylesheets/brandable_css_brands Gemfile.lock config.ru
&lt;span class=&quot;token function&quot;&gt;yarn&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;production bundle &lt;span class=&quot;token builtin class-name&quot;&gt;exec&lt;/span&gt; rake canvas:compile_assets
&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-R&lt;/span&gt; canvasuser public/dist/brandable_css&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;database-population&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#database-population&quot; aria-label=&quot;database population permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Database Population&lt;/h4&gt;
&lt;p&gt;This step involves creating the required database tables and table indexes. It requires entering the command: &lt;strong&gt;RAILS_ENV=production bundle exec rake db:initial_setup&lt;/strong&gt;. This will create the database tables, and will also prompt the user for the admin user name and password.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;file-permissions-and-apache-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#file-permissions-and-apache-configuration&quot; aria-label=&quot;file permissions and apache configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;File permissions and Apache configuration&lt;/h4&gt;
&lt;p&gt;This requires creating the system user that will own the Canvas source code files. It is usually set to the user that the Apache web server runs as. For example &lt;strong&gt;www-data&lt;/strong&gt;. Once the user has been created, the file ownership needs to be changed. The next steps involves installing the Apache Passenger module.&lt;/p&gt;
&lt;p&gt;This is used to execute the Ruby source code. Once Passenger module has been installed, we need to create a virtual host for serving the Canvas files. After that our installation is completed and we should be able to access our Canvas installation at the URL specified in the Apache virtual host configuration file. The installation guide should be checked for the exact steps required for configuring Apache.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;Canvas has all the features needed for creating virtual learning environments. All learning material is contained within courses. Each course can contain learning material such as quizzes, assignments, syllabus, announcements, grades, modules, student progress and more.&lt;/p&gt;
&lt;p&gt;The structure of Canvas is hierarchical. It consists of accounts and sub accounts. Each account and sub accounts contain courses. Each course contains quizzes, modules etc. The &lt;a href=&quot;https://community.canvaslms.com/community/answers/guides&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Canvas user guide&lt;/a&gt; describes all the features of Canvas.&lt;/p&gt;
&lt;p&gt;Canvas also has a messaging feature which allows users to send messages to other Canvas users. Other features include mobiles apps, calendar for managing events and a dashboard that displays overview of each course. Canvas also has user and group management&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Canvas is a very comprehensive and feature rich learning management system. It has been under development since 2008 and is actively supported by the open source community.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Data mining with Graylog2]]></title><description><![CDATA[In my earlier post titled, Graylog2 - A scalable open source centralized logging system, I had described my experience with installing and configuring Graylog2. In this post, I will describe my experience with using the search features of Graylog2.]]></description><link>https://pakjiddat.netlify.app//posts/data-mining-with-graylog2</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/data-mining-with-graylog2</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In my earlier post titled, &lt;a href=&quot;/posts/graylog2---a-scalable-open-source-centralized-logging-system&quot;&gt;Graylog2 - A scalable open source centralized logging system&lt;/a&gt;, I had described my experience with installing and configuring &lt;a href=&quot;https://www.graylog.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2&lt;/a&gt;. In this post, I will describe my experience with using the search features of Graylog2.&lt;/p&gt;
&lt;h3 id=&quot;using-graylog2-for-analyzing-log-files&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-graylog2-for-analyzing-log-files&quot; aria-label=&quot;using graylog2 for analyzing log files permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Graylog2 for analyzing log files&lt;/h3&gt;
&lt;p&gt;Once you have installed and configured Graylog2, you will of course want to use it for analyzing your log messages. The Graylog2 web interface has several features that can be used to analyze log files. These features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;input&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#input&quot; aria-label=&quot;input permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Input&lt;/h4&gt;
&lt;p&gt;Inputs allow us to receive log messages. Different types of inputs can be defined using the Graylog2 web interface. Graylog2 supports &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/getting_started/planning.html#collection-method&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;many input formats&lt;/a&gt;. In short you can send log information from almost any device or application to your Graylog2 server. This information can be analysed and viewed using the Graylog2 web interface.&lt;/p&gt;
&lt;p&gt;The most commonly used inputs are Syslog TCP and Syslog UDP. If a Syslog server is running on your Graylog2 server then you can use these inputs. The Syslog server can work as a remote Syslog server for other hosts on your network. So the hosts send their log files to the Syslog server running on the Graylog2 server which in turn forwards them to Graylog2.&lt;/p&gt;
&lt;p&gt;Syslog is a well known service for sending and receiving log messages. Syslog clients and servers are available for most operating systems. Most Linux based operating systems have build in Syslog clients.&lt;/p&gt;
&lt;p&gt;To configure a Syslog client to send log messages to a Syslog server all you need to do is define the IP address of a Syslog server. For example on Linux distributions running the &lt;strong&gt;rsyslog&lt;/strong&gt; client you only need to add this line at the end of the &lt;strong&gt;rsyslog.conf&lt;/strong&gt; file: &lt;strong&gt;&lt;em&gt;.&lt;/em&gt; @@ip_of_syslog_server:514&lt;/strong&gt;. The Syslog server should be running on your Graylog2 server. Thats all you need to do in order to send Syslog messages from your hosts to your Graylog2 server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;search&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#search&quot; aria-label=&quot;search permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Search&lt;/h4&gt;
&lt;p&gt;This feature allows you to search your log messages directly. To access this feature click on the Search link at the top. Then enter your search terms in the search box. This will return all Graylog2 messages that contain the search terms.&lt;/p&gt;
&lt;p&gt;Even if your Graylog2 server does not have much RAM or CPU and has tens of millions of messages, your query should not take more than 2 seconds. We can also save a search and can go back to a previous search with a single click. The Graylog2 documentation has good description on the &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/queries.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;search features&lt;/a&gt;. For example the query: &lt;strong&gt;source: server_name&lt;/strong&gt;, will return all messages sent by a server called server_name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;streams-and-alerts&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#streams-and-alerts&quot; aria-label=&quot;streams and alerts permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Streams and Alerts&lt;/h4&gt;
&lt;p&gt;A stream is a flow of messages that satisfies certain conditions. For example all messages that contain the term SSH can be placed in one stream. Several such rules can be applied to a Stream. Alerts can also be added to the Stream. An alert is triggered if a certain condition is fulfilled.&lt;/p&gt;
&lt;p&gt;For example an alert can be triggered if more than a certain number of messages enter a stream in a certain period of time. We can also configure responses to alerts. For example if an alert is triggered in a Stream, an email can be sent to configured users or a HTTP post notification can be sent to a web script.&lt;/p&gt;
&lt;p&gt;It is also possible to define outputs for a Stream. A Stream of messages can be sent out of a configured output. e.g to a certain destination IP address and port. The Graylog2 documentation has useful information about &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/streams/alerts.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 alerts&lt;/a&gt; and &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/streams.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 streams&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;dashboards-and-widgets&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#dashboards-and-widgets&quot; aria-label=&quot;dashboards and widgets permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dashboards and Widgets&lt;/h4&gt;
&lt;p&gt;Dashboards and Widgets provide actual statistical information about your messages. We can create several Dashboards. Each Dashboard can contain several Widgets. A Widget shows statistics from a search. For example when we do a search, the results can be saved as a widget.&lt;/p&gt;
&lt;p&gt;It is also possible to upload Content Packs using the Graylog2 web interface. A content pack is a set of predefined Streams, Widgets and Dashboards. For example we can upload a content pack for the Nginx web server that provides us with a dashboard. The Graylog2 documentation has useful information about &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/dashboards.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 Dashboards&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;extractors&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#extractors&quot; aria-label=&quot;extractors permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extractors&lt;/h4&gt;
&lt;p&gt;The real benefit of searching messages is when we know the structure of the message and can define fields for each message type. Once we have defined field types we can run precise search queries on the fields.&lt;/p&gt;
&lt;p&gt;Extractors are a feature of Graylog2 that allow us to do this. An Extractor is basically a regular expression that should match a field in a message. For each input we can define several Extractors and can perform search queries using fields defined by Extractors. Extractors can be imported and exported allowing us to share Extractors with the Graylog2 community.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Graylog2 is an excellent logging system with many features. I have installed and configured &lt;a href=&quot;http://docs.graylog.org/en/3.0/pages/architecture.html#minimum-setup&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 in a minimum setup&lt;/a&gt;. Graylog2 can also be configured in a large setup that supports tens of thousands of logging devices. Such a configuration involves load balancers and message brokers but is similar in principal to the small setup.&lt;/p&gt;
&lt;p&gt;Graylog2 provides very good community support. If you need help with some features you can always ask on the &lt;a href=&quot;https://groups.google.com/forum/#!forum/graylog2&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 forum&lt;/a&gt;. You can also post bugs to the &lt;a href=&quot;https://github.com/Graylog2&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 issue tracker&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Graylog2 - A scalable open source centralized logging system]]></title><description><![CDATA[In this blog post I will describe my experience with installing an open source centralized logging system called Graylog2. Graylog2 is an excellent log management system. It is based on well known open source tools such as Mongodb and Elasticsearch.]]></description><link>https://pakjiddat.netlify.app//posts/graylog2---a-scalable-open-source-centralized-logging-system</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/graylog2---a-scalable-open-source-centralized-logging-system</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In this blog post I will describe my experience with installing an open source centralized logging system called &lt;a href=&quot;http://www.graylog2.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2&lt;/a&gt;. Graylog2 is an excellent log management system. It is based on well known open source tools such as &lt;a href=&quot;http://www.mongodb.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mongodb&lt;/a&gt; and &lt;a href=&quot;http://www.elasticsearch.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Elasticsearch&lt;/a&gt;. It allows I.T administrators to collect logging information from almost any source, including Linux and Windows computers.&lt;/p&gt;
&lt;p&gt;Graylog2 works by collecting log messages from different sources. The log messages are saved in a central database. This database is queried and the query results are displayed on a nice web interface. Alerts can be configured that notify the administrator in case certain terms appear in search logs.&lt;/p&gt;
&lt;h3 id=&quot;installing-graylog2&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-graylog2&quot; aria-label=&quot;installing graylog2 permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Graylog2&lt;/h3&gt;
&lt;p&gt;Graylog2 installation is very simple. It requires a Linux server with Java. Graylog2 provides package repositories for Debian, Ubuntu and Centos based Linux distributions.&lt;/p&gt;
&lt;p&gt;Installing Graylog2 is as simple as installing the package repository and then entering the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; graylog2-server graylog2-web&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on Centos and&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; graylog2-server graylog2-web&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on Debian and Ubuntu. After installation a few fields need to be changed in the Graylog2 configuration files and thats all!. The installation is described in the &lt;a href=&quot;http://docs.graylog.org/en/1.2/pages/installation/operating_system_packages.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Graylog2 documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The standard Graylog2 installation involves 2 main components graylog2-server and graylog2-web. Large scale deployments of Graylog2 are more complex and involve a component called Graylog2-radio.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Graylog2 is a scalable log management system that can handle Terabytes of data. It is a useful tool for collecting and analyzing log data.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[High CPU problems with Pfsense]]></title><description><![CDATA[Recently our Pfsense gateway server was consuming too much CPU. Especially during high network activity. This blog post describes my experience with trying to optimize Pfsense.]]></description><link>https://pakjiddat.netlify.app//posts/high-cpu-problems-with-pfsense</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/high-cpu-problems-with-pfsense</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently our Pfsense gateway server was consuming too much CPU. Especially during high network activity. This blog post describes my experience with trying to optimize Pfsense.&lt;/p&gt;
&lt;p&gt;Pfsense is a network gateway system. High load on the network gateway can result in all sorts of issues for the client user. e.g slow download speed, problems with VPN connectivity, slow remote desktop connections etc. Hence tuning the network gateway for performance is very important.&lt;/p&gt;
&lt;p&gt;Pfsense is based on the FreeBSD operating system, which is similar to Linux. Pfsense has an excellent support forum with thousands of topics related to Pfsense. The support community is large and helpful and you are likely to receive a reply within hours.&lt;/p&gt;
&lt;h3 id=&quot;high-cpu-problem&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#high-cpu-problem&quot; aria-label=&quot;high cpu problem permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;High CPU problem&lt;/h3&gt;
&lt;p&gt;All the posts related to High CPU use in Pfsense mentioned following factors. Ipv6 traffic, Device polling and Tuning kernel parameters.&lt;/p&gt;
&lt;p&gt;I read that tuning kernel parameters is a bad idea unless you are using Pfsense for a very specific purpose. I followed the topic &lt;a href=&quot;https://forum.pfsense.org/index.php?topic=77493.msg422407#msg422407&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Something is causing High CPU load”&lt;/a&gt; on the Pfsense forums and blocked IPV6 traffic from the System-&gt;Advanced-&gt;Networking-&gt;Allow IPv6 option. That did not lower the CPU usage.&lt;/p&gt;
&lt;p&gt;I then read the articles &lt;a href=&quot;http://www.cyberciti.biz/faq/freebsd-device-polling-network-polling-tutorial/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“FreeBSD Set Network Polling To Boost Performance”&lt;/a&gt; and &lt;a href=&quot;https://blog.pfsense.org/?p=115&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Polling and FreeBSD”&lt;/a&gt;. The articles suggested that on FreeBSD systems with heavy hardware utilization, disabling device polling can reduce CPU usage.&lt;/p&gt;
&lt;p&gt;The reason was that normally hardware devices interrupt the CPU each time they have data that needs to be processed. This interruption of the CPU creates an overhead which increases with the number of interrupts.&lt;/p&gt;
&lt;p&gt;So if the network traffic is high then the network card will interrupt the CPU and will cause high CPU usage.&lt;/p&gt;
&lt;h3 id=&quot;solution-enable-device-polling-and-virtio-drivers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#solution-enable-device-polling-and-virtio-drivers&quot; aria-label=&quot;solution enable device polling and virtio drivers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Solution: Enable device polling and Virtio drivers&lt;/h3&gt;
&lt;h4 id=&quot;device-polling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#device-polling&quot; aria-label=&quot;device polling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Device Polling&lt;/h4&gt;
&lt;p&gt;The solution is to enable device polling which disables CPU interrupts. With device polling, the hardware device, e.g network card is polled by the CPU at regular intervals. This reduces the CPU overhead. Enabling device polling is very simple in Pfsense. You just have to disable the “Disable device polling” option under System-&gt;Advanced-&gt;Networking. This actually helped us a lot. The CPU usage went down from 80% to 40% and the load went down from 4.0 to 3.0.&lt;/p&gt;
&lt;h4 id=&quot;virtio-drivers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#virtio-drivers&quot; aria-label=&quot;virtio drivers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Virtio Drivers&lt;/h4&gt;
&lt;p&gt;This was still a bit high. Our Pfsense server was running as a virtual machine under Proxmox virtualization platform. Proxmox supports virtio drivers for hard disks and network cards. Virtio drivers allow virtual machines to access the host servers hardware directly and provide performance close to that of physical hardware.&lt;/p&gt;
&lt;p&gt;Unfortunately Pfsense does not support Virtio drivers by default. The Pfsense wiki article, &lt;a href=&quot;https://doc.pfsense.org/index.php/VirtIO_Driver_Support&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“VirtIO Driver Support”&lt;/a&gt;, has a useful guide on enabling support for Virtio drivers. We replaced all the virtual network cards with VirtIO based network cards on our Pfsense virtual machine. We then loaded the FreeBSD VirtIO kernel modules as described in the wiki. After enabling support for VirtIO network drivers, the CPU usage became normal and we also got a good increase in network performance.&lt;/p&gt;
&lt;p&gt;The instructions for enabling VirtIO drivers are very simple. You have to first load the VirtIO kernel modules by editing the &lt;strong&gt;/boot/loader.conf.local&lt;/strong&gt; file. Then you have to disable &lt;strong&gt;TCP offload&lt;/strong&gt; features from the Pfsense gui. You can do this by selecting the checkbox options related to TCP offloading.&lt;/p&gt;
&lt;h4 id=&quot;tcp-offloading&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#tcp-offloading&quot; aria-label=&quot;tcp offloading permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TCP Offloading&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/TCP_offload_engine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;TCP Offloading&lt;/a&gt; is a feature provided by some operating systems that transfer TCP/IP processing to the network interface card. Its especially useful on Gigabit and Multigigabit network interface cards.&lt;/p&gt;
&lt;p&gt;Transferring TCP/IP processing has the obvious advantage of speeding up network traffic. But it does have its disadvantages. For e.g network cards do not have advanced resource scheduling capabilities and security mechanisms of operating systems.&lt;/p&gt;
&lt;p&gt;TCP Offloading is supported by Windows and FreeBSD operating systems. Linux kernel does not support TCP Offloading out of the box and requires special support.&lt;/p&gt;
&lt;p&gt;Pfsense allows offloading certain TCP/IP stack functions such as &lt;strong&gt;checksum calculations&lt;/strong&gt; and &lt;strong&gt;TCP segmentation&lt;/strong&gt;. These functions have to be disabled in order to get the VirtIO drivers to work under Pfsense. Hopefully future releases of Pfsense will have built in support for virtio network cards with support for TCP offloading.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;What actually helped us the most was enabling support for VirtIO network cards. For now our Pfsense server is working well and stable. Tuning your important servers such as Network Gateways is important and can lead to many long term benefits.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Atlassian products on Google Cloud]]></title><description><![CDATA[Atlassian is a software company that develops products for software developers and project managers. Its main products are an Issue Management system called Jira and a Document Management and Collaboration platform called Confluence.]]></description><link>https://pakjiddat.netlify.app//posts/installing-atlassian-products-on-google-cloud</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-atlassian-products-on-google-cloud</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Atlassian is a software company that develops products for software developers and project managers. Its main products are an Issue Management system called &lt;strong&gt;Jira&lt;/strong&gt; and a Document Management and Collaboration platform called &lt;strong&gt;Confluence&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Other products by Atlassian include a group chat system called &lt;strong&gt;Hip Chat&lt;/strong&gt;, An Identity Management System called &lt;strong&gt;Crowd&lt;/strong&gt;, A Version Control System for Source Code called &lt;strong&gt;Bit Bucket&lt;/strong&gt; and a Continuous Integration platform called &lt;strong&gt;Bamboo&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this article I will describe my experience with installing, configuring and integrating Jira, Confluence, Crowd and Hip Chat. We used the cloud version of Hip Chat. The other products were self hosted and installed on a separate LXC container on a Google Cloud instance. Each product was accessed through a Nginx proxy server.&lt;/p&gt;
&lt;p&gt;Atlassian provides two versions of each product. A cloud version which is hosted by Atlassian and a server version which can be hosted by us. Atlassian products are written in pure Java and are run from a Tomcat container.&lt;/p&gt;
&lt;p&gt;Multiple Atlassian products cannot be run from a single Tomcat container. All products require the latest installation of Java Development Kit. (JDK). Atlassian products require significant hardware resources.&lt;/p&gt;
&lt;p&gt;Installation of the products is well documented and easy to follow. The Atlassian support staff is helpful and its forum is informative. All Atlassian products have a minimum fee of 10 USD per year. According to Atlassian, this amount is donated entirely to Charity. All Atlassian products support addons. Addons can be used to integrate Atlassian products with each other and with third party applications.&lt;/p&gt;
&lt;h3 id=&quot;jira-issue-management&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jira-issue-management&quot; aria-label=&quot;jira issue management permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jira Issue Management&lt;/h3&gt;
&lt;p&gt;Jira is an issue management platform. It can be used for issue tracking, bug tracking and project management. Jira is offered in three packages. Jira Core, which is the base software. Jira Software, which is intended for use by software development teams and Jira Service Desk, which is intended for I.T support and Help Desk staff. All three Jira packages may be used together. Jira functionality can be extended with the help of addons.&lt;/p&gt;
&lt;h4 id=&quot;installing-jira&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-jira&quot; aria-label=&quot;installing jira permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Jira&lt;/h4&gt;
&lt;p&gt;Jira requires about 2 Gb RAM. Installation of Jira is very simple and is described in this &lt;a href=&quot;https://confluence.atlassian.com/adminjiraserver073/installing-jira-applications-on-linux-861253030.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jira Installation Guide&lt;/a&gt;. To install Jira, we need to first download the installer. The installer is run from the command line and it prompts for a few questions such as the installation directory, TCP ports etc.&lt;/p&gt;
&lt;p&gt;Once the installer has run, Jira should be accessible from a web browser on port 8080. We then have to run the setup wizard. The setup wizard has an automated install option and a manual install option. If we select the manual install option, then we are first asked to select a database type and enter our database credentials.&lt;/p&gt;
&lt;p&gt;Next we will be asked to enter the general site information such as site name, base URL for the site etc. After that we need to enter our license. Then we need to enter the admin account information. After that we need to enter the mail server information. The Jira should now be ready to use.&lt;/p&gt;
&lt;h4 id=&quot;jira-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#jira-features&quot; aria-label=&quot;jira features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Jira Features&lt;/h4&gt;
&lt;p&gt;The main features of Jira are project management and issue tracking. A project contains issues. Issues can be viewed on a Kanban board or as a list. Issues can have custom fields and can be searched using different criteria. Issues may also be updated in bulk. Jira provides dashboards which give a summary of the issues. Jira users can be managed locally or from a directory server such as Atlassian Crowd. Crowd supports user management and Single Sign On (SSO) for Jira.&lt;/p&gt;
&lt;p&gt;Capture for Jira is an addon for Jira that allows creating Jira issues from a Google Chrome extension. For example a software developer who is working on fixing a bug on a web page, can create an Issue in Jira using the Jira Chrome extension. The extension displays a screenshot of the web page that the developer is working on. The developer may annotate this screenshot. The developer can then create a new Jira issue with the screenshot as an attachment&lt;/p&gt;
&lt;h3 id=&quot;confluence-document-management&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#confluence-document-management&quot; aria-label=&quot;confluence document management permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Confluence Document Management&lt;/h3&gt;
&lt;p&gt;Confluence is a document management system. It provides spaces within which documents are managed. A space is a grouping of functions related to document management. For example within a space, we can create wiki pages, write blog posts or post questions and answers.&lt;/p&gt;
&lt;h4 id=&quot;installing-confluence&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-confluence&quot; aria-label=&quot;installing confluence permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Confluence&lt;/h4&gt;
&lt;p&gt;Confluence requires about 6 Gb RAM. Installation of Confluence is very simple and is described in this &lt;a href=&quot;https://confluence.atlassian.com/doc/installing-confluence-on-linux-143556824.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Confluence Installation Guide&lt;/a&gt;. To install Confluence, we need to first download the installer.&lt;/p&gt;
&lt;p&gt;The installer is run from the command line and it prompts for a few questions such as the installation directory, TCP ports etc. Once the installer has run, Confluence should be accessible from a web browser on port 8090. We then have to run the setup wizard. In the first step, we will be asked to select the installation type. We can choose either production or evaluation. The production option requires an external database, while in the evaluation option the database is included with the installation. In the next step we will be asked to enter our license.&lt;/p&gt;
&lt;p&gt;In the next step we will be asked to select a database type and enter our database credentials. Next we need to choose if we want to populate our site with example data. Next we need to choose how we want to manage our users. The available options are managing the users from Confluence or managing them from Jira. Next we need to enter the admin account information. Next we need to enter the mail server information. The Confluence should now be ready to use.&lt;/p&gt;
&lt;h4 id=&quot;confluence-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#confluence-features&quot; aria-label=&quot;confluence features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Confluence Features&lt;/h4&gt;
&lt;p&gt;Confluence allows us to manage documents, write blog posts, post questions and answers and more. All Confluence features are grouped into spaces. Confluence also allows importing content from other Atlassian products using Application Links. Application links is an addon that allows Atlassian products to import content from other Atlassian products. For example we can display Jira issues on a Confluence page using a Jira Issue Macro. This requires that both the Jira and Confluence are connected with Application Links&lt;/p&gt;
&lt;h3 id=&quot;crowd-identity-management&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#crowd-identity-management&quot; aria-label=&quot;crowd identity management permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Crowd Identity Management&lt;/h3&gt;
&lt;p&gt;Crowd is an identity management platform. It provides centralized user management and Single Sign on for all Atlassian products. It also provides an OpenId server called CrowdId, which allows integrating third party applications using the OpenId protocol.&lt;/p&gt;
&lt;h4 id=&quot;installing-crowd&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-crowd&quot; aria-label=&quot;installing crowd permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Crowd&lt;/h4&gt;
&lt;p&gt;Crowd requires about 256 Mb RAM. Installation of Crowd is very simple and is described in this &lt;a href=&quot;https://confluence.atlassian.com/crowd/installing-crowd-24248834.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Crowd Installation Guide&lt;/a&gt;. To install Crowd, we need to first download the archive file. Next we need to specify the location of the Crowd home directory. This can be done by editing the file: &lt;strong&gt;{CROWD_INSTALL}\crowd-webapp\WEB-INF\classes\crowd-init.properties&lt;/strong&gt;. The next step is to connect Crowd to an external database. Next we need to run the startup script start_crowd.sh in the Crowd installation directory. This will start Crowd on port 8095&lt;/p&gt;
&lt;h4 id=&quot;crowd-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#crowd-features&quot; aria-label=&quot;crowd features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Crowd Features&lt;/h4&gt;
&lt;p&gt;Crowd allow us to manage our users from a central location. These users can be authenticated by different applications. Each application must be registered in Crowd. Users in Crowd are stored in directories. Crowd supports the following types of directories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Internal&lt;/strong&gt;. An Internal directory stores authentication and authorization information in the Crowd database&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delegated authentication&lt;/strong&gt;. Delegated authentication directories store the users and groups in Crowd, but delegate the authentication to an external LDAP server&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Connector&lt;/strong&gt;. A connector directory is a LDAP connector that stores the user and group information in an external LDAP server&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remote Crowd&lt;/strong&gt;. A remote Crowd directory uses another Crowd directory stored on a remote Crowd instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom&lt;/strong&gt;. A custom directory allows developers to implement their own interfaces for connecting custom data stores to Crowd&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;hip-chat&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#hip-chat&quot; aria-label=&quot;hip chat permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Hip Chat&lt;/h3&gt;
&lt;p&gt;Atlassian Hip Chat allows chatting, video conferencing and screen sharing for teams and businesses. Hip Chat supports rooms where software developers can discuss work. All Atlassian products link with Hip Chat. For example the Jira Hip Chat integration allows developers to add chat rooms to a Jira issue. When the issue is updated, a notification is sent to the chat room on Hip Chat. Confluence and Bit Bucket have similar integrations for Hip Chat. For example each time a Confluence page is updated, a notification can be sent to a room. Similarly, when a commit is made to a repository in Bit Bucket, a notification can be sent to a chat room in Hip Chat.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Atlassian products are suitable for the enterprise and software development teams. The products are very well integrated with each other and have very useful features.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing HumHub and Communote on Debian Jessie]]></title><description><![CDATA[HumHub and Communote are both web based social network platforms that allow teams and small organizations to communicate and collaborate using Activity Streams, Messaging, Blogging, Tagging and more. HumHub is based on the Yii Php Framework, while Communote is written in Java.]]></description><link>https://pakjiddat.netlify.app//posts/installing-humhub-and-communote-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-humhub-and-communote-on-debian-jessie</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;HumHub and Communote are both web based social network platforms that allow teams and small organizations to communicate and collaborate using Activity Streams, Messaging, Blogging, Tagging and more. HumHub is based on the &lt;strong&gt;Yii Php Framework&lt;/strong&gt;, while Communote is written in Java.&lt;/p&gt;
&lt;h3 id=&quot;installing-communote&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-communote&quot; aria-label=&quot;installing communote permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Communote&lt;/h3&gt;
&lt;p&gt;Communote installation is well documented in this &lt;a href=&quot;https://communote.github.io/doc/install_communote.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation guide&lt;/a&gt; on the communote website. There are two main options for installing Communote on Linux based servers. We can either install Communote from an installation package or from a WAR file.&lt;/p&gt;
&lt;p&gt;Both installation options require a database server. Oracle, Microsoft SQL server, PostGres and MySQL database servers are supported.&lt;/p&gt;
&lt;p&gt;Both installation options require Java Runtime Environment version 8 and the JDBC driver for the selected Database management system. Installation from WAR file also requires Apache Tomcat server. Both installation options can be completed in a few steps as described in the installation guide.&lt;/p&gt;
&lt;p&gt;After the Communote has been downloaded and installed, it can accessed from the browser at &lt;a href=&quot;http://localhost:8080&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:8080&lt;/a&gt;. The startup page shows a web based wizard that allows the Communote to be configured.&lt;/p&gt;
&lt;h3 id=&quot;installing-humhub&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-humhub&quot; aria-label=&quot;installing humhub permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing HumHub&lt;/h3&gt;
&lt;p&gt;HumHub is written in PHP and like most Php based applications, it is easy to install. The installation is described in this &lt;a href=&quot;http://docs.humhub.org/admin-installation.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation guide&lt;/a&gt;. To install HumHub, we first need to create a new MySQL database. Next we need to download the HumHub files and configure the Apache virtual host for serving the files. The installation can then be completed from the web based installation wizard.&lt;/p&gt;
&lt;h3 id=&quot;communote-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#communote-features&quot; aria-label=&quot;communote features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Communote Features&lt;/h3&gt;
&lt;p&gt;Communote features and installation are well documented on their &lt;a href=&quot;https://support.communardo.de/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;support website&lt;/a&gt;. Communote is essentially a Micro Blogging platform. It allows users to enter notes which can be viewed in an activity stream. Users can comment on notes and also search within notes. Notes are categorized by topics and tags.&lt;/p&gt;
&lt;p&gt;Communote has a client server architecture. The Communote service installed on the server can be accessed from the browser as well as mobile and desktop clients. Communote can be integrated into other applications using embed codes and widgets. The embed code allows Communote activity streams to be embedded in any website, while the widgets allow the a simplified view of Communote to be embedded in other websites. Communote also allows notes to be submitted by email.&lt;/p&gt;
&lt;p&gt;Communote functionality can be extended by plugins. Plugins such as language, message queue and single sign on are supported.&lt;/p&gt;
&lt;h3 id=&quot;humhub-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#humhub-features&quot; aria-label=&quot;humhub features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;HumHub features&lt;/h3&gt;
&lt;p&gt;The main feature of HumHub is spaces. A space is a collection of features such as files, users and groups. The features available in a space are determined by the modules that have been activated for the space.&lt;/p&gt;
&lt;p&gt;For example modules such as wiki, tasks, polls, sms can be enabled for individual spaces. Each space contains an activity stream by default. A user dashboard shows all activity that has occurred within spaces that the user is subscribed to. The layout of the HumHub is responsive and works on mobile devices and desktop browsers.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;HumHum and Communote are both useful platforms for collaborating and forming social networks. Both platforms are open source and free to use.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing NextCloud, Collabora and Spreed on Debian Jessie]]></title><description><![CDATA[NextCloud is a document management and collaboration system. It allows users to access their images, documents, spreadsheets and other files from any location and any device.]]></description><link>https://pakjiddat.netlify.app//posts/installing-nextcloud--collabora-and-spreed-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-nextcloud--collabora-and-spreed-on-debian-jessie</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nextcloud&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextCloud&lt;/a&gt; is a document management and collaboration system. It allows users to access their images, documents, spreadsheets and other files from any location and any device.&lt;/p&gt;
&lt;p&gt;NextCloud is free and open source and is a fork of OwnCloud. It also has an enterprise edition.&lt;/p&gt;
&lt;p&gt;NextCloud consists of a server and clients. It can also be extended by apps. NextCloud server has a web interface that allows users to change the server settings and also manage their files. The web interface allows access to all the features of NextCloud. NextCloud clients are desktop and mobile applications that allow access to documents.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;NextCloud requires about of 512Mb RAM. It supports most modern Linux based operating systems. It requires Php 5.6+. It supports modern database servers including MySQL/MariaDb, PostGres and Oracle. It also supports all major web browsers, desktop and mobile clients.&lt;/p&gt;
&lt;p&gt;NextCloud can be installed either from source or from SNAP. Source installation is slightly more difficult. It requires installation of several Php extensions. To install NextCloud from source, we need to first download the &lt;a href=&quot;https://nextcloud.com/install/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextCloud files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After that we need to create a database and then run the NextCloud installer from a web browser. This will install the NextCloud server. The details of the installation and the different installation options are well documented on the &lt;a href=&quot;https://docs.nextcloud.com/server/12/admin_manual/installation/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextCloud installation guide&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;apps&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#apps&quot; aria-label=&quot;apps permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Apps&lt;/h3&gt;
&lt;p&gt;NextCloud functionality can be extended with Apps. An App is a plugin that adds a new feature to NextCloud. NextCloud Apps are available from the &lt;a href=&quot;https://apps.nextcloud.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextCloud App Store&lt;/a&gt;. An App can be installed and enabled from the Apps page.&lt;/p&gt;
&lt;p&gt;It is also possible to develop a custom App and upload it to the NextCloud installation folder. NextCloud provides Apps for creating notes, video conferencing, editing office documents, managing tasks, creating diagrams,  file sharing, file versioning and much more.&lt;/p&gt;
&lt;h3 id=&quot;collabora-online&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#collabora-online&quot; aria-label=&quot;collabora online permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Collabora Online&lt;/h3&gt;
&lt;p&gt;Collabora Online is a LibreOffice based online document editor. It supports all major office document formats including Microsoft and Libre Office documents. Collabora Online is free and open source and works in all modern browsers. It supports collaborative editing and supports integration with other applications such as NextCloud.&lt;/p&gt;
&lt;p&gt;Collabora Online server can be installed easily from a Docker image. The following line of code will start a Docker container running Collabora server. It will download the Docker image of Collabora, if not already downloaded. It will start a container running Collabora server listening on port 9980.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;9980&lt;/span&gt;:9980 &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;domain=example.com&quot;&lt;/span&gt; --cap-add MKNOD collabora/code&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The installation of Collabora Online server with Nginx reverse proxy is described in the article &lt;a href=&quot;https://icewind.nl/entry/collabora-online/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Running Online Office with Nextcloud and nginx&lt;/a&gt;. The Collabora Online server must be accessible over the internet using HTTPS protocol.&lt;/p&gt;
&lt;p&gt;Self signed certificates may not work so a HTTPS certificate should be obtained from a Certificate Authority. A good option for obtaining HTTPS certificates is &lt;a href=&quot;/posts/installing-lets-encrypt-ssl-certificates-on-debian-jessie-and-nginx&quot;&gt;Lets Encrypt&lt;/a&gt;. It provides HTTPS certificates free of cost.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://nextcloud.com/collaboraonline/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Collabora plugin for NextCloud&lt;/a&gt; is easy to configure. It requires the public url of the Collabora server. Once the plugin has been configured, we can start editing office documents from within NextCloud using Collabora Online.&lt;/p&gt;
&lt;h3 id=&quot;spreed-video-conferencing&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#spreed-video-conferencing&quot; aria-label=&quot;spreed video conferencing permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Spreed Video Conferencing&lt;/h3&gt;
&lt;p&gt;Spreed is a video conferencing server. It implements the WebRTC protocol, which is supported by most modern web browsers. Spreed supports audio and video chat and conferencing. It also supports screen sharing and text based chat.&lt;/p&gt;
&lt;p&gt;Spreed can be installed as a Docker container using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run &lt;span class=&quot;token parameter variable&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--name&lt;/span&gt; my-spreed-webrtc &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;:8080 &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8443&lt;/span&gt;:8443 &lt;span class=&quot;token parameter variable&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;`&lt;/span&gt;&lt;/span&gt;:/srv/extra &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; spreed/webrtc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Installation of Spreed is described on the &lt;a href=&quot;https://hub.docker.com/r/spreed/webrtc/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Docker repository page for Spreed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once the Spreed server is running, it will listen on port 8443. Like the Collabora Online server it also requires HTTPS. Next we need to enable and configure the Spreed plugin for NextCloud. Configuration involves specifying the public URL of the Spreed server.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;NextCloud is a useful tool for managing documents online. It is easy to install and is well supported by an active online community. It is included in this list of the &lt;a href=&quot;https://www.cloudwards.net/diy-cloud-storage-tools/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Best Cloud Storage tools of 2017&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Open Project - Collaborative Project Management]]></title><description><![CDATA[Open Project is an online project management application with collaboration features. It is one of the most popular open source project management software.]]></description><link>https://pakjiddat.netlify.app//posts/open-project---collaborative-project-management</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/open-project---collaborative-project-management</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Open Project is an online project management application with collaboration features. It is one of the most popular open source project management software.&lt;/p&gt;
&lt;p&gt;Open Project is written in Ruby and Angular Js. It is similar to &lt;a href=&quot;/posts/installing-and-configuring-redmine&quot;&gt;Redmine&lt;/a&gt; but has more features out of the box. For example features such as Agile &amp;#x26; Scrum and Mobile support are not present in Redmine by default but may be added using plugins. Also Redmine has better support for managing software projects, while Open Project supports all types of projects.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;Open Project provides support for all stages in a project’s life-cycle. Starting from Project conception and initiation to Project definition and planning, Project launch, Project performance and control and finally the Project closing stage.&lt;/p&gt;
&lt;p&gt;Features provided by Open Project include: &lt;strong&gt;Gannt Chart, Calendar, Roadmap, Issue Tracking, Activity Streams, Meetings, Agile &amp;#x26; Scrum, Cost Reports, Budgets, Wiki, News and Forum&lt;/strong&gt;. Open Project functionality can be enhanced using plugins. Open Project has an enterprise edition with more features than the community edition. It also has support for mobile devices.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Open Project installation is very simple and is described in the &lt;a href=&quot;https://www.openproject.org/download-and-installation/#installation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Open Project Installation Guide&lt;/a&gt;. To install Open Project on Debian Jessie we need to first install the packager.io repository signing key using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;wget&lt;/span&gt; -qO- https://dl.packager.io/srv/opf/openproject-ce/key &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; apt-key &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to install the HTTPS support for apt using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; apt-transport-https&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to add the OpenProject package source to the package manager source list. This can be done using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wget&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-O&lt;/span&gt; /etc/apt/sources.list.d/openproject-ce.list https://dl.packager.io/srv/opf/openproject-ce/stable/7/installer/debian/8.repo&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we can install the OpenProject software using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; openproject&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This should install Open Project to the folder: &lt;strong&gt;/opt/openproject&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Once the installation has ended, we need to configure the Open Project using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;openproject configure&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start the configuration wizard.&lt;/p&gt;
&lt;p&gt;The configuration wizard will prompt the user for a number of questions such as the MySQL server information, Git/Sub version integration options, Email configuration, HTTPS certificate settings, Web server configuration options and more. The configuration wizard also allows us to enter a path prefix for the openproject installation URL.&lt;/p&gt;
&lt;p&gt;Before starting the configuration wizard, we should have the MySQL database connection information, email settings and location of the HTTPS certificate files. If we don’t have this information with us, then we can cancel the wizard at any stage and then run it again. The wizard will resume from where it was interrupted. If we want to start the configuration process again we can issue the command: &lt;strong&gt;openproject reconfigure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;When the configuration process ends, it starts the openproject server on port 6000. It also configures all the required virtual host settings for Apache, if this option was selecting during the configuration. We should now be able to login to our Open Project installation at the URL that was specified during the configuration process.&lt;/p&gt;
&lt;p&gt;The default login information is &lt;strong&gt;admin/admin&lt;/strong&gt;. Once the user enters this information, he will be asked to enter a new admin password&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Open Project is a useful project management tool. It supports all stages of a Project’s life-cycle. Its design is user friendly with support for mobile devices. Its a good choice for managing projects&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Problems with accessing websites over local network using HaProxy and Pfsense]]></title><description><![CDATA[Recently I had problems with accessing websites over a network that was using HaProxy and Pfsense. The websites could be accessed without problems over the internet, but it was not possible to access the websites over local network. For example when connected to the network over VPN.]]></description><link>https://pakjiddat.netlify.app//posts/problems-with-accessing-websites-over-local-network-using-haproxy-and-pfsense</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/problems-with-accessing-websites-over-local-network-using-haproxy-and-pfsense</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had problems with accessing websites over a network that was using HaProxy and Pfsense. The websites could be accessed without problems over the internet, but it was not possible to access the websites over local network. For example when connected to the network over VPN&lt;/p&gt;
&lt;h3 id=&quot;the-network-topology&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-network-topology&quot; aria-label=&quot;the network topology permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Network Topology&lt;/h3&gt;
&lt;p&gt;Our network uses Pfsense as the gateway server. It uses HaProxy load balancer package for serving websites. The HaProxy allows us to run several websites spread over different virtual machines over a single IP address.&lt;/p&gt;
&lt;h3 id=&quot;problem-with-accessing-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problem-with-accessing-websites&quot; aria-label=&quot;problem with accessing websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problem with accessing websites&lt;/h3&gt;
&lt;p&gt;We could easily access the websites over the internet, but if we tried to access the website over the local network using the actual host name of the website, we got connection time out errors. It was simply not possible to access the website over local network.&lt;/p&gt;
&lt;p&gt;After days of troubleshooting the problem turned out to be very simple. The HaProxy package of Pfsense has an option called “Use Client-IP to connect to back end servers”. This option forwards connections to the back end web servers so it seems to the web servers that the connection request was sent directly by the client. But this option also adds some firewall rules that cause problems with accessing the website directly. As soon as we checked off this option we were able to access the websites over local network without problems.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The HaProxy package for Pfsense has some great features that greatly simplify hosting multiple websites. It has support for HTTPS and also supports load balancing and fail-over.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Pydio - Document management and Sharing]]></title><description><![CDATA[Pydio is a Secure File Management and Sync solution. It was formerly called AjaXplorer. Pydio stands for 'Put Your Data In Orbit'. It allows users to manage and share their files across devices. It has a customizable web interface and has clients for Desktop and Mobile devices.]]></description><link>https://pakjiddat.netlify.app//posts/pydio---document-management-and-sharing</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/pydio---document-management-and-sharing</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Pydio is a Secure File Management and Sync solution. It was formerly called AjaXplorer. Pydio stands for “Put Your Data In Orbit”. It allows users to manage and share their files across devices. It has a customizable web interface and has clients for Desktop and Mobile devices.&lt;/p&gt;
&lt;h3 id=&quot;features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://pydio.com/en/features&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Notable features of Pydio&lt;/a&gt; include support for different storage systems such as FTP, NFS and Dropbox. Support for multiple user management directories such as LDAP, Active Directory, Radius etc. Pydio is Open Source and provides a REST API.&lt;/p&gt;
&lt;p&gt;Its features can be extended using plugins. It provides a flexible dashboard for viewing server statistics and document usage. Pydio also supports Collaborative editing using &lt;a href=&quot;/posts/installing-nextcloud--collabora-and-spreed-on-debian-jessie&quot;&gt;Collabora Online&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Other notable features of Pydio include “Federated Cloud Sharing”, which allows users to share their data by connecting their Pydio clouds. Pydio also provides a “File Gateway”, which allows users to serve public links over a dedicated URL.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Pydio may be installed from package repository or from source. Installation from source is easy and is described in the article &lt;a href=&quot;https://pydio.com/en/docs/v8/install-archive&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Install from archive&lt;/a&gt;. To install from source, we need to first download the source code to the installation folder. After that we need to create a database and then run the installer from the web browser.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Pydio is a useful document management and sharing solution. It is similar to NextCloud but does not have as many plugins. Pydio can provide a useful frontend for storage systems. Here is a &lt;a href=&quot;https://www.cloudwards.net/the-top-5-cloud-companies-with-large-free-service-plans/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;list of the top free Cloud Storage providers of 2017&lt;/a&gt;, that can be used as storage systems for Pydio.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Securing your Email server]]></title><description><![CDATA[In this blog post I will describe my experience with installing, configuring and securing an email server. Many companies have their own email servers but one thing I noticed about in house email servers is that they are very unreliable.]]></description><link>https://pakjiddat.netlify.app//posts/securing-your-email-server</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/securing-your-email-server</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In this blog post I will describe my experience with installing, configuring and securing an email server. Many companies have their own email servers but one thing I noticed about in house email servers is that they are very unreliable.&lt;/p&gt;
&lt;p&gt;A very high percentage of emails sent to custom email addresses like &lt;a href=&quot;mailto:user@abccompany.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;user@abccompany.com&lt;/a&gt; cannot be delivered. The most likely cause is careless configuration of the email server. Email is a critical part of the I.T infrastructure so implementing email correctly is very important.&lt;/p&gt;
&lt;p&gt;The email server I installed and configured is called &lt;a href=&quot;http://www.postfix.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Postfix&lt;/a&gt;. Postfix is one of the most popular email servers. It runs on most Unix based servers such as AIX, BSD, HP-UX, Linux, MacOS X, Solaris etc. Best of all Postfix is free and open source.&lt;/p&gt;
&lt;h3 id=&quot;installing-and-configuring-postfix-email-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-and-configuring-postfix-email-server&quot; aria-label=&quot;installing and configuring postfix email server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing and configuring Postfix Email Server&lt;/h3&gt;
&lt;p&gt;Installing Postfix email server requires entering the command: &lt;strong&gt;yum install postfix&lt;/strong&gt; on Centos servers. After that you have to edit the &lt;strong&gt;main.cf&lt;/strong&gt; and &lt;strong&gt;master.cf&lt;/strong&gt; configuration files. Postfix website has some &lt;a href=&quot;http://www.postfix.org/BASIC_CONFIGURATION_README.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;useful documentation&lt;/a&gt; on basic configuration of Postfix.&lt;/p&gt;
&lt;p&gt;Some of the important Postfix configuration parameters are: &lt;strong&gt;myorigin, mydestination, mynetworks, relaydomains, relayhost, myhostname, mydomain and interfaces&lt;/strong&gt;. These parameters need to be changed in &lt;strong&gt;/etc/main.cf&lt;/strong&gt;. After the parameters have been updated, reload Postfix configuration with this command: &lt;strong&gt;postfix reload&lt;/strong&gt;. You should now be able to send email through your Postfix server from any device.&lt;/p&gt;
&lt;p&gt;Installation and basic configuration of Postfix will result in a fully operational mail server. But it does not guarantee reliable error free mail delivery. To ensure that your email is delivered reliably your mail server needs to be secured.&lt;/p&gt;
&lt;h3 id=&quot;securing-your-email-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#securing-your-email-server&quot; aria-label=&quot;securing your email server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Securing your email server&lt;/h3&gt;
&lt;p&gt;Email relies heavily on &lt;a href=&quot;http://en.wikipedia.org/wiki/Domain_Name_System&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DNS&lt;/a&gt;. Most of the techniques for securing email require changes to your domains DNS settings. Some of the steps that can be taken to secure email servers are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;open-relay-prevention&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#open-relay-prevention&quot; aria-label=&quot;open relay prevention permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Open_mail_relay&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Open Relay prevention&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Open Relay prevention should be the first step for securing your mail server. An Open Relay is an email server that allows anyone to send email to anyone. Open Relays are often used by malware for sending spam. To prevent Postfix from working as an open relay configure the &lt;strong&gt;relay_domains, mynetworks_style, mynetworks and relayhost&lt;/strong&gt; parameters in &lt;strong&gt;main.cf&lt;/strong&gt; and reload Postfix. Use an online tool such as &lt;a href=&quot;https://mxtoolbox.com/diagnostic.aspx&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Open Relay Test&lt;/a&gt; for checking if your mail server is working as an open relay.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;spam-prevention&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#spam-prevention&quot; aria-label=&quot;spam prevention permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Spamming&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Spam prevention&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Postfix has built in protection for preventing spam. The &lt;strong&gt;smtpd_recipient_restrictions&lt;/strong&gt; and &lt;strong&gt;smtpd_sender_restrictions&lt;/strong&gt; parameters in &lt;strong&gt;main.cf&lt;/strong&gt; file can be used to reduce spam.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;sender-policy-framework&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#sender-policy-framework&quot; aria-label=&quot;sender policy framework permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sender_Policy_Framework&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Sender Policy Framework&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;SPF is a security mechanism that restricts the mail servers that are allowed to send email for a given domain. It involves adding a TXT DNS record for your domain.&lt;/p&gt;
&lt;p&gt;This record specifies the IP addresses of the servers that are allowed to send email for your domain. When a mail server receives an email from your domain, it will check if your domain has a SPF DNS record. If is has a SPF record, then it will check if the server that sent the email is allowed to do so by your SPF DNS record.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;reverse-dns&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#reverse-dns&quot; aria-label=&quot;reverse dns permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Reverse_DNS_lookup&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Reverse DNS&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;DNS maps host names to IP addresses, while Reverse DNS does the opposite. i.e it maps IP addresses to host names. When an email server receives an email it may do a reverse lookup on the IP address of the server that sent the email. If the host name corresponding to the IP address does not match the host name of the sending email server then the email may be rejected.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;domainkeys-identified-mail&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#domainkeys-identified-mail&quot; aria-label=&quot;domainkeys identified mail permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.dkim.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DomainKeys Identified Mail&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;DKIM is a security mechanism that involves creating an encrypted email signature and verifying the signature. Like SPF, DKIM also relies on the DNS. To enable DKIM, the user has to first install a DKIM server. e.g on Centos that can be done with the command: &lt;strong&gt;yum install opendkim&lt;/strong&gt;. The main steps involved in configuring Open DKIM are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Generate a public/private key using the &lt;strong&gt;opendkim-gen&lt;/strong&gt; command.&lt;/li&gt;
&lt;li&gt;Specify the path of the keys in the &lt;strong&gt;opendkim.conf&lt;/strong&gt; configuration file.&lt;/li&gt;
&lt;li&gt;Give the name of the DKIM server in Postfix &lt;strong&gt;main.cf&lt;/strong&gt; configuration file.&lt;/li&gt;
&lt;li&gt;Enter the generated public key in a new TXT DNS record for your domain.&lt;/li&gt;
&lt;li&gt;After that the email messages you send through your mail server will contain a DKIM header field which contains the signature of the message. The receiving email server retrieves the private key from the DNS and uses it to verify the message. If the check fails, then the message may be discarded.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;domain-based-message-authentication-reporting-and-conformance-dmarc&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#domain-based-message-authentication-reporting-and-conformance-dmarc&quot; aria-label=&quot;domain based message authentication reporting and conformance dmarc permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/DMARC&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Domain Based Message Authentication, Reporting and Conformance&lt;/a&gt; (DMARC)&lt;/h4&gt;
&lt;p&gt;DMARC is a system for validating emails. It requires use of SPF and DKIM. It is the latest and most popular email validation system. It not only ensures that the received email is from a valid sender but also ensures the email has not been tampered with. It requires publishing encryption information in DNS records. DMARC allows the administrator to specify policies for handling email including policies on reporting the email.&lt;/p&gt;
&lt;p&gt;According to the Wikipedia entry for DMARC, in October 2013, &lt;a href=&quot;http://www.gnu.org/software/mailman/features.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mailman&lt;/a&gt; added support for DMARC and set the default DMARC policy to p=reject. In 2014 Yahoo and AOL both set their default DMARC policy to p=reject.&lt;/p&gt;
&lt;p&gt;According to the article &lt;a href=&quot;http://searchsecurity.techtarget.com/news/4500256096/Google-to-adopt-strictest-DMARC-policy-to-fight-spam-phishing?src=itke+disc&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Google to adopt strictest DMARC policy to fight spam, phishing”&lt;/a&gt;, Google will transition to the policy p=reject in June 2016. The policy p=reject implies that email that cannot be validated by DMARC will be rejected. In March 2015 &lt;a href=&quot;https://tools.ietf.org/html/rfc7489&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DMARC RFC 7489&lt;/a&gt; was published.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Secure DNS and Email settings greatly increases the reliability of your email server. They reduce the chance of your emails ending up as spam. There are some excellent on-line tools that can help you find problems with your Email and DNS configuration.&lt;/p&gt;
&lt;p&gt;For example &lt;a href=&quot;http://dnsstuff.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;dnsstuff&lt;/a&gt;, &lt;a href=&quot;http://mxtoolbox.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mxtoolbox&lt;/a&gt;, &lt;a href=&quot;https://www.emailsecuritygrader.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;emailsecuritygrader&lt;/a&gt;, &lt;a href=&quot;http://www.nmonitoring.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;nmonitoring&lt;/a&gt;, &lt;a href=&quot;http://centralops.net&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;centralops&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Having your own secure Email server can be very useful. You can customize it to your needs and integrate it with other services. You can achieve this goal with open source tools such as Postfix.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Setting up your own Content Delivery Network using Bind DNS]]></title><description><![CDATA[Recently I worked on constructing a simple Content Delivery Network using Bind DNS. I will share my experience in this blog post. Bind DNS is an open source DNS server. It is the most widely used DNS server. DNS is one of the building blocks of the internet. The main use of DNS is to translate domains names to IP Addresses. DNS also has other uses such as securing email.]]></description><link>https://pakjiddat.netlify.app//posts/setting-up-your-own-content-delivery-network-using-bind-dns</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/setting-up-your-own-content-delivery-network-using-bind-dns</guid><pubDate>Tue, 14 Nov 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I worked on constructing a simple Content Delivery Network using Bind DNS. I will share my experience in this blog post. &lt;a href=&quot;http://www.isc.org/downloads/bind/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bind DNS&lt;/a&gt; is an open source DNS server. It is the most widely used DNS server. DNS is one of the building blocks of the internet. The main use of DNS is to translate domains names to IP Addresses. DNS also has other uses such as securing email.&lt;/p&gt;
&lt;h3 id=&quot;main-function-of-a-content-delivery-network-cdn&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#main-function-of-a-content-delivery-network-cdn&quot; aria-label=&quot;main function of a content delivery network cdn permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Main function of a Content Delivery Network (CDN)&lt;/h3&gt;
&lt;p&gt;The main purpose of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Content_delivery_network&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Content Delivery Network&lt;/a&gt; is to deliver content such as images, audio/video files, JavaScript and CSS files.&lt;/p&gt;
&lt;p&gt;The CDN is configured to deliver content with low latency and high availability. Most of the data on social networks and popular websites such as WordPress and E-commerce websites is delivered using a CDN.&lt;/p&gt;
&lt;h3 id=&quot;anycast-dns-used-by-cdns&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#anycast-dns-used-by-cdns&quot; aria-label=&quot;anycast dns used by cdns permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Anycast DNS used by CDNs&lt;/h3&gt;
&lt;p&gt;Although CDNs use different protocols and technologies for delivering content securely and with high performance, a common feature of most CDNs is their use of Anycast method for resolving DNS queries.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Anycast&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Anycast&lt;/a&gt; is a network addressing and routing methodology by which data is sent to the nearest node. When Anycast is used with DNS, The DNS server returns the IP address of the host that is closest to the client that sent the DNS query. The client then fetches the content from this host.&lt;/p&gt;
&lt;h3 id=&quot;split-dns&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#split-dns&quot; aria-label=&quot;split dns permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Split DNS&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Split-horizon_DNS&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Split DNS&lt;/a&gt; is a technique supported by the DNS protocol which allows a DNS server to return different information depending on the source of the request.&lt;/p&gt;
&lt;p&gt;Bind DNS implements Split DNS with a feature called Views. To configure Views on a Bind DNS server you have to first create one View statement for each Geographical zone that needs to be served.&lt;/p&gt;
&lt;h3 id=&quot;implementing-split-dns-using-bind-views&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#implementing-split-dns-using-bind-views&quot; aria-label=&quot;implementing split dns using bind views permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Implementing Split DNS using Bind Views&lt;/h3&gt;
&lt;p&gt;Views are given in the Bind configuration file, &lt;strong&gt;named.conf&lt;/strong&gt;. The article &lt;a href=&quot;http://www.zytrax.com/books/dns/ch7/view.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“DNS BIND view Clause”&lt;/a&gt; has useful information on DNS Views. Then you have to add DNS records to each view. The records are returned to the client that has access to the View.&lt;/p&gt;
&lt;p&gt;Client access for views can be configured by adding &lt;strong&gt;match-clients&lt;/strong&gt; clause to each View. &lt;strong&gt;Match-clients&lt;/strong&gt; clause allows us to specify the IP addresses that have access to the View. These addresses can be given using &lt;a href=&quot;http://www.zytrax.com/books/dns/ch7/acl.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bind Access Control Lists&lt;/a&gt; or simple network address notation such as 192.168.1.0/24.&lt;/p&gt;
&lt;p&gt;Views are a very powerful feature of Bind DNS that allows DNS records to be served depending on the client. Usually the DNS records are served depending on the client’s geographical location. Configuring Views in Bind DNS is very simple.&lt;/p&gt;
&lt;h3 id=&quot;problems-with-using-bind-views&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#problems-with-using-bind-views&quot; aria-label=&quot;problems with using bind views permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Problems with using Bind Views&lt;/h3&gt;
&lt;p&gt;A problem with using Bind Views is that if the client users are spread across the world, then you will need to enter the network addresses of all possible clients. This can make your Bind configuration quite large.&lt;/p&gt;
&lt;p&gt;For example if you have one CDN server in Country A and one in Country B, then your Bind configuration will need to have all possible network addresses of Country A and Country B. So you will need one view statement for Country A and one view statement for Country B.&lt;/p&gt;
&lt;p&gt;Each view statement will need to have a &lt;strong&gt;match-clause&lt;/strong&gt; for that country. Clients located in Country A will then match view for Country A and will be served DNS records in that view. The IP addresses in these records should be of servers located in Country A.&lt;/p&gt;
&lt;p&gt;Same for Country B. What if a user is not in Country A or Country B. We will need a default View for such clients. This view can be defined using the clause: &lt;strong&gt;match-clients{ any;}&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Views in Bind are processed in the order in which they are defined, so the default view should be defined at the end. The main difficulty in implementing Split DNS using views is that you need to know the IP address range for countries. You can use a free database from &lt;a href=&quot;http://dev.maxmind.com/geoip/legacy/geolite/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MaxMind&lt;/a&gt;. However you will need to convert the network addresses in the database to a format that is compatible with Bind ACLs.&lt;/p&gt;
&lt;p&gt;Fortunately there are scripts available that allow us to do this. The article &lt;a href=&quot;http://phix.me/geodns/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“HOWTO Implement GeoDNS using BIND”&lt;/a&gt; demonstrates a script that downloads MaxMind database and converts network addresses to a format compatible with Bind ACLs. The script provides a file with all the converted network addresses grouped by country. Once you have configured the Bind views, all you need to do is upload content to your CDN servers. Your users should then be able to download files from the closest server.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Bind is a very powerful DNS server that has many features. Some of the different configurations of Bind are described in &lt;a href=&quot;http://www.zytrax.com/books/dns/ch4/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;DNS Configuration Types&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;DNS implemented using Bind forms the backbone of many important services such as email security, web browsing, content delivery networks etc. A good understanding of Bind will make it easier to learn about the different services that use DNS.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Pros and Cons of Technology in the light of Religion]]></title><description><![CDATA[Modern technology has transformed our lives. It has brought tremendous changes to culture, society and moral and social values. In this article I will try to express my views on how technology is affecting our lives and how religion can guide us in understanding technology.]]></description><link>https://pakjiddat.netlify.app//posts/pros-and-cons-of-technology-in-the-light-of-religion</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/pros-and-cons-of-technology-in-the-light-of-religion</guid><pubDate>Thu, 05 Oct 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Modern technology has transformed our lives. It has brought tremendous changes to culture, society and moral and social values. In this article I will try to express my views on how technology is affecting our lives and how religion can guide us in understanding technology.&lt;/p&gt;
&lt;h3 id=&quot;challenges-of-internet-and-mobile&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#challenges-of-internet-and-mobile&quot; aria-label=&quot;challenges of internet and mobile permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Challenges of Internet and mobile&lt;/h3&gt;
&lt;p&gt;Undoubtedly, the internet has created many new opportunities for people. Interacting with people over the internet has its own costs. It requires concentration and effort on the part of the individual.&lt;/p&gt;
&lt;p&gt;Understanding how to work efficiently over the internet is something that takes time and effort. These days interaction over the internet or mobile takes a significant part of a person’s time and energy. Since the internet is not a natural medium of interaction between people, spending excessive time on the internet can lead to physical and social problems.&lt;/p&gt;
&lt;p&gt;I think an unfortunate fact of today’s world is that the internet and mobile have diverted people away from natural physical interactions. The internet and mobile are not part of man’s natural environment. Today they may seem in-disposable, but a few decades from now they could be regarded as outdated. We should not let technology overwhelm us. Technology is at our disposal. It is upto us if we use or misuse it.&lt;/p&gt;
&lt;p&gt;We may think that technology is breaking up our societies. However I disagree with this statement. It is the misuse of technology that has created this impression. The misuse of technology has created paranoia, social and health related problems. Understanding how we are shooting ourselves in the foot with technology requires peaceful reflection on our own existence and why the Almighty created us and sent us in this world. This is where religion can help us.&lt;/p&gt;
&lt;h3 id=&quot;technology-in-the-light-of-religion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#technology-in-the-light-of-religion&quot; aria-label=&quot;technology in the light of religion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Technology in the light of religion&lt;/h3&gt;
&lt;p&gt;Technology has undoubtedly created social and health problems. The solution to this problem I believe is an understanding of religion. A person who understands and practices religion not only helps him self but also others.&lt;/p&gt;
&lt;p&gt;Religion is present in some form or the other in every society. It may seem outdated and old fashioned but it is in fact the solution to the most modern and sophisticated problems affecting individuals and society.&lt;/p&gt;
&lt;p&gt;The outcome of our actions reflects our belief system. We are judged by what we do as individuals and as a society. If we do good, we are appreciated for it. If we do bad we are condemned for it. Our success is measured by the good deeds that we do. No matter how much or how little science and technology we develop, whether we live in skyscrapers or in caves, we will be judged by our good deeds. Understanding this simple fact requires an effort in understanding and practicing religion.&lt;/p&gt;
&lt;p&gt;Not all people are gifted with the same amount of intellect or abilities. We have very little control or knowledge of the world around us. We should consult with the Almighty who created everything that we see and that which we cannot see. The Almighty did not just create the world and let it run on its own. He is very much alive and present and is waiting for us to ask him for help.&lt;/p&gt;
&lt;p&gt;Whatever peace is left in the world is because of the Almighty’s generosity and mercy. We should be grateful to the Almighty for all the blessings he gave us, is giving us and will give us as long as we live.&lt;/p&gt;
&lt;p&gt;True religion I believe does not prohibit or condemn technology. Nor does it impose barriers on our lives. I believe religion is here to guide us and help us to overcome our problems. It is up to us to impose the correct barriers and restrictions on our lives in the way that benefits us.&lt;/p&gt;
&lt;p&gt;Everything outside our bodies, including our clothes, is not a part of us. The world around us poses a challenge to our brains and bodies. Technology is just another challenge for us.&lt;/p&gt;
&lt;p&gt;This does not mean we should blame science and technology for all the problems of the world. Many of today’s problems appear to be caused by misuse of science and technology. For example weapons of mass destruction are highly sophisticated products of science and technology.&lt;/p&gt;
&lt;p&gt;The problem I believe is not science and technology itself but rather it is intention with which it is being used which is the problem. Why are we using our own brains and capabilities to destroy our own selves?. The answer to this problem I believe lies in reflecting upon the universe around us.&lt;/p&gt;
&lt;p&gt;We should start with nature since it has been and will always be present, independently of our own existence. We should reflect upon how the wonderful ecosystem of nature works and how much dependent we are on it. In short we should seek guidance from books like the Holy Quran which help us to reflect upon the reality of our own existence and help us to achieve the peace that we so greatly need.&lt;/p&gt;
&lt;h3 id=&quot;understanding-science-and-technology-in-the-light-of-islam&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#understanding-science-and-technology-in-the-light-of-islam&quot; aria-label=&quot;understanding science and technology in the light of islam permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Understanding science and technology in the light of Islam&lt;/h3&gt;
&lt;p&gt;Islam I believe is the only true religion. It is the most complete and comprehensive religious guide. It is equally applicable to the most simple and the most sophisticated of societies. Islam has been provided to us by a most merciful being who knows all and sees all. It is the system we should accept and use for improving our lives and our societies.&lt;/p&gt;
&lt;p&gt;How does Islam view science and technology?. Well in Islam science and technology are termed as Knowledge. Islam provides specific and clear guidelines on how to use this knowledge so we and our societies benefit from it.&lt;/p&gt;
&lt;p&gt;The application of Islam is upto us and our societies. We are free to practice Islam as we wish. It does not matter where we live or what our languages are. The message of Islam is universal and applies to all irrespective of their language or race.&lt;/p&gt;
&lt;p&gt;In order to understand Islam, we need to be sound in mind and body. There are five pillars of Islam. These are: &lt;strong&gt;Belief in one God, Establishment of Worship, Fasting, Charity and Pilgrimage&lt;/strong&gt;. Understanding of Islam requires practice and patience. Once we start with basics of Islam, our understanding and faith will grow and we will notice a positive change in our selves and our lives.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;In this article I have tried to discuss how Technology is affecting our lives and what role religion can play towards improving our understanding of technology and the world around us.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Adding drag and drop to list items]]></title><description><![CDATA[In order to drag and drop HTML list items, we need to set the draggable attribute of the list items to true. We also need to define event handlers on the list items for the following events: dragstart, drop and dragover.]]></description><link>https://pakjiddat.netlify.app//posts/adding-drag-and-drop-to-list-items</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/adding-drag-and-drop-to-list-items</guid><pubDate>Mon, 02 Oct 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;In order to drag and drop HTML list items, we need to set the draggable attribute of the list items to true. We also need to define event handlers on the list items for the following events: &lt;strong&gt;dragstart, drop and dragover&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;dragstart&lt;/strong&gt; event is called when the user starts to drag a list item. In this event, the user should do three things. Firstly set the allowed drag and drop event to ‘move’. Secondly save the inner html of the list item and thirdly save the list item object or an id of the list item object.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;drop&lt;/strong&gt; event is called when the user drops a list item. The event handler for this event should first prevent the default drop action of the browser, which is to open the dragged item in a new tab. The saved inner html of the original list item should be fetched and set to the innerHTML property of the current list item. The original list item should be fetched and its innerHTML property should be set to the innerHTML property of the current list item.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;dragover&lt;/strong&gt; event is called when the user drags a list item. The event handler for this event should prevent the default dragover action of the browser, which is to open the dragged item in a new tab.&lt;/p&gt;
&lt;p&gt;The following code can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** Listen for dragstart events */&lt;/span&gt;
list_item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;dragstart&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The allowed event is set to move */&lt;/span&gt;
  ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataTransfer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;effectAllowed          &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;move&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The html content of the list item is saved */&lt;/span&gt;
  ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataTransfer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;text/html&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The current list item object is set */&lt;/span&gt;
  current_list_item           &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** Listen for drop events */&lt;/span&gt;
list_item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;drop&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The default drop action is prevented */&lt;/span&gt;
  ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The saved list item html data is fetched */&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; data                               &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;dataTransfer&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;text/html&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The current list item html */&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; list_item_html                     &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The list item html is set */&lt;/span&gt;
  ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML                    &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;/** The original list item html is set */&lt;/span&gt;
  current_list_item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; list_item_html&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;/** Listen for drop events */&lt;/span&gt;
list_item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;dragover&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  ev&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code allows list items to be dragged and dropped. When a list item is dropped, the dropped item and the item on which the drop occurred are swapped.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://www.w3schools.com/html/html5_draganddrop.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3school’s guide on Html 5 Drag and Drop&lt;/a&gt; for more information on HTML 5 Drag and Drop.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[New features in HTML 5]]></title><description><![CDATA[HTML 5 is the latest version of the HTML specification after HTML 4.01. The HTML standard is maintained by the W3C.]]></description><link>https://pakjiddat.netlify.app//posts/new-features-in-html-5</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/new-features-in-html-5</guid><pubDate>Fri, 14 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;HTML 5 is the latest version of the HTML specification after HTML 4.01. The HTML standard is maintained by the W3C.&lt;/p&gt;
&lt;p&gt;HTML 5 contains many new features. The basic structure of a HTML 5 document is as follows:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;en&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;utf-8&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;HTML 5 has very loose type checking and does not require closing ’/’ for void tags such as meta tag or img tag. It also does not require enclosing quotation marks and optional attributes such as type attribute for script and link tags.&lt;/p&gt;
&lt;p&gt;Several tags are now considered as obsolete in HTML 5. e.g frame and frameset tags.&lt;/p&gt;
&lt;p&gt;Some new structural elements introduced in HTML 5 are: section, hroup, article, nav, aside, header, footer, address.&lt;/p&gt;
&lt;p&gt;HTML 5 supports following &lt;a href=&quot;http://w3c.github.io/html/textlevel-semantics.html#textlevel-semantics&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;inline elements&lt;/a&gt;: &amp;#x3C;b&gt; (bold text), &amp;#x3C;i&gt; (italics text), &amp;#x3C;em&gt; (for emphasizing text).&lt;/p&gt;
&lt;p&gt;HTML 5 also provides support for accessibility. The &lt;a href=&quot;https://www.w3.org/WAI/intro/aria&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WAI-ARIA standard&lt;/a&gt; makes web content and web applications more accessible to people with disabilities. One of the main features of WAI-ARIA is &lt;a href=&quot;https://www.w3.org/WAI/GL/wiki/Using_ARIA_landmarks_to_identify_regions_of_a_page&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;landmark roles&lt;/a&gt;. The role attribute can be added to any HTML element. The value of the role attribute indicates the use of the HTML element. e.g &lt;strong&gt;&amp;#x3C;nav role=“navigation”&gt;&lt;/strong&gt; implies the nav tag is used for navigation. The role attribute can have fixed values.&lt;/p&gt;
&lt;p&gt;HTML 5 provides the video and audio elements. It allows playback of video and audio files. The video element is used just like the img element. A video element can include several nested source elements. Each source element is a video source file. The audio element works similarly.&lt;/p&gt;
&lt;p&gt;HTML 5 also &lt;a href=&quot;/posts/making-webpages-work-offline&quot;&gt;allows offline access&lt;/a&gt;. To allow a HTML 5 application to be accessed offline, we need to add the manifest attribute to the HTML tag. The value of this attribute is the URL of the manifest file. The manifest file lists the resources that should be available to the application when it is offline. For example the images, CSS and JavaScript files&lt;/p&gt;</content:encoded></item><item><title><![CDATA[New features in CSS 3]]></title><description><![CDATA[CSS 3 is well supported in all major browsers. Old versions of Internet Explorer such as Explorer 6 support most CSS 3 modules. Modules such as Font Face module are not supported in old browsers.]]></description><link>https://pakjiddat.netlify.app//posts/new-features-in-css-3</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/new-features-in-css-3</guid><pubDate>Fri, 14 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;CSS 3 is well supported in all major browsers. Old versions of Internet Explorer such as Explorer 6 support most CSS 3 modules. Modules such as Font Face module are not supported in old browsers.&lt;/p&gt;
&lt;h4 id=&quot;rounded-corners&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rounded-corners&quot; aria-label=&quot;rounded corners permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Rounded Corners&lt;/h4&gt;
&lt;p&gt;In CSS 2.1 rounded corner affect could only be achieved using background images. CSS 3 provides the border-radius declaration which produces rounded corners. e.g .round {border-radius: 10px}&lt;/p&gt;
&lt;h4 id=&quot;vendor-prefixes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#vendor-prefixes&quot; aria-label=&quot;vendor prefixes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Vendor Prefixes&lt;/h4&gt;
&lt;p&gt;Vendor prefixes are strings that are prepended to CSS 3 properties that are not supported by all browsers. e.g -khtml- prefix is for Konqueror web browser. -rim- prefix is for Rim browser. -ms- prefix is for Internet Explorer browser. -o- prefix is for Opera browser. -moz- prefix is for Mozilla Firefox browser. -webkit- prefix is for Chrome and Safari browsers. CSS styles are cascaded which means the styles lower down the order are applied later. Also more specific CSS selectors take precedence over less specific CSS selectors.&lt;/p&gt;
&lt;h4 id=&quot;multiple-columns&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#multiple-columns&quot; aria-label=&quot;multiple columns permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Multiple Columns&lt;/h4&gt;
&lt;p&gt;CSS 3 also allows dividing content into columns. For example it can divide content into columns of certain width or certain number of columns. The following code shows how this works:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;main&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  column 1 text
  column 2 text
  column 3 text
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;

&lt;span class=&quot;token selector&quot;&gt;#main&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;column-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 12em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/** It will set the width of each column equal to 12 em; * OR use below style: */&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;column-count&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/** It will divide the content into 4 columns */&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;word-wrap&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#word-wrap&quot; aria-label=&quot;word wrap permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Word Wrap&lt;/h4&gt;
&lt;p&gt;CSS 3 provides the word-wrap style which allows wrapping a word if it exceeds the bounds of its container. e.g &lt;strong&gt;#main {word-wrap: break-word;}&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;attribute-selectors&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#attribute-selectors&quot; aria-label=&quot;attribute selectors permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Attribute Selectors&lt;/h4&gt;
&lt;p&gt;CSS 3 provides attribute selectors. It allows selecting a HTML tag with a certain attribute. e.g:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;img[alt]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px dashed #e15f5f&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Applies a dashed border to all images on the page with alt attribute.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;img[alt=&quot;film&quot;]&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3px dashed #e15f5f&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Applies a dashed border to all images on the page with alt attribute that starts with “film”. If alt*=“film” was used instead, then it would match all images with alt tag containing the text film. If alt$=“film” was used then it would match all images with alt tag that ends with film. CSS 3 also allows id values to start with a number. e.g id=“1940year”.&lt;/p&gt;
&lt;h4 id=&quot;css3-structural-pseudo-classes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#css3-structural-pseudo-classes&quot; aria-label=&quot;css3 structural pseudo classes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CSS3 structural pseudo-classes&lt;/h4&gt;
&lt;p&gt;CSS 3 also introduces the following selectors known as pseudo-classes: &lt;strong&gt;:nth-child(n), :nth-lastchild(n), :nth-of-type(n), and :nth-last-of-type(n)&lt;/strong&gt;, where n can be a number, arithmetic progression, odd, even. e.g:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;nav ul li:nth-child(2n+3) a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fe0208&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will apply the color to all list items with position 3, 5, 7, 9 and so on.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;nav ul li:not(.internal) a&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #fe0208&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will apply the color to all list items with class not equal to internal and that contain &amp;#x3C;a&gt; tag.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;li:: first-line {color: red;}&lt;/strong&gt; will apply the color red to the fist line in the list tag.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;p::after&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; - Remember this&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;will apply the content after the paragraph tag&lt;/p&gt;
&lt;h4 id=&quot;custom-web-typograhpy&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#custom-web-typograhpy&quot; aria-label=&quot;custom web typograhpy permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Custom Web Typograhpy&lt;/h4&gt;
&lt;p&gt;CSS 3 also allows the use of custom font types using the @font-face syntax. e.g:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@font-face&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;BebasNeueRegular&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;token property&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string url&quot;&gt;&apos;BebasNeue-webfont.eot&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Will load the font file BebasNeue-webfont.eot and make give it the font-family name of BebasNeueRegular. Following are the main types of fonts used for websites:  Embedded OpenType (EOT), TrueType (TTF), Scalable Vector Graphics (SVG) and Web Open Font Format (WOFF).&lt;/p&gt;
&lt;h4 id=&quot;responsive-font-size-unit&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#responsive-font-size-unit&quot; aria-label=&quot;responsive font size unit permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Responsive font size unit&lt;/h4&gt;
&lt;p&gt;CSS 3 introduced the vw unit, which implies percentage of the viewport. e.g: h1 { font-size: 8vw }, implies the font size is 8% of the viewport width. e.g if viewport width is 200mm, then font-size of h1 elements will be 16mm.&lt;/p&gt;
&lt;h4 id=&quot;new-color-formats-and-alpha-transparency&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#new-color-formats-and-alpha-transparency&quot; aria-label=&quot;new color formats and alpha transparency permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;New Color formats and Alpha transparency&lt;/h4&gt;
&lt;p&gt;CSS 3 introduced following new color formats: RGB, HSL. RGBA and HSLA allow specifying the alpha transparency. Alpha transparency allows the opacity value of a certain tag to be set. For example a certain portion of a page can have a different opacity then the other portions.&lt;/p&gt;
&lt;h4 id=&quot;some-useful-websites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#some-useful-websites&quot; aria-label=&quot;some useful websites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Some useful websites:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.internetadvisor.com/best-internet-browser&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.internetadvisor.com/best-internet-browser&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://caniuse.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://caniuse.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.fontsquirrel.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://www.fontsquirrel.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/TR/css3-values/#viewport-relative-lengths&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://www.w3.org/TR/css3-values/#viewport-relative-lengths&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/logic-in-media-queries/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://css-tricks.com/logic-in-media-queries/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Server Monitoring with Munin]]></title><description><![CDATA[Server monitoring is a useful task that is performed by server administrators. Server monitoring involves keeping a check on the various parts of a server such as its CPU, Memory, Hard Disk, Network Traffic, Services and more. Server monitoring can avoid problems that can disrupt services.]]></description><link>https://pakjiddat.netlify.app//posts/server-monitoring-with-munin</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/server-monitoring-with-munin</guid><pubDate>Fri, 14 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Server monitoring is a useful task that is performed by server administrators. Server monitoring involves keeping a check on the various parts of a server such as its CPU, Memory, Hard Disk, Network Traffic, Services and more. Server monitoring can avoid problems that can disrupt services. For example a timely alert for a failing hard disk can allow the server administrator to replace the hard drive before its too late.&lt;/p&gt;
&lt;p&gt;Munin is a well know server monitoring tool that allows monitoring all aspects of a server. Although it is regarded as a network monitoring tool, it can do much more than monitor network traffic. It can infact monitor most services. These services may be on switches, routers or servers. Munin uses &lt;a href=&quot;https://en.wikipedia.org/wiki/RRDtool&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Round Robin Database (RRD) tool&lt;/a&gt; for storing the data.&lt;/p&gt;
&lt;p&gt;Munin works by collecting data from the services being monitored. This data is stored in RRD files. The data in these files is then displayed on graphs. &lt;a href=&quot;https://en.wikipedia.org/wiki/RRDtool&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Round Robin Database (RRD) tool&lt;/a&gt; is a standard for storing data which varies with time such as network bandwidth, CPU load, temperature etc.&lt;/p&gt;
&lt;h3 id=&quot;architecture&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#architecture&quot; aria-label=&quot;architecture permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Architecture&lt;/h3&gt;
&lt;p&gt;The Munin architecture consists of three main parts. The Munin master, the Munin Node and Munin plugins. The Munin master and nodes have a client server relationship. In a typical Munin installation, there is one Munin master and one or more Munin nodes. The Munin nodes may collect data from remote devices such as switches, routers, firewalls, gateways etc using standard protocols such as SNMP and SSH.&lt;/p&gt;
&lt;p&gt;The job of the Munin master is to poll the Munin nodes at regular intervals for data. It stores the data in RRD files. It sends alerts in case the data values exceed certain thresholds. For example it can send an email if the CPU usage exceeds a certain value.&lt;/p&gt;
&lt;p&gt;The Munin master also generates graphs from the data. It consists of following components: &lt;strong&gt;munin-cron&lt;/strong&gt; is the main script that runs the Munin master. It is run every 5 minutes by default. It calls the scripts &lt;strong&gt;munin-update&lt;/strong&gt; which collects data from Munin nodes and munin-limit which checks if the data values are within the threshold limits.&lt;/p&gt;
&lt;p&gt;The Munin node runs on one or more servers as a cron job. It listens on TCP port 4949. It executes the Munin plugins and returns the data for each plugin to the Munin server.&lt;/p&gt;
&lt;p&gt;Munin Plugins are basically scripts that return the time series data for the service being monitored as well as information on how to graph the data. Munin plugins can be written in any programming language, although they are usually written in Perl.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Munin can be installed either from source code or from package repositories. The &lt;a href=&quot;http://munin.readthedocs.io/en/latest/installation/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Munin installation guide&lt;/a&gt; strongly recommends installing from package repositories.&lt;/p&gt;
&lt;p&gt;On Centos, Munin is part of the default package repositories and can be installed with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; munin munin-node&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install the latest stable version of Munin. As of now the stable version of Munin is 2.0.30. The development version of Munin is 2.999.6. The development version has a much better user interface as can be seen from this &lt;a href=&quot;http://demo.munin-monitoring.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;demo&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;After installing Munin, the next step is to configure it so it monitors the required services. To configure Munin we need to add the host names of the Munin nodes in the Munin server configuration file. This is usually &lt;strong&gt;/etc/munin/munin.conf&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We also need to copy the plugin files to the Munin service directory which is /etc/munin/plugins. The service directory contains symbolic links to the actual plugins files. There are two types of Munin plugins. The core plugins which are part of the Munin installation and the &lt;a href=&quot;http://gallery.munin-monitoring.org/contrib/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Third party plugins&lt;/a&gt; which are developed by various contributors.&lt;/p&gt;
&lt;p&gt;The core plugins are part of the Munin installation and are usually located in /usr/share/munin/plugins. To Install a Munin plugin, we simply have to create a symbolic link inside the service directory which points to the actual plugin file. For example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; /usr/share/plugins/http_loadtime /etc/munin/plugins/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we need to restart the Munin node service using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt; munin-node restart&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The munin-node service needs to be restarted after changes to the Munin configuration files or plugins. Third party plugins may be downloaded to any location. They can be installed by simply adding a symbolic link to the actual plugin file.&lt;/p&gt;
&lt;p&gt;A Munin plugin usually monitors one service. However it is possible for a Munin plugin to monitor several services. A Munin wildcard plugin can monitor several services. By convention the name of a wildcard plugin ends with &lt;strong&gt;”_”&lt;/strong&gt;. For example the mysql_ core plugin is a wildcard plugin. It monitors several services such as MySQL network traffic, MySQL slow queries, mysql innodb buffer pool etc.&lt;/p&gt;
&lt;p&gt;To get the list of services monitored by a wildcard plugin we can run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;munin-run plugin_name suggest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;munin-run&lt;/strong&gt; command allows us to test run the plugin. To monitor one of the services supported by the mysql plugin for example the mysql slow queries, we can use the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; /usr/share/munin/plugins/mysql_ /etc/munin/plugins/mysql_slow&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can have several plugins that all point to the same mysql_ plugin file.&lt;/p&gt;
&lt;h3 id=&quot;troubleshooting&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#troubleshooting&quot; aria-label=&quot;troubleshooting permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Troubleshooting&lt;/h3&gt;
&lt;p&gt;Munin errors are stored in log files located at &lt;strong&gt;/var/log/munin&lt;/strong&gt; and &lt;strong&gt;/var/log/munin-node&lt;/strong&gt;. The most important log files to monitor are: &lt;strong&gt;/var/log/munin/munin-update.log&lt;/strong&gt;, which contains log messages reported by the Munin master during data collection and &lt;strong&gt;/var/log/munin-node/munin-node.log&lt;/strong&gt;, which contains log messages reported by the Munin node.&lt;/p&gt;
&lt;p&gt;Sometimes Munin log files report plugin timeout errors. An interesting approach to fix such problems was discussed on Server Fault. The question is titled: &lt;a href=&quot;https://serverfault.com/questions/542232/munin-mysql-plugins-results-inconsistent-with-ipcsharelite-store-error-ide&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Munin mysql plugins results inconsistent, with IPC::Sharelite store() error: Identifier removed”&lt;/a&gt;. It discussed errors reported by the Munin mysql_ wildcard plugin.&lt;/p&gt;
&lt;p&gt;This plugin uses shared memory for storing data. Sometimes access to the shared memory can be blocked by a semaphore. The solution to the problem was to use strace tool to find the semaphore id and then use the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ipcrm &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; semaphore-id&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to remove the semaphore. This solution was very useful for me as it fixed all the errors reported by Munin node.&lt;/p&gt;
&lt;p&gt;Munin provides a web interface which displays the graphs of the monitored services. Configuring the web interface can be a bit tricky because of SeLinux or server management tools such as Plesk or Cpanel.&lt;/p&gt;
&lt;p&gt;The current version of Munin which is 2.0.30 contains a virtual host configuration file for Apache server which simplifies the task of configuring the web interface. This configuration file may need to be updated depending on the Munin installation paths.&lt;/p&gt;
&lt;p&gt;The development version of Munin contains a built in web server called munin-httpd which handles the task of serving html files and graph images. The munin-httpd can easily be served over a reverse proxy server such as Nginx or Apache.&lt;/p&gt;
&lt;p&gt;Munin graphs and HTML files can be generated in two ways. They can either be generated at regular intervals using the &lt;strong&gt;munin-graph&lt;/strong&gt; and &lt;strong&gt;munin-html&lt;/strong&gt; scripts or they can be generated on demand using the cgi scripts &lt;strong&gt;munin-cgi-graph&lt;/strong&gt; and &lt;strong&gt;munin-cgi-html&lt;/strong&gt;. Since graph generation can consume significant amount of CPU and Memory, some users may prefer to generate the graphs on demand. Configuration of on demand graph generation requires modification of the Apache virtual host configuration file and can be a bit tricky.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Munin can monitor almost any time related activity with the help of plugins. There are Munin plugins for monitoring different types of services such as LDAP, Snort, Bind Dns, Mysql, Apache etc.&lt;/p&gt;
&lt;p&gt;There is even a Munin plugin for monitoring the PageSpeed score of a web page. While Munin runs only on Linux based operating systems, it can monitor services running on Windows operating system. Munin is a very useful Server Monitoring tool with many features.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[What are CSS Media Queries]]></title><description><![CDATA[CSS Media Queries allow us to use CSS rules for particular media]]></description><link>https://pakjiddat.netlify.app//posts/what-are-css-media-queries</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/what-are-css-media-queries</guid><pubDate>Fri, 14 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;CSS Media Queries allow us to use CSS rules for particular media&lt;/p&gt;
&lt;p&gt;Media Queries are a new feature of CSS3. CSS 2.1 also supported Media specific styles. For example the media attribute of the link tag allows us to use different style sheets for different media. For example print or screen media.&lt;/p&gt;
&lt;p&gt;CSS Media Queries are used inside CSS Style Sheets. They have the format: &lt;strong&gt;@media query {css_rules}&lt;/strong&gt;, where query is the CSS query and CSS_rules are the CSS rules that are applied when the query returns true.&lt;/p&gt;
&lt;p&gt;The query parameter can have different values such as the device width. e.g the following media query sets the background color to red if the screen width is 960px or less.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; screen &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 960px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;


&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; screen &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-device-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 960px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above media query sets the body background color if the maximum device width is 960px or less.&lt;/p&gt;
&lt;p&gt;Multiple media queries can be used and separated either with and or with ’,‘. ’,’ has same affect as ‘or’ operator.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[What are CSS Grid Systems]]></title><description><![CDATA[CSS Grid Systems are CSS style-sheets that contain commonly used CSS classes. These CSS classes can be applied to HTML elements such as div tags. They provided functionalities such as tables and grids. The CSS classes are responsive so they work on devices of different sizes.]]></description><link>https://pakjiddat.netlify.app//posts/what-are-css-grid-systems</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/what-are-css-grid-systems</guid><pubDate>Fri, 14 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;CSS Grid Systems are CSS style-sheets that contain commonly used CSS classes. These CSS classes can be applied to HTML elements such as div tags. They provided functionalities such as tables and grids. The CSS classes are responsive so they work on devices of different sizes.&lt;/p&gt;
&lt;p&gt;Following are some commonly used CSS Grid Systems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://getskeleton.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Skeleton&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://lessframework.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Less Framework&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;CSS Grid Systems can be used to create the main layout for a website. More advanced CSS Grid Systems such as the Twitter Bootstrap Library are complete responsive frameworks, that allow construction of fully responsive websites.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Advantages of HTML 5 validation]]></title><description><![CDATA[In this blog post I will discuss briefly the importance of HTML 5 and how to create standards compliant HTML code.]]></description><link>https://pakjiddat.netlify.app//posts/advantages-of-html-5-validation</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/advantages-of-html-5-validation</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In this blog post I will discuss briefly the importance of HTML 5 and how to create standards compliant HTML code.&lt;/p&gt;
&lt;h3 id=&quot;unified-programming-language&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#unified-programming-language&quot; aria-label=&quot;unified programming language permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Unified Programming language&lt;/h3&gt;
&lt;p&gt;HTML 5 is the latest version of HTML that is currently supported on all major web browsers. It is widely used in the development of not only web sites but also mobile applications and even desktop applications. For example Windows 10 has built in apps that can be created using simple HTML and JavaScript. HTML 5 can provide a unified programming language that can be used to create applications that can run on a wide range of devices.&lt;/p&gt;
&lt;h3 id=&quot;built-in-support-for-audio-and-video&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#built-in-support-for-audio-and-video&quot; aria-label=&quot;built in support for audio and video permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Built in support for audio and video&lt;/h3&gt;
&lt;p&gt;HTML 5 provides built in support for many of the features that previously required third party libraries. For example video and audio are supported by default in HTML 5. We no longer need to learn third party libraries in order to embed video and audio.&lt;/p&gt;
&lt;h3 id=&quot;w3c-html-5-standard&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#w3c-html-5-standard&quot; aria-label=&quot;w3c html 5 standard permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;W3C HTML 5 Standard&lt;/h3&gt;
&lt;p&gt;W3C is an international organization whose main job is to create Web Standards such as HTML 5. The W3C HTML 5 specification describes the correct syntax of HTML 5. Code that is written according to these specifications is considered to be correct and well written.&lt;/p&gt;
&lt;p&gt;W3C has a web based tool on &lt;a href=&quot;http://validator.w3.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://validator.w3.org/&lt;/a&gt;. It allows us to see if our code conforms to W3C standards. HTML 5 code that conforms to standards will be supported by more devices and its performance is easier to predict. It will also be easier to process by automated tools such as search engines.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;One of the main differences between HTML 5 and previous version of HTML is that HTML 5 disallows the use of tag attributes related to styling. e.g table width. These attributes need to be expressed using CSS. With a little practice it should be easy to write standards compliant HTML 5 code. The &lt;a href=&quot;http://www.w3schools.com/html/default.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3 Schools website&lt;/a&gt; is a useful resource for learning about HTML 5.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Backup your data!]]></title><description><![CDATA[Recently I had the misfortune of losing months of precious work. This blog post is about my unlucky experience of loosing data. Hopefully it reminds the I.T people who read this article about the importance of a good backup.]]></description><link>https://pakjiddat.netlify.app//posts/backup-your-data</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/backup-your-data</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the misfortune of losing months of precious work. This blog post is about my unlucky experience of loosing data. Hopefully it reminds the I.T people who read this article about the importance of a good backup. While working for a client I deleted some important files by mistake, and guess what there was no backup !. Well there was a backup but it was 2 months old. At least all was not lost.&lt;/p&gt;
&lt;h3 id=&quot;the-problem&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-problem&quot; aria-label=&quot;the problem permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The problem&lt;/h3&gt;
&lt;p&gt;It happened while I was managing a Linux based server for a client. I entered the normal &lt;strong&gt;rm * -rf&lt;/strong&gt; command, but from within the wrong directory!. That got me in a panic. I searched the internet for data recovery solutions but could not find one that could be used.&lt;/p&gt;
&lt;p&gt;I only had SSH access to the server and could not unmount the disk that had the missing data. Thankfully I had an old backup. I thought my client would be angry at me, but strangely, he also had problems with his data backup. So he was understanding and considerate about the whole issue.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Even the most skilled I.T workers can make mistakes. A good secure backup is essential in any I.T environment. Its easy to get distracted and loose precious data by mistake. My advice is to have a good backup before starting work!.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Closing Unnecessary email accounts]]></title><description><![CDATA[If you want to keep your email organized, then it might be a good idea to have just one email account. Recently I decided to organize my email by closing email accounts that I don't use frequently. This article provides some points on how to organize your email.]]></description><link>https://pakjiddat.netlify.app//posts/closing-unnecessary-email-accounts</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/closing-unnecessary-email-accounts</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;If you want to keep your email organized, then it might be a good idea to have just one email account. Recently I decided to organize my email by closing email accounts that I don’t use frequently. This article provides some points on how to organize your email.&lt;/p&gt;
&lt;p&gt;Keeping track of several email accounts can create stress and reduce productivity. Accessing all your email from one account can greatly simply work routines.&lt;/p&gt;
&lt;p&gt;I think its a good idea to close email accounts that you do not use frequently. But what if you have important email in those accounts. Or what if you cannot close your email accounts. Fortunately there is a solution for both these cases.&lt;/p&gt;
&lt;h3 id=&quot;transferring-email-from-one-account-to-another&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#transferring-email-from-one-account-to-another&quot; aria-label=&quot;transferring email from one account to another permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Transferring email from one account to another&lt;/h3&gt;
&lt;p&gt;If you want to close your email account but still keep your email, then you can transfer your email from the account you want to close to some other email account. You can do this using a tool called &lt;a href=&quot;http://imapsync.lamiral.info&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ImapSync&lt;/a&gt;. ImapSync is a useful tool that lets you transfer email from one IMAP account to another.&lt;/p&gt;
&lt;p&gt;The tool has no graphical user interface and is run from the command line. The tool is written by Gilles Lamiral in Perl language. It supports all major operating systems. i.e Windows, Linux and Mac OS X.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://imapsync.lamiral.info/#install&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installation guides&lt;/a&gt; are available for all major operating systems. Once the tool has been installed it can be run using the command &lt;strong&gt;imapsync&lt;/strong&gt;. Here is an example usage of the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;./imapsync &lt;span class=&quot;token parameter variable&quot;&gt;--host1&lt;/span&gt; test1.lamiral.info   &lt;span class=&quot;token parameter variable&quot;&gt;--user1&lt;/span&gt; test1   &lt;span class=&quot;token parameter variable&quot;&gt;--password1&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;secret1&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
           &lt;span class=&quot;token parameter variable&quot;&gt;--host2&lt;/span&gt; test2.lamiral.info   &lt;span class=&quot;token parameter variable&quot;&gt;--user2&lt;/span&gt; test2   &lt;span class=&quot;token parameter variable&quot;&gt;--password2&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;secret2&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
           &lt;span class=&quot;token parameter variable&quot;&gt;--automap&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--justfolders&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--dry&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$@&lt;/span&gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above command copies all email from the host test1.lamiral.info to test2.lamiral.info. The user name for test1.lamiral.info is test1 and for test2.lamiral.info it is test2&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;automap&lt;/strong&gt; option automatically maps the source IMAP folders to the destination IMAP folders. The &lt;strong&gt;justfolders&lt;/strong&gt; option only creates the folders while the dry option implies no data is actually transferred. These two options are useful for testing the email transfer without actually transferring any email&lt;/p&gt;
&lt;p&gt;To see all the options of the imapsync tool you can use the &lt;strong&gt;—help&lt;/strong&gt; option. To start the email transfer you have to remove the &lt;strong&gt;justfolders&lt;/strong&gt; and &lt;strong&gt;dry&lt;/strong&gt; options. This will start the transfer of emails from host 1 to host 2. In this case from test1.lamiral.info to test2.lamiral.info&lt;/p&gt;
&lt;p&gt;Transferring of emails can be a bit slow depending on the bandwidth of your email servers. If you want to transfer several thousand emails then it can take days to complete the transfer. Fortunately the tool caches some of the data so next time you run the tool the email transfer resumes from where it stopped&lt;/p&gt;
&lt;h3 id=&quot;forwarding-emails-from-one-account-to-another&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#forwarding-emails-from-one-account-to-another&quot; aria-label=&quot;forwarding emails from one account to another permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Forwarding emails from one account to another&lt;/h3&gt;
&lt;p&gt;If you dont want to close your email account, then it may be possible to configure the email account so it forwards all your email to another email account. Most email providers support email forwarding. Gmail in particular has very good support for email forwarding&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Email is a very popular means of communication. However it can become difficult to manage if its not organized. ImapSync is a very useful tool that allows you to transfer your email messages between different servers. It can be used to consolidate all your email in one account. The tool is very popular and is well documented.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Continuous integration and Project Management with Jenkins and Redmine]]></title><description><![CDATA[Recently I had the opportunity of installing and configuring Jenkins Continuous Integration Server and Redmine. Both of these tools are becoming increasingly popular because they simplify and organize the Software Development Process]]></description><link>https://pakjiddat.netlify.app//posts/continuous-integration-and-project-management-with-jenkins-and-redmine</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/continuous-integration-and-project-management-with-jenkins-and-redmine</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of installing and configuring &lt;a href=&quot;https://en.wikipedia.org/wiki/Jenkins_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jenkins Continuous Integration Server&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Redmine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine&lt;/a&gt;. Both of these tools are becoming increasingly popular because they simplify and organize the Software Development Process&lt;/p&gt;
&lt;h3 id=&quot;what-is-jenkins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-is-jenkins&quot; aria-label=&quot;what is jenkins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What is Jenkins&lt;/h3&gt;
&lt;p&gt;Jenkins Continuous Integration Server is a great tool that provides an interface combining all the steps involved in the Software Build Process.&lt;/p&gt;
&lt;p&gt;It can automate many of the tasks that can take up a lot of time and attention of the software developer such as: compiling code, deploying code to different locations, running code tests, committing code to version control repositories, updating issue tracker etc&lt;/p&gt;
&lt;p&gt;Jenkins has almost 1,000 plugins that integrate it with other systems such as &lt;a href=&quot;https://en.wikipedia.org/wiki/GitHub&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Github&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/GNU_Bazaar&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bazaar&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Redmine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bitbucket&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bitbucket&lt;/a&gt; etc. Jenkins is a server based system written in Java that runs in a Servlet Container such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Apache_Tomcat&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Tomcat&lt;/a&gt;. It can be accessed from the browser as well as the command line.&lt;/p&gt;
&lt;p&gt;Jenkins itself does not perform tasks such testing or compiling code, it only provides a front-end for code testing and compilation tools. For example it allows us to add tools and scripts and run them from a user friendly interface.&lt;/p&gt;
&lt;h3 id=&quot;installing-jenkins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-jenkins&quot; aria-label=&quot;installing jenkins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Jenkins&lt;/h3&gt;
&lt;p&gt;Jenkins runs on port 8080 by default. To run Jenkins over https, you can easily configure Apache with mod_proxy so it serves Jenkins over https.&lt;/p&gt;
&lt;p&gt;Installation of Jenkins is very simple. On Redhat based systems you can use the command &lt;strong&gt;yum install jenkins&lt;/strong&gt; to install the Jenkins server. The Jenkins wiki describes the &lt;a href=&quot;https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation steps&lt;/a&gt; in detail.&lt;/p&gt;
&lt;h3 id=&quot;running-builds-in-jenkins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-builds-in-jenkins&quot; aria-label=&quot;running builds in jenkins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running builds in Jenkins&lt;/h3&gt;
&lt;p&gt;Jenkins user interface is very easy to follow. You create projects and then configure them by specifying scripts that need to run when the project is built.&lt;/p&gt;
&lt;p&gt;After a project is configured it can be run by simply clicking on a button. This is called running a build. A build essentially runs the scripts that are configured in a project. The result of the build is indicated by a circle. If the circle is red then the build is said to have failed. If the circle is green then the build passed. If one of the scripts in the project returns an error code then the build fails.&lt;/p&gt;
&lt;h3 id=&quot;use-casedeploying-wordpress-with-jenkins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#use-casedeploying-wordpress-with-jenkins&quot; aria-label=&quot;use casedeploying wordpress with jenkins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Use Case: Deploying WordPress with Jenkins&lt;/h3&gt;
&lt;h4 id=&quot;deployment-scenario&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deployment-scenario&quot; aria-label=&quot;deployment scenario permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deployment Scenario&lt;/h4&gt;
&lt;p&gt;I had used Jenkins to simplify WordPress deployment. I was developing WordPress themes and plugins. I had setup a development site where I did the development work. There were two copies of the live site that were load balanced. Each site was behind a varnish caching server. So every time the development site was updated, both live sites had to be updated and all varnish caches had to be cleared.&lt;/p&gt;
&lt;p&gt;Furthermore JavaScript and CSS files had to be copied over to the Content Delivery Network Server. Also the cache files of the live sites had to be cleared as well.&lt;/p&gt;
&lt;h4 id=&quot;deployment-script&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deployment-script&quot; aria-label=&quot;deployment script permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deployment Script&lt;/h4&gt;
&lt;p&gt;Manually clearing cache files and copying content from CDN took a lot of time and effort. I decided to write a script for automating the deployment. The script takes following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;user name of a support user account with sudo privileges. this account should exist on all servers&lt;/li&gt;
&lt;li&gt;host name of the live server&lt;/li&gt;
&lt;li&gt;password for the support user&lt;/li&gt;
&lt;li&gt;password for MySQL user on live server&lt;/li&gt;
&lt;li&gt;password for MySQL user on dev server&lt;/li&gt;
&lt;li&gt;user who owns the WordPress files on live server. this is usually same as the user under which Apache runs. e.g Apache or www&lt;/li&gt;
&lt;li&gt;deployment option. this option indicates what needs to be copied to the live server. It can have following values:  &lt;strong&gt;‘all’&lt;/strong&gt; implies copy all WordPress files and database, &lt;strong&gt;‘database_only’&lt;/strong&gt; implies copy only the database to the live servers, &lt;strong&gt;‘custom_theme_and_plugin_files_only’&lt;/strong&gt; implies copy only the custom WordPress theme and custom WordPress plugin files. I use this option when I make some small changes to the custom plugins or theme. Its useful because it only copies the plugin and theme files.&lt;/li&gt;
&lt;li&gt;deployment type. this can have two values. &lt;strong&gt;“dev_to_live”&lt;/strong&gt; which copies the website from dev site to live sites and &lt;strong&gt;“live_to_dev”&lt;/strong&gt; which copies the website from live sites to dev site.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;adding-the-script-to-jenkins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-the-script-to-jenkins&quot; aria-label=&quot;adding the script to jenkins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding the script to Jenkins&lt;/h4&gt;
&lt;p&gt;I wanted to run this script from a user friendly interface, so I decided to add it to Jenkins. To add the script to Jenkins I followed these steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Created a new project and then under the project configuration I checked the option &lt;strong&gt;“This build is parametrized”&lt;/strong&gt;. I added a single parameter called &lt;strong&gt;“deployment_option”&lt;/strong&gt;. This parameter specifies what needs to be deployed. It corresponds to the **“deployment option” **parameter in the script. It allows the user to specify what needs to be deployed. e.g theme and plugin files or database.&lt;/li&gt;
&lt;li&gt;Clicked on &lt;strong&gt;“Add build step”&lt;/strong&gt; and then selected &lt;strong&gt;“Execute Shell”&lt;/strong&gt;. After that I entered the path to the deployment script. I added two build steps, one for each live server. Each build step deploys the website to a live server.&lt;/li&gt;
&lt;li&gt;After that I clicked on &lt;strong&gt;“Post build action”&lt;/strong&gt; and then &lt;strong&gt;Email-Notification&lt;/strong&gt;. Then I entered my email address.  This sends me an email in case a build fails.&lt;/li&gt;
&lt;li&gt;After that I checked &lt;strong&gt;“Trigger builds remotely (e.g., from scripts)”&lt;/strong&gt;. This generated a string token. After that I clicked on save. Thats all I had to do to configure Jenkins to deploy my WordPress site.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After that each time I wanted to deploy my WordPress site, I would first click on the project name and then &lt;strong&gt;“Build with parameters”&lt;/strong&gt; option. I then updated the &lt;strong&gt;deployment_option&lt;/strong&gt; parameter depending on what I want to deploy and then click on build. After that Jenkins runs the deployment script.&lt;/p&gt;
&lt;p&gt;While the script is running the status shows as a blinking dot. Once the script has run, the dot changes to a stable red or green depending on whether the deployment script returned an error or not.&lt;/p&gt;
&lt;h3 id=&quot;redmine&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#redmine&quot; aria-label=&quot;redmine permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Redmine&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Redmine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine&lt;/a&gt; is a well known web based Project Management application, written in Ruby language. Its features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Issue Tracking&lt;/li&gt;
&lt;li&gt;Flexible role based access control&lt;/li&gt;
&lt;li&gt;Gantt Chart and Calendar&lt;/li&gt;
&lt;li&gt;News&lt;/li&gt;
&lt;li&gt;Documents&lt;/li&gt;
&lt;li&gt;File Management&lt;/li&gt;
&lt;li&gt;Web feeds and email notification&lt;/li&gt;
&lt;li&gt;Per Project Wiki and forums&lt;/li&gt;
&lt;li&gt;Simple Time Tracking&lt;/li&gt;
&lt;li&gt;Custom fields, Integration with well known version control systems including [SVN](&lt;a href=&quot;https://en.wikipedia.org/wiki/Subversion_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Subversion_(software)&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Concurrent_Versions_System&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CVS&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Git_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GIT&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Mercurial_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mercurial (software)&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bazaar_(software)&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bazaar (software)&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Darcs&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Darcs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LDAP authentication&lt;/li&gt;
&lt;li&gt;Several plugins that can be used to extend Redmine&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Redmine has an excellent user interface and is very easy to use. I used Redmine for organizing the development of a website based on WordPress. I found the Issue Tracker, Time Tracker and Document manager features to be very user friendly with lots of features.&lt;/p&gt;
&lt;h4 id=&quot;installing-redmine&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-redmine&quot; aria-label=&quot;installing redmine permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Redmine&lt;/h4&gt;
&lt;p&gt;Installation of Redmine is not as simple as with Jenkins. The Redmine Wiki describes the &lt;a href=&quot;http://www.redmine.org/projects/redmine/wiki/redmineinstall&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation steps&lt;/a&gt; in detail.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Both Redmine and Jenkins have plugins that allow integration with each other. Both tools are popular especially with large software development teams.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Creating your own WordPress themes and plugins]]></title><description><![CDATA[WordPress is a great platform for building innovative applications. You can not only build standard websites with WordPress but you can also create complex applications full of features.]]></description><link>https://pakjiddat.netlify.app//posts/creating-your-own-wordpress-themes-and-plugins</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/creating-your-own-wordpress-themes-and-plugins</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;WordPress is a great platform for building innovative applications. You can not only build standard websites with WordPress but you can also create complex applications full of features.&lt;/p&gt;
&lt;p&gt;WordPress has many plugins and themes that can help you meet the requirements of even the most ambitious of customers. Recently I had the opportunity of creating custom WordPress themes and plugins for a customer. I will describe my experience in this blog post.&lt;/p&gt;
&lt;h3 id=&quot;twitter-bootstrap-for-meeting-initial-requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#twitter-bootstrap-for-meeting-initial-requirements&quot; aria-label=&quot;twitter bootstrap for meeting initial requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Twitter Bootstrap for meeting initial requirements&lt;/h3&gt;
&lt;p&gt;Initially my customer had asked for a simple website that describes the products and services of the company. That was easy I thought. All I had to do was to download a simple HTML template and enter the content provided by the customer. I like the twitter &lt;a href=&quot;http://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bootstrap&lt;/a&gt; framework. It is a responsive framework, which means it is designed to be accessible from devices with different sizes. I really like their &lt;a href=&quot;http://getbootstrap.com/examples/jumbotron/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jumbotron&lt;/a&gt; example and decided to use it as the template for the website.&lt;/p&gt;
&lt;h3 id=&quot;using-web-based-code-editor&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-web-based-code-editor&quot; aria-label=&quot;using web based code editor permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using web based code editor&lt;/h3&gt;
&lt;p&gt;The customer wanted to enter the content by himself so I had to make it easy for him to edit the HTML. I installed a web based code editor called &lt;a href=&quot;IceCoder&quot;&gt;https://icecoder.net&lt;/a&gt;. This is an excellent tool that allows you to easily edit code straight from the web browser without installing any software on your local computer.&lt;/p&gt;
&lt;p&gt;IceCoder is written in PHP and like most PHP applications is easy to setup. All you need to do is to download it on your server and extract the downloaded file into a folder.&lt;/p&gt;
&lt;h3 id=&quot;organizing-the-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#organizing-the-code&quot; aria-label=&quot;organizing the code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Organizing the code&lt;/h3&gt;
&lt;p&gt;I created the files: &lt;strong&gt;header.php&lt;/strong&gt; and &lt;strong&gt;footer.php&lt;/strong&gt;. I removed the header and footer HTML code from the Bootstrap example and moved it into these two files. Now if we wanted to create a web page it had to include the header and footer files. Once I had done that, the customer could easily create new web pages.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-the-development-and-production-sites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#setting-up-the-development-and-production-sites&quot; aria-label=&quot;setting up the development and production sites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting up the development and production sites&lt;/h3&gt;
&lt;p&gt;We moved the website to a dev domain and put the main website in maintenance mode. I downloaded a sample &lt;a href=&quot;http://www.land-of-web.com/rocket_coming_soon/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;maintenance mode web page&lt;/a&gt;. It had an option called notify us, which was not working. I tried to connect it to &lt;a href=&quot;http://mailchimp.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;MailChimp&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;placing-the-production-site-in-maintenance-mode&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#placing-the-production-site-in-maintenance-mode&quot; aria-label=&quot;placing the production site in maintenance mode permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Placing the production site in maintenance mode&lt;/h3&gt;
&lt;p&gt;MailChimp is an excellent service for managing newsletters and email campaigns. I decided to connect their &lt;a href=&quot;http://en.wikipedia.org/wiki/Application_programming_interface&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API&lt;/a&gt; to the maintenance mode web page. So while the customer’s website was being developed under the dev domain the live domain showed a coming soon web page.&lt;/p&gt;
&lt;p&gt;Users who wanted to be notified by email when the website will be live could enter their email address. MailChimp would take care of notifying us and also the users.&lt;/p&gt;
&lt;h3 id=&quot;moving-over-to-wordpress&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#moving-over-to-wordpress&quot; aria-label=&quot;moving over to wordpress permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Moving over to WordPress&lt;/h3&gt;
&lt;p&gt;Like most customers, this customer wanted more features. Like contact forms, ability to create articles etc. I knew from past experience that this was probably the tip of the iceberg. More requirements could easily come up. I needed a &lt;a href=&quot;http://en.wikipedia.org/wiki/Content_management_system&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;content management system (CMS)&lt;/a&gt;, that had lots of plugins and was easy to use. &lt;a href=&quot;https://www.drupal.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Drupal&lt;/a&gt; was one option, but I did not find it easy to use. I decided to use &lt;a href=&quot;http://wordpress.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WordPress&lt;/a&gt;. It turned out to be a good choice.&lt;/p&gt;
&lt;h3 id=&quot;migrating-site-to-wordpress&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-site-to-wordpress&quot; aria-label=&quot;migrating site to wordpress permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating site to WordPress&lt;/h3&gt;
&lt;p&gt;The customers website was ready but now it had to be moved to WordPress. The best way to do this was to create a new theme for WordPress and then create new WordPress pages. After that it would be easy to copy content from old website to the new website. WordPress.org has excellent guides on creating new WordPress themes and plugins.&lt;/p&gt;
&lt;p&gt;Like many web developers I tried to find an easier way and instead of reading about WordPress themes, I searched for a free WordPress theme based on Bootstrap. I came across a useful article called &lt;a href=&quot;http://blog.teamtreehouse.com/responsive-wordpress-bootstrap-theme-tutorial&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“How to build a responsive WordPress theme with Bootstrap&lt;/a&gt;”. It shows how to create theme based on Twitter Bootstrap for WordPress.&lt;/p&gt;
&lt;p&gt;The tutorial was very useful. After following it, It was much easier to read the WordPress guides on &lt;a href=&quot;http://codex.wordpress.org/Theme_Development&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;themes&lt;/a&gt; and &lt;a href=&quot;http://codex.wordpress.org/Writing_a_Plugin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;plugins&lt;/a&gt;. I got a good understanding of WordPress and felt much more confidant about meeting the customers requirements.&lt;/p&gt;
&lt;h3 id=&quot;meeting-the-customers-requirements&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#meeting-the-customers-requirements&quot; aria-label=&quot;meeting the customers requirements permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Meeting the customer’s requirements&lt;/h3&gt;
&lt;p&gt;The customer wanted a website like &lt;a href=&quot;https://www.digitalocean.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Digital Ocean&lt;/a&gt;. My first reaction was that this is out of my scope. However the customer was patient and sent his requirements in small bits and pieces.&lt;/p&gt;
&lt;p&gt;Meeting those requirements with the help of WordPress plugins turned out to be quite easy. Some of the requirements could be met using plugins, But some of the requirements required creating our own plugins. For example the requirement of custom login page could be met with the &lt;a href=&quot;https://frosty.media/plugins/custom-login/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Custom Login&lt;/a&gt; plugin.&lt;/p&gt;
&lt;p&gt;But how could we have tutorials, questions and projects that looked like the &lt;a href=&quot;http://digitalocean.com/community/tutorials&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Digital Ocean community&lt;/a&gt; section. We were able to meet this requirement by using WordPress custom post types.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://codex.wordpress.org/Post_Types&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Custom post types&lt;/a&gt; are a great feature of WordPress that allow us to add new types of posts. These custom types are fully integrated into WordPress and are supported by hundred of plugins. Custom post types also support hierarchies so we can have child types of a custom post type. For example if you want to create a Hotel Management System using WordPress, then you can use Custom Post Types. A Hotel can be a custom post type. A room can be a sub type of the hotel and so on.&lt;/p&gt;
&lt;p&gt;We were able to easily create custom post types for tutorials, questions and projects with the help of the &lt;a href=&quot;https://wordpress.org/plugins/custom-post-type-ui/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Custom Post Type UI plugin&lt;/a&gt;. We then needed to display them in tabs. &lt;a href=&quot;https://wordpress.org/plugins/easy-responsive-tabs/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Easy Responsive Tabs plugin&lt;/a&gt; was the solution.&lt;/p&gt;
&lt;p&gt;Now we needed a way to query the tutorials, questions and projects and display them inside the tabs. I installed the &lt;a href=&quot;https://wordpress.org/plugins/display-posts-shortcode/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;display posts shortcode&lt;/a&gt; for displaying custom posts. With this plugin all you need to do for displaying your custom posts is to add a short code to a page. WordPress then replaces the short code with the list of articles in your custom post type.&lt;/p&gt;
&lt;p&gt;We needed the custom posts to look stylish like on Digital Ocean. We decided to clone the plugin and modify it according to our needs. After that we were able to easily display tutorials, questions and projects inside tabs.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Within a few weeks, I was able to create a WordPress site that looked like Digital Ocean. Best of all I learned a lot about WordPress development. I think the main reason for meeting the customer requirements was close collaboration with the customer.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Developing a Twitter Crawler]]></title><description><![CDATA[Recently I had the opportunity of developing a web based Twitter analytics application for a client. The application is called HQFollowBack. During the development of the application I learned how to use software development tools and apply software development techniques for solving certain problems.]]></description><link>https://pakjiddat.netlify.app//posts/developing-a-twitter-crawler</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/developing-a-twitter-crawler</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of developing a web based Twitter analytics application for a client. The application is called HQFollowBack. During the development of the application I learned how to use software development tools and apply software development techniques for solving certain problems. I will share my experience in this blog post.&lt;/p&gt;
&lt;p&gt;I had developed HQFollowBack a few years ago. However since then Twitter upgraded their API to version 1.1 which was not backward compatible with the previous version. As a result the HQFollowBack application stopped working. My client had invested considerable time and effort in the development of the application and did not want his efforts to go to waste. We had to upgrade the HQFollowBack application so it works with the new Twitter API.&lt;/p&gt;
&lt;p&gt;I had written the HQFollowBack application at a time when I did not have much experience with commercial software development. The application was not easy to maintain, and as a result could not be easily updated to use the new Twitter API.&lt;/p&gt;
&lt;p&gt;I decided to rewrite the application from scratch. It proved to be a good learning experience. Although I had a few years of experience with commercial web development, this was the first time I really paid attention to software development tools and methodologies.&lt;/p&gt;
&lt;h3 id=&quot;software-development-methodologies&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#software-development-methodologies&quot; aria-label=&quot;software development methodologies permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Software development methodologies:&lt;/h3&gt;
&lt;p&gt;During the development of the application I used the following software development methodologies and tools:&lt;/p&gt;
&lt;h4 id=&quot;dont-repeat-yourself-dry&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#dont-repeat-yourself-dry&quot; aria-label=&quot;dont repeat yourself dry permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Dont repeat yourself (DRY)&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a Software Development Methodology that requires elimination of repetitive work. I applied this methodology in the following way:&lt;/p&gt;
&lt;p&gt;The application has one entry point, so all requests pass through one function. The function routes the requests to different objects such as the Search and Stats objects. These objects are responsible for the search and statistics related functions of the application.&lt;/p&gt;
&lt;p&gt;The idea was to simplify the application as much as possible. Instead of having multiple controllers,models and views, the application simply uses a single routing function that dispatches the request to the correct handler function. All requests are handled in the same way by simple handler functions.&lt;/p&gt;
&lt;p&gt;One of the handler functions displays the user interface. It simply reads a template file and replaces place holders in the file with the correct values.&lt;/p&gt;
&lt;p&gt;The application is basically a crawler that extracts information from Twitter. In the first version of the application it used an invisible Iframe for running the crawler code. This is not an efficient approach.&lt;/p&gt;
&lt;p&gt;The new version of the application is 100% Ajax based. So once it loads in the browser there is no need to refresh the browser. I think this is a good structure for developing crawler applications that need to run from the browser.&lt;/p&gt;
&lt;h4 id=&quot;dividing-the-work-into-small-components&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#dividing-the-work-into-small-components&quot; aria-label=&quot;dividing the work into small components permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dividing the work into small components&lt;/h4&gt;
&lt;p&gt;My approach to developing the application was to divide the work requirements into small sections that could be completed in 1 or 2 days. I created a simple to do list with following fields.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Issues&lt;/strong&gt;. Problems faced during development&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;To Do&lt;/strong&gt;. List of tasks that need to get done&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Done&lt;/strong&gt;. List of tasks completed&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reference&lt;/strong&gt;. List of website links that were useful during application development&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;function-caching&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#function-caching&quot; aria-label=&quot;function caching permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Function caching&lt;/h4&gt;
&lt;p&gt;I think function caching is a useful feature especially in applications that do a lot of data reading. For example an application that reads data from databases or from public APIs can greatly benefit from function caching.&lt;/p&gt;
&lt;p&gt;Function caching allows the output of a function to be cached. When the function is called for the first time, it saves its output to a cache. The next time it is called it simply returns the content of its cache. I implemented function caching in the application which greatly improved its performance.&lt;/p&gt;
&lt;h4 id=&quot;error-handling-and-logging&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#error-handling-and-logging&quot; aria-label=&quot;error handling and logging permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Error handling and logging&lt;/h4&gt;
&lt;p&gt;The application is based on Php. It uses the Php functions &lt;a href=&quot;http://php.net/manual/en/function.set-error-handler.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;set_error_handler&lt;/a&gt; and &lt;a href=&quot;http://php.net/manual/en/function.set-exception-handler.php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;set_exception_handler&lt;/a&gt; for registering error and exception handling functions. This allows handling of all applications errors and exceptions.&lt;/p&gt;
&lt;p&gt;In case an error occurs, the error handling function is called which logs the error and also sends an email to the administrator. I also added try/catch code blocks to the Php and JavaScript functions. I think its important not to overuse the try/catch code blocks. They should be used only when a specific error needs to be reported. If there is no need to report a certain error, then we can use try/catch code block on the main function that includes all the other functions.&lt;/p&gt;
&lt;h4 id=&quot;table-data-gateway&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#table-data-gateway&quot; aria-label=&quot;table data gateway permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Table_data_gateway&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Table Data Gateway&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a design pattern that allows an application to access data through an object. It can be considered as a special case of the Gateway Design pattern. The Gateway Design pattern allows all access to data and configuration information through a single interface or gateway.&lt;/p&gt;
&lt;p&gt;This makes it easier to update the application configuration information and methods used to access data. My implementation of the Gateway Design Pattern allows all access to data and configuration through a single object. This object provides helper classes for carrying out different tasks needed by the application. It simplifies the application workflow and makes the code easier to maintain.&lt;/p&gt;
&lt;h4 id=&quot;custom-libraries&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#custom-libraries&quot; aria-label=&quot;custom libraries permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Custom libraries&lt;/h4&gt;
&lt;p&gt;I think an important aspect of Software Development is the creation of your own Software Libraries. These days its easy to grab hold of free open source code and use it in your application. While this approach can get the job done, it may make the application difficult to upgrade. Its much better to use code that you understand and have tested.&lt;/p&gt;
&lt;p&gt;In the HQFollowBack application I created my own custom library of utility functions that I plan on reusing and improving in future projects.&lt;/p&gt;
&lt;h4 id=&quot;open-source-libraries&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#open-source-libraries&quot; aria-label=&quot;open source libraries permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Open Source Libraries&lt;/h4&gt;
&lt;p&gt;I used following free open source code for developing the HQFollowBack application:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Php library by &lt;a href=&quot;https://github.com/ricardoper/TwitterOAuth&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;ricardoper&lt;/a&gt; on Github for accessing Twitter API.&lt;/li&gt;
&lt;li&gt;Php library by &lt;a href=&quot;https://github.com/esimakin/twbs-pagination&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;esimaken&lt;/a&gt; for displaying the search results in pages. Colorbox JQuery library by &lt;a href=&quot;http://www.jacklmoore.com/colorbox/example4/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;jacklmoore&lt;/a&gt; for displaying nice popup boxes.&lt;/li&gt;
&lt;li&gt;Api by &lt;a href=&quot;https://github.com/detectlanguage/detectlanguage-php&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;detectlanguage&lt;/a&gt; for detecting the language of the user Tweets.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;code-comments&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#code-comments&quot; aria-label=&quot;code comments permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Code comments&lt;/h4&gt;
&lt;p&gt;I commented all Php and Javascript code used by the application. I used the &lt;a href=&quot;http://www.phpdoc.org/docs/latest/getting-started/your-first-set-of-documentation.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;phpDocumentor&lt;/a&gt; website as a reference on how to document Php code.&lt;/p&gt;
&lt;h4 id=&quot;development-website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#development-website&quot; aria-label=&quot;development website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Development website&lt;/h4&gt;
&lt;p&gt;I used a separate website for the development of the application. I think its a good idea to do the development work on a separate development site. The live site should always be well tested and functional.&lt;/p&gt;
&lt;h3 id=&quot;software-development-tools&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#software-development-tools&quot; aria-label=&quot;software development tools permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Software development tools:&lt;/h3&gt;
&lt;p&gt;I used the following Software development tools for developing the HQFollowBack application:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;backend-testing-phpunit&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#backend-testing-phpunit&quot; aria-label=&quot;backend testing phpunit permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://phpunit.de/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Backend testing (phpunit).&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Phpunit is an excellent tool for unit testing Php code. By regularly running the unit tests I can be sure the application is working. These days applications are more and more dependent on third party tools and APIs. Changes to these external tools can break your application. It is therefore very important to test your application thoroughly and if possible run the unit and function tests automatically.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;frontend-unit-testing-qunit&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#frontend-unit-testing-qunit&quot; aria-label=&quot;frontend unit testing qunit permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://qunitjs.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Frontend unit testing (Qunit)&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Qunit is an excellent tool for unit testing JavaScript code. The Qunit &lt;a href=&quot;http://qunitjs.com/cookbook&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;cookbook&lt;/a&gt; is a one page comprehensive guide on using Qunit. Qunit has good support for unit tests that involve ajax calls. I used Qunit for testing the ajax calls made by the HQFollowBack application.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;frontend-functional-testing-selenium&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#frontend-functional-testing-selenium&quot; aria-label=&quot;frontend functional testing selenium permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.seleniumhq.org/projects/ide/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Frontend functional testing (Selenium)&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Selenium works as a browser automation tool that can be run from programming languages such as PHP or from the Firefox browser itself. Selenium allows recording website activity such as mouse clicks and keyword events. These events can be easily played back.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;package-management-composer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#package-management-composer&quot; aria-label=&quot;package management composer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://getcomposer.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Package management (Composer)&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Composer is a package manager for PHP. It allows keeping track of third party PHP libraries used in a project. To use Composer you have to create a file called &lt;strong&gt;composer.json&lt;/strong&gt; in your project directory. Then you have to add the location of the PHP libraries in composer.json. After that enter the command: &lt;strong&gt;composer install&lt;/strong&gt;. This will install the packages mentioned in the composer.json file.&lt;/p&gt;
&lt;p&gt;The packages are by default installed to the vendor directory. If the package is updated by its maintainer you can update it in your project by running the command: &lt;strong&gt;composer update.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;By default composer uses the PHP libraries on the &lt;a href=&quot;https://packagist.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;packagist&lt;/a&gt; website, but it can be configured to use other sources as well such as &lt;a href=&quot;http://www.phpclasses.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;phpclasses.org&lt;/a&gt; or &lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Github&lt;/a&gt;. Composer has an autoload feature that allows all Php libraries to be included in your project using a single include command. e.g &lt;strong&gt;include(“autoload.php”)&lt;/strong&gt; will include all the libraries managed by composer.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;version-control-git&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#version-control-git&quot; aria-label=&quot;version control git permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://git-scm.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Version Control (GIT)&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Git is a popular distributed version control system. I used it for keeping track of the different file versions. After completing a feature I saved the changes to the version control repository.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;issue-tracking-mantis-bt&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#issue-tracking-mantis-bt&quot; aria-label=&quot;issue tracking mantis bt permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://www.mantisbt.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Issue tracking (Mantis BT)&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mantis is a popular free issue tracking system that allows keeping track of issues. I use it for working wit the client. In my bog post titled: &lt;a href=&quot;/posts/tracking-issues-with-mantis-bug-tracker&quot;&gt;Tracking Issues with Mantis Bug Tracker&lt;/a&gt;, I described my experience with configuring and using Mantis.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;There are many other Software Development methodologies such an continuous integration, agile development, lean development etc. I think Its important to use the most suitable methodology for your project instead of using the methodology that is most popular. I learned a lot from the HQFollowBack project. It improved my knowledge of Software Development.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[How to become an Itunes Affiliate]]></title><description><![CDATA[The Itunes Affiliate program allows website owners to earn commission by adding links to Itunes products to their websites. Website owners can link to millions of songs, movies, tv shows, books and apps on Itunes and earn commission from the sales.]]></description><link>https://pakjiddat.netlify.app//posts/how-to-become-an-itunes-affiliate</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/how-to-become-an-itunes-affiliate</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The Itunes Affiliate program allows website owners to earn commission by adding links to Itunes products to their websites. Website owners can link to millions of songs, movies, tv shows, books and apps on Itunes and earn commission from the sales&lt;/p&gt;
&lt;h3 id=&quot;how-to-sign-up-for-the-itunes-affiliate-program&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-to-sign-up-for-the-itunes-affiliate-program&quot; aria-label=&quot;how to sign up for the itunes affiliate program permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How to sign up for the Itunes Affiliate program&lt;/h3&gt;
&lt;p&gt;The Itunes Affiliate program is a useful monetization opportunity for websites that provide content such as books, movies and apps. The website has to link to content on Itunes. Apple gives a share of the sales to the website owner. Apple provides different ways of linking to its content, including widgets, banners and badges.&lt;/p&gt;
&lt;p&gt;For example to add an Itunes badge to your website, you can use the &lt;a href=&quot;https://linkmaker.itunes.apple.com/en-us/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Itunes Link Maker tool&lt;/a&gt;. It allows users to search the Itunes API from a browser. The API returns list of products that match the given criteria. Each product has an embed code that you can add to your website.&lt;/p&gt;
&lt;p&gt;If you want to automate the process of adding Itune Badges to your website, then you can use the Advanced Search API. This is a RESTful API that returns results in JSON format. You can use the API from your favorite programming language such as PHP. The search results of the API does not include embed code for the banner but it does include a track id that we can add to the banner embed code. In this way we can fully automate the process of adding Itunes Badges to a website&lt;/p&gt;
&lt;p&gt;After you have added the embed code for a badge to your website, you need to add an affiliate id to the code. You can get this id by applying for the Itunes Affiliate program.&lt;/p&gt;
&lt;p&gt;Once you have your Itunes Affiliate id, you have to add some JavaScript code to your website that turns all the Itunes links on your website into affiliate links. You can get this JavaScript code from the &lt;a href=&quot;https://autolinkmaker.itunes.apple.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Auto Link Maker tool&lt;/a&gt;. After you have added this JavaScript code to your website, you can start earning commission.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Apple provides useful information on its website on how to join the &lt;a href=&quot;http://www.apple.com/itunes/affiliates/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Itunes Affiliate program&lt;/a&gt;. Hopefully this article gave you some insight on how to make use of the Itunes Affiliate program.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing LXC containers on Debian Jessie]]></title><description><![CDATA[Containers are light weight virtual machines that can be used to isolate processes. Containers implement operating system level virtualization. This means that all containers running on a host will share the kernel of the host operating system.]]></description><link>https://pakjiddat.netlify.app//posts/installing-lxc-containers-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-lxc-containers-on-debian-jessie</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Containers are light weight virtual machines that can be used to isolate processes. Containers implement operating system level virtualization. This means that all containers running on a host will share the kernel of the host operating system.&lt;/p&gt;
&lt;p&gt;The main difference between Containers and Hyper-Visors such as XEN and KVM is that the later implements hardware level virtualization. This means a host system running XEN or KVM can run virtual machines with different kernels.&lt;/p&gt;
&lt;p&gt;The main container technologies in use today are Docker and LXC/LXD. LXD is a refinement of LXC and is based on LXC. Until recently OpenVZ was a popular choice for containers. It has now been replaced by containers based on CGroups.&lt;/p&gt;
&lt;p&gt;CGroups is a new feature of the Linux kernel that allows process isolation. Both Docker and LXC are based on CGroups. Since the Linux kernel now has built in support for containers, old container technologies such as OpenVZ have been largely replaced by Docker and LXC.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The installation of LXC on Debian Jessie is very simple and only requires the command: &lt;strong&gt;apt-get install lxc&lt;/strong&gt;. The &lt;a href=&quot;https://linuxcontainers.org/lxc/getting-started/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;LXC home page&lt;/a&gt; has useful information on how to get started with LXC&lt;/p&gt;
&lt;h3 id=&quot;creating-new-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-new-containers&quot; aria-label=&quot;creating new containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating new containers&lt;/h3&gt;
&lt;p&gt;To create a new LXC container, we have to run the command: &lt;strong&gt;lxc-create -t download -n your-container-name&lt;/strong&gt;. This will display a list of options for the operating system. Once you have selected your operating system, the template for your selected operating system will be downloaded and the new container will be created.&lt;/p&gt;
&lt;h3 id=&quot;using-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-containers&quot; aria-label=&quot;using containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using containers&lt;/h3&gt;
&lt;p&gt;Here are some commands for using containers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To start your container, you have to run the command: &lt;strong&gt;lxc-start -n your-container-name -d&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The command &lt;strong&gt;lxc-info -n your-container-name&lt;/strong&gt; displays information about the new LXC container.&lt;/li&gt;
&lt;li&gt;To enter the container shell you have to use the command: &lt;strong&gt;lxc-attach -n your-container-name&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To stop your container enter: &lt;strong&gt;lxc-attach -n your-container-name&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To destroy your container enter: &lt;strong&gt;lxc-destroy -n your-container-name&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;setting-up-networking&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#setting-up-networking&quot; aria-label=&quot;setting up networking permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting up networking&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://wiki.debian.org/LXC&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian Wiki LXC page&lt;/a&gt; covers the basics of LXC container management including setting up networking and mounting external folder shares. According to the Wiki, there are three main options for configuring networking on LXC. Using a simple Bridge, Vlan networking and setting up a network based on LibVirt.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;LXC containers are very easy to use. They allow easily testing new software without interfering with the main host. They are also light weight and do not take lot of server resources. LXC containers can be used to logically sub divide your computing work into groups. I use LXC containers for my website development work and find them very useful.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing W3C Markup Validator and Validator Nu on Debian Jessie]]></title><description><![CDATA[W3C Markup Validator and Validator.nu are two useful tools that can be used to validate HTML code. W3C Markup validator allows validating xhtml, html, xml, mathml and more. Validator.nu allows validating HTML 5 code. The W3C Markup validator is written in Perl, while the Validator.nu is written in Java. Both tools are actively being developed.]]></description><link>https://pakjiddat.netlify.app//posts/installing-w3c-markup-validator-and-validator-nu-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-w3c-markup-validator-and-validator-nu-on-debian-jessie</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://validator.w3.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3C Markup Validator&lt;/a&gt; and &lt;a href=&quot;https://html5.validator.nu/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Validator.nu&lt;/a&gt; are two useful tools that can be used to validate HTML code. W3C Markup validator allows validating xhtml, html, xml, mathml and more. Validator.nu allows validating HTML 5 code. The W3C Markup validator is written in Perl, while the Validator.nu is written in Java. Both tools are actively being developed.&lt;/p&gt;
&lt;p&gt;Both tools have well documented APIs. The &lt;a href=&quot;https://validator.w3.org/docs/api.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API for W3C Markup Validator&lt;/a&gt; is based on soap while the &lt;a href=&quot;https://wiki.whatwg.org/wiki/Validator.nu_Web_Service_Interface&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API for Validator.nu&lt;/a&gt; is RESTful and can be accessed using HTTP GET or POST methods. Both tools can be accessed online from a web browser or from their respective APIs.&lt;/p&gt;
&lt;p&gt;If you need to validate several documents then it makes more sense to install the tools locally. By installing the tools locally we can validate documents more quickly and reliably. In this article, I will describe how to install both tools on Debian Jessie.&lt;/p&gt;
&lt;h3 id=&quot;installing-w3c-markup-validator&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-w3c-markup-validator&quot; aria-label=&quot;installing w3c markup validator permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing W3C Markup Validator&lt;/h3&gt;
&lt;p&gt;The W3C Markup Validator can be installed by following the &lt;a href=&quot;https://validator.w3.org/docs/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;instructions given on the W3C Markup Validation website&lt;/a&gt;. The website provides instructions on installing the W3C Markup Validator from a pre built package or from source.&lt;/p&gt;
&lt;h4 id=&quot;installingthe-pre-requisites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installingthe-pre-requisites&quot; aria-label=&quot;installingthe pre requisites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing the pre requisites&lt;/h4&gt;
&lt;p&gt;I tried to install the W3C Markup Validator on Debian Jessie from package but the package was not available in the default repository. I decided to follow these &lt;a href=&quot;https://validator.w3.org/docs/install.html#install-fromsource&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;instructions for installing the W3C Markup Validator from source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The installation steps are fairly easy to follow. First you need to install the prerequisites which is the SGML parser called &lt;a href=&quot;https://sourceforge.net/projects/openjade/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;opensp&lt;/a&gt; and some Perl modules.&lt;/p&gt;
&lt;p&gt;The install guide mentions installing either several Perl modules one by one or installing &lt;a href=&quot;http://search.cpan.org/dist/Bundle-W3C-Validator/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Bundle-W3C-Validator&lt;/a&gt; perl module. I installed the Bundle-W3C-Validator bundle module but I still had to install the Perl module: &lt;strong&gt;SGML::Parser::OpenSP&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;downloading-the-source-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#downloading-the-source-code&quot; aria-label=&quot;downloading the source code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Downloading the source code&lt;/h4&gt;
&lt;p&gt;Next you need to download the source code for the W3C Markup Validator from Github. The W3C Markup Validator requires a web server ideally Apache. The validator source code is written in Perl and requires mod_perl Apache module. Installing &lt;strong&gt;mod_perl&lt;/strong&gt; from source was the most difficult step in the installation.&lt;/p&gt;
&lt;h4 id=&quot;installing-mod_perl&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-mod_perl&quot; aria-label=&quot;installing mod_perl permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing mod_perl&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://perl.apache.org/docs/2.0/user/install/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The Installing mod_perl 2.0&lt;/a&gt; guide describes how to install mod_perl from source. Mod_perl requires perl headers which can be obtained by installing the &lt;strong&gt;libperl-dev&lt;/strong&gt; package using apt-get. After the mod_perl source code has been downloaded, we need to generate the make file using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;perl Makefile.PL &lt;span class=&quot;token assign-left variable&quot;&gt;MP_APXS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/usr/local/apache2/bin/apxs&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I got following error when running the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;Your Perl is configured to &lt;span class=&quot;token function&quot;&gt;link&lt;/span&gt; against libgdbm,
but libgdbm.so was not found.
You could just symlink it to /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I fixed the error by installing the &lt;strong&gt;libgdbm-dev&lt;/strong&gt; package. I ran the command again but got this error:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;Reading Makefile.PL args from @ARGV
   MP_APXS &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; /usr/local/apache2/bin/apxs
no conflicting prior mod_perl version found - good.
Using APXS &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; /usr/local/apache2/bin/apxs
&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;  error&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; Unable to determine server version, aborting.
&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;  error&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; Invalid MP_APXS specified?&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I fixed the error by installing the &lt;strong&gt;apxs&lt;/strong&gt; package using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; apache2-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The apxs package is a tool for building extensions and modules for Apache 2.4.&lt;/p&gt;
&lt;p&gt;The apxs binary was installed in &lt;strong&gt;/usr/bin&lt;/strong&gt; so I had to update the command to:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;perl Makefile.PL &lt;span class=&quot;token assign-left variable&quot;&gt;MP_APXS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/usr/bin/apxs&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that the package had to be built using &lt;strong&gt;make&lt;/strong&gt; command. After that &lt;strong&gt;make test&lt;/strong&gt; command had to be run for running the package tests. If the tests pass then the mod_perl can be installed using the command &lt;strong&gt;make install&lt;/strong&gt;. The last command copies the &lt;strong&gt;mod_perl.so&lt;/strong&gt; library file to the Apache module directory. The module can be enabled using the command &lt;strong&gt;a2enmod&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;During installation of mod_perl the &lt;strong&gt;make test&lt;/strong&gt; command failed with some errors. I decided to post the error to the &lt;a href=&quot;https://perl.apache.org/maillist/modperl.html#Subscription_Information&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mod_perl mailing list&lt;/a&gt;. After mod_perl was installed, I followed the rest of the installation instructions for the W3C Validator tool.&lt;/p&gt;
&lt;p&gt;I had to first copy the &lt;strong&gt;validator.conf&lt;/strong&gt; configuration file to &lt;strong&gt;/etc/w3c/&lt;/strong&gt; folder and then adjust the folder paths in the file. Next configure a virtual host for the W3C Markup Validator tool. After that I restarted Apache and was able to access the W3C Markup Validator from a browser.&lt;/p&gt;
&lt;h3 id=&quot;installing-validatornu&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-validatornu&quot; aria-label=&quot;installing validatornu permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Validator.nu&lt;/h3&gt;
&lt;p&gt;Validator.nu allows validating Html 5 documents. Its installation is much simpler. The installation steps are given on the &lt;a href=&quot;https://validator.github.io/validator/#build-instructions&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Nu Validator Checker website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First we need to install the pre requisites which are Git, Python and JDK. The python version should be 2.7 or greater. The JDK version should be 8. JDK 7 did not work for me. Installing JDK 8 on Debian Jessie requires the backport repository for Debian Jessie. This can be installed by following the &lt;a href=&quot;http://backports.debian.org/Instructions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian Backport Installation&lt;/a&gt; instructions.&lt;/p&gt;
&lt;h4 id=&quot;building-validatornu-from-source&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#building-validatornu-from-source&quot; aria-label=&quot;building validatornu from source permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Building validator.nu from source&lt;/h4&gt;
&lt;p&gt;After the pre requisites have been installed you need to download the &lt;a href=&quot;https://github.com/validator/validator&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;source code for the validator.nu&lt;/a&gt; from Git Hub. Once the source code has been downloaded, it needs to be built using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;python ./build/build.py all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command starts a web server that listens on port &lt;strong&gt;8888&lt;/strong&gt;. The Validator.nu should now be accessible on &lt;strong&gt;&lt;a href=&quot;http://localhost:8888&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://localhost:8888&lt;/a&gt;&lt;/strong&gt;. The validator.nu source code includes a &lt;strong&gt;vnu.war&lt;/strong&gt; file that allows the tool to be deployed within a Servlet container such as Tomcat. There is also a vnu.jar file that allows HTML documents to be validated from the command line.&lt;/p&gt;
&lt;p&gt;The W3C Markup Validator and Validator.nu are separate tools but can be used from the interface for the W3C Markup Validator. To use both tools from a single interface, we just need to uncomment two lines at the bottom of the file &lt;strong&gt;/etc/w3c/validator.conf&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The W3C Markup Validator and Validator.nu are useful tools for web developers that allow validating HTML markup. Both tools provide useful APIs that allow validation of HTML documents from any programming language. The APIs can be used in unit tests for web applications.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing and configuring Redmine]]></title><description><![CDATA[Redmine is a web based project management and collaboration platform. It is based on the Ruby programming language and the Ruby on Rails framework. Its user friendly and easy to install and configure.]]></description><link>https://pakjiddat.netlify.app//posts/installing-and-configuring-redmine</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-and-configuring-redmine</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.redmine.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine &lt;/a&gt; is a web based project management and collaboration platform. It is based on the Ruby programming language and the Ruby on Rails framework. Its user friendly and easy to install and configure.&lt;/p&gt;
&lt;p&gt;It has useful features such as project management, user and role management, issue tracking, wiki, forum, files and document management, time tracking and more. It is well suited for managing Software Development Project but it can easily be used to manage other projects. In this article I will describe my experience with installing and configuration Redmine.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;Installation of Redmine is easy and is described in the &lt;a href=&quot;http://www.redmine.org/projects/redmine/wiki/redmineinstall&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine Install Guide&lt;/a&gt;. The Redmine wiki has installation guides for different platforms. I followed the guide for installing Redmine from source on Linux. I used MySQL for the database.&lt;/p&gt;
&lt;p&gt;The installation worked without problems. The only issue was installing the Redmine in a sub folder. The Url had to look like &lt;strong&gt;&lt;a href=&quot;https://companyname.org/companyid/projects/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://companyname.org/companyid/projects/&lt;/a&gt;&lt;/strong&gt;. Sub folder installation of Redmine is described in the guide: &lt;a href=&quot;http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;HowTo Install Redmine in a sub-URI&lt;/a&gt;. It required adding following lines to the end of the &lt;strong&gt;config/environment.rb&lt;/strong&gt; file:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;ruby&quot;&gt;&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;RedmineApp&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;Application&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;routes&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;default_scope &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;/companyid/projects&quot;&lt;/span&gt;&lt;/span&gt;
Redmine&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;Utils&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;relative_url_root &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;/companyid/projects&quot;&lt;/span&gt;&lt;/span&gt;
ActionController&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;Base&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;relative_url_root &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;/companyid/projects&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that I had to create the folder &lt;strong&gt;/remine_install_path/companyid&lt;/strong&gt;. Then I had to add a symbolic link to the public folder using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; /redmine_install_path/public /redmine_install_path/companyid/projects&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next I had to add the following line to the Apache virtual host configuration for the Redmine website: &lt;strong&gt;RailsBaseURI /companyid/projects&lt;/strong&gt;. I had run the Redmine website behind Apache web server using the &lt;strong&gt;libapache2-mod-passenger&lt;/strong&gt; module.&lt;/p&gt;
&lt;p&gt;After the Redmine was installed, I had to login to the Redmine and give the full path of the Redmine url under &lt;strong&gt;Settings-&gt;General-&gt;Website Name&lt;/strong&gt;. I set the path to: &lt;strong&gt;companyname.org/companyid/projects&lt;/strong&gt;. The protocol field had to be set to &lt;strong&gt;https&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Redmine provides a lot of features out of the box related to project management, issue tracking, document management etc. However sometimes we may required additional features or customization that are not provided by the default Redmine installation.&lt;/p&gt;
&lt;p&gt;Redmine supports plugins and themes which can be used to enhance the functionality of Redmine. Redmine plugins can be downloaded from the &lt;a href=&quot;http://www.redmine.org/plugins&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Redmine Plugin Repository&lt;/a&gt; or from &lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Github&lt;/a&gt;. Redmine plugins can add useful features such as allowing customization of the Redmine menu, Invoicing, Contact Management, adding custom JavaScript and CSS to the website, Issue Templates, Product management, Frequently asked questions, Agile related features and more.&lt;/p&gt;
&lt;p&gt;Installation of Redmine plugins is a bit tricky. Each plugin has its own installation guide. Generally Redmine plugins are installed by decompressing the plugin file, then running the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;bundle &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;from the Redmine root directory. After that the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;rake redmine:plugins:migrate &lt;span class=&quot;token assign-left variable&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;production&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is run to import the plugin configuration information to Redmine. Next we may need to restart Redmine using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;touch&lt;/span&gt; tmp/restart.txt
&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt; apache2 restart&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Installation of Redmine themes is very simple. It requires decompressing the theme file in the public/themes folder. Next Redmine needs to be restarted. The new theme should then show under &lt;strong&gt;Settings-&gt;Display-&gt;Themes&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Redmine is an excellent tool for managing projects. With the help of plugins and themes it can be transformed into systems that provide a wide range of features such as content management, account management, customer management, agile project management and more.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Integrating Rocket Chat and Trello]]></title><description><![CDATA[Rocket Chat is an excellent open source collaboration tool. It is similar to the close source commercial application Slack. Trello is a commercial Kanban board that allows managing tasks and task lists. It has an attractive interface with many features and a well documented API.]]></description><link>https://pakjiddat.netlify.app//posts/integrating-rocket-chat-and-trello</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/integrating-rocket-chat-and-trello</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Rocket Chat is an excellent open source collaboration tool. It is similar to the close source commercial application Slack. Trello is a commercial Kanban board that allows managing tasks and task lists. It has an attractive interface with many features and a well documented API.&lt;/p&gt;
&lt;p&gt;The Trello API is easy to use and allows Trello to be integrated with other applications. In an earlier article I described how to &lt;a href=&quot;/posts/installing-rocket-chat-and-wekan-on-ubuntu-server&quot;&gt;install Rocket Chat on Ubuntu server&lt;/a&gt;. In this article I will describe how to integrate Trello with Rocket Chat.&lt;/p&gt;
&lt;h3 id=&quot;using-web-hooks-for-integration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-web-hooks-for-integration&quot; aria-label=&quot;using web hooks for integration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Web Hooks for integration&lt;/h3&gt;
&lt;p&gt;We can integrate Rocket Chat and Trello using web hooks. Both tools provide web hooks as part of their APIs. The Trello API provides a &lt;a href=&quot;https://developers.trello.com/sandbox&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;sandbox&lt;/a&gt; from where we can test the web hooks&lt;/p&gt;
&lt;p&gt;The Trello API considers each object as a model. For example a card, checklist, board etc are called models. Each model has a unique id. A web hook is attached to a model by giving it the id of the model. Once a web hook has been attached to a model, it will fire each time the model is updated. For example if we create a web hook on a Trello card and then delete the card, the web hook attached to the card will fire. Each web hook has a callback url that is called when the web hook fires.&lt;/p&gt;
&lt;h3 id=&quot;creating-incoming-and-outgoing-web-hooks-in-rocket-chat&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-incoming-and-outgoing-web-hooks-in-rocket-chat&quot; aria-label=&quot;creating incoming and outgoing web hooks in rocket chat permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating incoming and outgoing web hooks in Rocket Chat&lt;/h3&gt;
&lt;p&gt;The Rocket Chat administration panel has a section called Integrations, from where we can add incoming and outgoing web hooks. The Rocket Chat documentation describes how to create &lt;a href=&quot;https://rocket.chat/docs/administrator-guides/integrations/#incoming-webhook-scripting&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;incoming&lt;/a&gt; and &lt;a href=&quot;https://rocket.chat/docs/administrator-guides/integrations/#outgoing-webhook-scripting&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;outgoing&lt;/a&gt; web hooks.&lt;/p&gt;
&lt;p&gt;To create an incoming Web Hook in Rocket Chat we have to give the name of the channel that uses the web hook, the name of the user of the web hook and the script that should be run when the web hook is called. An outgoing web hook is created similarly.&lt;/p&gt;
&lt;p&gt;The Rocket Chat documentation provides sample scripts for both incoming and outgoing web hooks. This script is run when the web hook is called. After an incoming web hook is created, the Rocket Chat generates a URL that can be used by other applications. For example when an application calls the incoming URL, Rocket Chat will run the script that we specified when creating the incoming web hook. The script can do some processing and return the result as a message. This message is displayed to the channel users.&lt;/p&gt;
&lt;p&gt;After we have created an incoming web hook in Rocket Chat, we have to copy the generated URL and use that as a callback URL for the Trello web hook. So each time a Trello object is updated, the Rocket Chat URL is called automatically. When this URL is called, the script associated with the URL is run on the Rocket Chat server and the result is displayed to the end user.&lt;/p&gt;
&lt;p&gt;The Trello web hook passes parameters to the callback URL so the script for the incoming web hook can use the parameters. e.g for displaying the name of the Trello card to the user. The incoming web hook basically displays information from an external application to the channel users.&lt;/p&gt;
&lt;p&gt;When we create an outgoing web hook, we have to give one or more URLs that should be called when the web hook is fired. The outgoing web hook is fired by Rocket Chat when the user enters certain terms. For example a command for listing all Trello cards in a certain list. When the user enters the command, the script associated with the outgoing web hook is called.&lt;/p&gt;
&lt;p&gt;This script can access the URLs associated with the outgoing web hook. Depending on the user choice, the outgoing web hook can be fired each time the user enters a message or when a certain text appears in the message.&lt;/p&gt;
&lt;p&gt;The script given in the outgoing web hook is specified as a class with two functions. One is called &lt;strong&gt;prepare_outgoing_request&lt;/strong&gt; and is called each time the user enters text. The second one is called &lt;strong&gt;process_outgoing_response&lt;/strong&gt; and is called when the URL given in the outgoing web hook is called. The &lt;strong&gt;process_outgoing_response&lt;/strong&gt; function gets the response from the URL. When the first function &lt;strong&gt;prepare_outgoing_request&lt;/strong&gt; is called, it can either call the URL associated with the web hook or it can display help information to the user. For example on how to use the command.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Rocket Chat is well documented and actively supported. It is an interesting open source project with many possibilities for integration.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing Rocket Chat and Wekan on Ubuntu Server]]></title><description><![CDATA[Rocket Chat and Wekan are useful online collaboration tools. Both tools are open source and can be downloaded and installed for free.]]></description><link>https://pakjiddat.netlify.app//posts/installing-rocket-chat-and-wekan-on-ubuntu-server</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-rocket-chat-and-wekan-on-ubuntu-server</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://rocket.chat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rocket Chat&lt;/a&gt; and &lt;a href=&quot;https://wekan.github.io/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wekan&lt;/a&gt; are useful online collaboration tools. Both tools are open source and can be downloaded and installed for free.&lt;/p&gt;
&lt;p&gt;Rocket Chat is a chat application similar to Slack, while Wekan is a Kanban application similar to Trello. Rocket Chat and Wekan are easy to use and can be used for collaborative project management. In this article I will describe how to install and configure Rocket Chat and Wekan.&lt;/p&gt;
&lt;p&gt;Both Rocket Chat and Wekan are based on the open source Meteor JavaScript framework. Both applications are well documented and are supported by an active community.&lt;/p&gt;
&lt;h3 id=&quot;rocket-chat-installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rocket-chat-installation&quot; aria-label=&quot;rocket chat installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Rocket Chat Installation&lt;/h3&gt;
&lt;p&gt;Rocket Chat consists of a service and clients that connect to the service. The service has several installation options. It can be installed on the Rocket Chat Cloud or on a Platform as a Service (PAAS) such as AWS, Heroku, Sandstorm.io, Automation Tools etc. It can also be installed as a Docker Container or manually from source code. Rocket Chat clients are available for several platforms including iPhone and Desktops clients for Windows and Linux. The easiest way to access the Rocket Chat service is from a web browser, which requires no installation.&lt;/p&gt;
&lt;p&gt;I had installed the Rocket Chat service from source. The Rocket Chat documentation has &lt;a href=&quot;https://rocket.chat/docs/installation/manual-installation/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;guides for installing from source on different operating systems&lt;/a&gt;. I followed the Ubuntu server installation guide. After installing the Rocket Chat service, I was able to access the service from a Linux desktop client and web browser. Both clients worked well without issues.&lt;/p&gt;
&lt;p&gt;Rocket Chat has following dependencies: &lt;strong&gt;nodejs, mongodb, curl and graphicsmagic&lt;/strong&gt;. It requires &lt;strong&gt;nodejs version 0.10.43 or higher&lt;/strong&gt;. nodejs can be installed using &lt;strong&gt;Node Package Manager (npm)&lt;/strong&gt;. The main issue I had was installing Rocket Chat over https behind Apache web server. Furthermore the installation had to use a subfolder url. Fortunately the Rocket Chat documentation covers this installation case very well.&lt;/p&gt;
&lt;h3 id=&quot;rocket-chat-installation-issues&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rocket-chat-installation-issues&quot; aria-label=&quot;rocket chat installation issues permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Rocket Chat Installation Issues&lt;/h3&gt;
&lt;p&gt;After installing Rocket Chat I had problems with getting the &lt;a href=&quot;https://jitsi.org/Projects/JitsiMeet&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jitsi.Meet&lt;/a&gt; video chat function to work. Jitsi Meet is an open source WebRTC application that allows video conferencing. Jitsi Meet video conferencing is integrated into Rocket Chat channels and direct chat. I had problems with getting the Jitsi Meet video function to work. I had to add following rules to Apache virtual host configuration:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;ProxyPass /packages http://localhost:1000/chat/packages
ProxyPassReverse /packages http://localhost:1000/chat/packages&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that the Jitsi Meet feature started working but only on Firefox browser. Chrome browser gave a permissions error. I posted the error on the Rocket Chat GitHub issue tracker (&lt;a href=&quot;https://github.com/RocketChat/Rocket.Chat/issues/3973&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Issue 3973&lt;/a&gt;, &lt;a href=&quot;https://github.com/RocketChat/Rocket.Chat/issues/3952&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Issue 3952&lt;/a&gt; ).&lt;/p&gt;
&lt;h3 id=&quot;customizing-rocket-chat&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#customizing-rocket-chat&quot; aria-label=&quot;customizing rocket chat permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Customizing Rocket Chat&lt;/h3&gt;
&lt;p&gt;Rocket Chat can be easily customized by replacing the logo, favicon and login page banner. The favicon can be uploaded in different sizes and types including SVG. Rocket Chat also allows adding custom CSS code. I used it to style certain parts of the login screen.&lt;/p&gt;
&lt;h3 id=&quot;wekan-installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wekan-installation&quot; aria-label=&quot;wekan installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Wekan Installation&lt;/h3&gt;
&lt;p&gt;Wekan like Rocket Chat is based on meteor. &lt;a href=&quot;https://github.com/wekan/wekan/wiki/Install-and-Update&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installation of Wekan&lt;/a&gt; is well documented on their website. Wekan can be installed from Sandstorm, Docker, Binaries or Source Code. I chose the last option, i.e installing from source code.&lt;/p&gt;
&lt;h3 id=&quot;wekan-installation-issues&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wekan-installation-issues&quot; aria-label=&quot;wekan installation issues permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Wekan Installation Issues&lt;/h3&gt;
&lt;p&gt;I had to install Wekan over https behind Apache web server. The URL had to be a sub folder. This type of installation is not documented in the Wekan Wiki. The installation was mostly successful, but had one bug. When I clicked on a card it showed a “Page not found” error. I decided to post the issue on the Wekan Github issue tracker (&lt;a href=&quot;https://github.com/wekan/wekan/issues/666&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Issue 666&lt;/a&gt;). Another drawback of Wekan is that it does not have an admin section from where we can manage users. Its a useful tool but does not have as many features as Rocket Chat.&lt;/p&gt;
&lt;h3 id=&quot;startup-scripts-for-rocket-chat-and-wekan&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#startup-scripts-for-rocket-chat-and-wekan&quot; aria-label=&quot;startup scripts for rocket chat and wekan permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Startup scripts for Rocket Chat and Wekan&lt;/h3&gt;
&lt;p&gt;Both Rocket Chat and Wekan are started in the same manner. i.e using the command: &lt;strong&gt;node main.js&lt;/strong&gt;. This  command starts a server that listens on the given port and URL. The port, URL and database information is given to the application as environment variables. To manage the Wekan and Rocket Chat services more easily, I decided to use the forever service.&lt;/p&gt;
&lt;p&gt;The forever service allows managing services based on NodeJs. On Ubuntu it can be installed using the command: &lt;strong&gt;apt-get install forever&lt;/strong&gt;. Installation and configuration of the forever service is described in Step 4 of the guide: &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-configure-and-deploy-rocket-chat-on-ubuntu-14-04&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How To Install, Configure, and Deploy Rocket.Chat on Ubuntu 14.04&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Both Rocket Chat and Wekan are useful tools that can be used for collaboration and project management. Integration of these tools would be a great feature that has been much requested.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Load testing websites using Apache Bench, Apache JMeter and Loader.io]]></title><description><![CDATA[Load testing a website refers to the process of testing the number of concurrent users that the website is able to support. Whether or not your website attracts lots of visitors, it is useful to know how many users the website can support.]]></description><link>https://pakjiddat.netlify.app//posts/load-testing-websites-using-apache-bench--apache-jmeter-and-loader-io</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/load-testing-websites-using-apache-bench--apache-jmeter-and-loader-io</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Load testing a website refers to the process of testing the number of concurrent users that the website is able to support. Whether or not your website attracts lots of visitors, it is useful to know how many users the website can support.&lt;/p&gt;
&lt;p&gt;Recently I had the opportunity of load testing a website. The tools I used for load testing the website were: &lt;a href=&quot;https://httpd.apache.org/docs/2.2/programs/ab.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Bench&lt;/a&gt;, &lt;a href=&quot;http://jmeter.apache.org/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache JMeter&lt;/a&gt; and the online service &lt;a href=&quot;https://loader.io&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;loader.io&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;benefits-of-load-testing&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#benefits-of-load-testing&quot; aria-label=&quot;benefits of load testing permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Benefits of Load Testing&lt;/h3&gt;
&lt;p&gt;Website load testing is a very useful practice that gives you an idea of how many users your website can support without experiencing a decrease in performance. If your website is getting a lot of visitors and its performance is starting to degrade, then you may want to improve its performance by using HTTP caching or upgrade the web server.&lt;/p&gt;
&lt;p&gt;If you do not have control over the hosting of your website, then you can upgrade your hosting plan or change your hosting provider. In most cases efficient use of HTTP caching can fix most website performance problems.&lt;/p&gt;
&lt;h3 id=&quot;apache-bench&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#apache-bench&quot; aria-label=&quot;apache bench permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Apache Bench&lt;/h3&gt;
&lt;h4 id=&quot;using-apache-bench&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-apache-bench&quot; aria-label=&quot;using apache bench permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Apache Bench&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://httpd.apache.org/docs/2.2/programs/ab.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Bench&lt;/a&gt; is a command line tool for measuring performance of the &lt;a href=&quot;http://www.apache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache webserver&lt;/a&gt;. It is bundled with the standard Apache distribution and is run using the command &lt;strong&gt;ab&lt;/strong&gt;. On Ubuntu in order to use the &lt;strong&gt;ab&lt;/strong&gt; command, you need to install &lt;strong&gt;apache-utils&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Apache Bench is single threaded which means it only uses one operating system thread so it can be a bit slow at times. The following command load tests the website &lt;a href=&quot;http://dev.example.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://dev.example.com&lt;/a&gt; using Apache Bench:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ab &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt; http://dev.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command sends 500 requests to the web server in total with a concurrency of 100.&lt;/p&gt;
&lt;p&gt;The result showed that the average time taken for a request was just 25 seconds for a batch of 100 requests, which is just 0.25 sec per http request. The ab utility only fetches the main page and not the resources within the page such as images, CSS, JavaScript files etc.&lt;/p&gt;
&lt;h4 id=&quot;generating-graphs-from-output-of-apache-bench&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-graphs-from-output-of-apache-bench&quot; aria-label=&quot;generating graphs from output of apache bench permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating graphs from output of Apache Bench&lt;/h4&gt;
&lt;p&gt;We can export the results of ab command to a format suitable for &lt;a href=&quot;http://www.gnuplot.info/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GNUPlot&lt;/a&gt; using &lt;strong&gt;-g outputfile_name&lt;/strong&gt;. This can give us a nice graph showing how the website response time changes with the number of requests. We can use the online version of &lt;a href=&quot;http://gnuplot.respawned.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;GNUPlot&lt;/a&gt; for quickly creating a graph of website load times. This is described in the article titled &lt;a href=&quot;http://www.bradlanders.com/2013/04/15/apache-bench-and-gnuplot-youre-probably-doing-it-wrong/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Apache Bench and Gnuplot: you are probably doing it wrong”&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;loaderio&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#loaderio&quot; aria-label=&quot;loaderio permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Loader.io&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://loader.io&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;loader.io&lt;/a&gt; is an excellent online load testing service that has a great free plan. Their free plan allows 10,000 clients per test but only 1 target host. The free plan also allows scheduling test result execution and notification of test results using web hooks. I ran a test on loader.io for a website and it gave the following results:&lt;/p&gt;
&lt;h3 id=&quot;apache-jmeter&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#apache-jmeter&quot; aria-label=&quot;apache jmeter permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Apache JMeter&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://jmeter.apache.org/usermanual/get-started.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Jmeter&lt;/a&gt; is a well known load testing tool. It is used by most online load testing service providers. The Apache Jmeter tool is written in Java and has lots of options. It can actually be used to load test any application over a TCP/UDP port such as DNS, LDAP, SMTP, Web servers etc.&lt;/p&gt;
&lt;p&gt;It is usually run from a GUI but can also be run from the command line. The &lt;a href=&quot;http://jmeter.apache.org/usermanual/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache Jmeter user manual&lt;/a&gt; is an excellent resource for getting started.&lt;/p&gt;
&lt;p&gt;To start using Apache Jmeter, you have to first download it from the &lt;a href=&quot;http://jmeter.apache.org/download_jmeter.cgi&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Apache JMeter site&lt;/a&gt;. Once you have downloaded the file, extract it to a folder and if you are on Windows run the file jmeter.bat or jmeter.sh if you are on Linux. This will start the Jmeter GUI.&lt;/p&gt;
&lt;p&gt;To start testing a website, create a new test plan using the &lt;a href=&quot;http://jmeter.apache.org/usermanual/build-web-test-plan.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Building a Web Test Plan” template&lt;/a&gt;. This creates a new test plan with some pre configured components. You have to edit some of the values such as the name of your web server and the number of users to use during testing.&lt;/p&gt;
&lt;p&gt;JMeter allows you to easily change the graph component and the user parameters. The “Graph Results” listener that is part of the test plan does not give a very nice looking graph. To display a better looking graph you just have to add a new listener component such as “Aggregate Graph”.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Apache Bench, Loader.io and Apache JMeter are all excellent options for load testing your website. All three have support for integration with third party frameworks such as Jenkins Continuous Integration Server.&lt;/p&gt;
&lt;p&gt;Load testing is a very useful method for testing your website. It gives us a very important performance metric which is the variation of web page load time with number of users.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Monitoring CPU and Memory usage on Linux]]></title><description><![CDATA[CPU and Memory monitoring is an important system administration task. It provides valuable information that can be used in resource planning and alert notifications.]]></description><link>https://pakjiddat.netlify.app//posts/monitoring-cpu-and-memory-usage-on-linux</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/monitoring-cpu-and-memory-usage-on-linux</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;CPU and Memory monitoring is an important system administration task. It provides valuable information that can be used in resource planning and alert notifications.&lt;/p&gt;
&lt;p&gt;For example if CPU and Memory usage is consistently high then the system administrator may want to consider moving his system to a server with more resources. He may also want to get a notification by Email or SMS so he can take action before his system is damaged.&lt;/p&gt;
&lt;h3 id=&quot;configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuration&quot; aria-label=&quot;configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Linux based operating systems provide the virtual file system &lt;strong&gt;/proc&lt;/strong&gt;. It contains information provided by the kernel, including information on CPU and RAM usage. The files &lt;strong&gt;/proc/cpuinfo&lt;/strong&gt; and &lt;strong&gt;/proc/meminfo&lt;/strong&gt; provide information on CPU and Memory respectively.&lt;/p&gt;
&lt;p&gt;The contents of these files can be checked on a regular basis from a simple script. A notification email may be sent in case usage exceeds a given threshold.&lt;/p&gt;
&lt;h3 id=&quot;monitoring-cpu&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#monitoring-cpu&quot; aria-label=&quot;monitoring cpu permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Monitoring CPU&lt;/h3&gt;
&lt;p&gt;CPU usage can also be monitored with the top command which is part of most Linux distributions. The following bash command returns the CPU usage:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;cpu_usage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d1&lt;/span&gt; -n1&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Cpu(s)&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;head&lt;/span&gt; -c21&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos; &apos;&lt;/span&gt; -f3&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;%&apos;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f1&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;monitoring-ram&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#monitoring-ram&quot; aria-label=&quot;monitoring ram permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Monitoring RAM&lt;/h3&gt;
&lt;p&gt;Memory usage can be extracted from the &lt;strong&gt;/proc/meminfo&lt;/strong&gt; file using the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# the total memory. the MemTotal row is extracted using awk. the second column of this row is then extracted and saved to total variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/MemTotal/ {print $2}&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; /proc/meminfo &lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the available memory. the MemAvailable row is extracted using awk. the second column of this row is then extracted and saved to available variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;available&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/MemAvailable/ {print $2}&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; /proc/meminfo &lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the formula for calculating percentage of available memory is piped to bc command. the output of bc command is saved to memory_available variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;memory_available&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;(&lt;span class=&quot;token variable&quot;&gt;$available&lt;/span&gt;*100/&lt;span class=&quot;token variable&quot;&gt;$total&lt;/span&gt;)&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;bc&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;CPU and Memory monitoring is very import on production servers. Some hosting providers like Google Cloud Platform (GCP) automatically shut down your server if the CPU and Memory usage appears suspicious.&lt;/p&gt;
&lt;p&gt;Recently a server that I had been managing on GCP was suspended because of “suspicious activity”. The only thing that I could think of that could have caused the problem was ClamAV anti virus. It runs once a day and scans the server files for viruses. It caused a spike in CPU usage.&lt;/p&gt;
&lt;p&gt;GCP showed a high CPU warning for the instance on the Google Console page. I did not take the warning seriously and as a result the instance was suspended. We had to pay 100 USD to restore our instance. I set up a bash script for monitoring the CPU and RAM usage. It runs every 15 minutes as a cron job. The script reported high memory usage but I did not take the error seriously.&lt;/p&gt;
&lt;p&gt;That proved to be a big mistake because GCP again suspended our instance and we had to pay 100 USD to restore it. This time I checked the server again and found out that the server was running LXC containers and each container was running its own instance of the ClamAV anti virus.&lt;/p&gt;
&lt;p&gt;This was not needed since the main server that ran the containers was already running the ClamAV anti virus and it checks the container files for viruses. After I removed the anti virus from the containers, the Memory and CPU usage patterns because normal and so far we have not received a warning from GCP.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;CPU and Memory monitoring is an important system administration task that can prevent big problems for the system administrator. Although there are log monitoring tools and services such as GrayLog, Splunk and Google’s Log Stack, I prefer to use monitoring scripts that I find more dependable.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Responsive website design with Twitter Bootstrap]]></title><description><![CDATA[Designing your website so it is accessible on all type of devices is a popular topic and is often referred to as Responsive Website Design. This blog post describes my experience of developing a website according to Responsive Website Design principles.]]></description><link>https://pakjiddat.netlify.app//posts/responsive-website-design-with-twitter-bootstrap</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/responsive-website-design-with-twitter-bootstrap</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Designing your website so it is accessible on all type of devices is a popular topic and is often referred to as Responsive Website Design. This blog post describes my experience of developing a website according to &lt;a href=&quot;http://en.wikipedia.org/wiki/Responsive_web_design&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Responsive Website Design&lt;/a&gt; principles.&lt;/p&gt;
&lt;h3 id=&quot;optimizing-your-website-for-mobile-devices&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#optimizing-your-website-for-mobile-devices&quot; aria-label=&quot;optimizing your website for mobile devices permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Optimizing your website for mobile devices&lt;/h3&gt;
&lt;p&gt;These days a lot of website visitors use mobile devices. Mobile devices are usually small with much less resources than a desktop computer. A website that loads normally on a desktop computer may load very slowly on a mobile device. For example some buttons may be too close to each other or may be to small to select.&lt;/p&gt;
&lt;p&gt;There are different ways in which you can provide a good web browsing experience to mobile users of your website. You can construct a separate version of your website for mobile devices and redirect mobile users automatically to the mobile version.&lt;/p&gt;
&lt;p&gt;Another option is to construct an application for mobile devices that can be downloaded from an App Store like Google Play. The drawback of these two approaches is that you need to maintain separate versions of your website for different users. My customer wanted a single website that works equally well on desktop computers and mobile devices. The solution was to construct the website based on Responsive Website Design principles.&lt;/p&gt;
&lt;h3 id=&quot;using-the-responsive-web-framework-twitter-bootstrap&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-the-responsive-web-framework-twitter-bootstrap&quot; aria-label=&quot;using the responsive web framework twitter bootstrap permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using the Responsive web framework, Twitter Bootstrap&lt;/h3&gt;
&lt;p&gt;My approach was to use a Responsive web framework for developing the website. I decided to use &lt;a href=&quot;ttps://getbootstrap.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Twitter Bootstrap&lt;/a&gt;. Twitter Bootstrap is a very popular web framework based on HTML 5&lt;/p&gt;
&lt;p&gt;It provides several components that work equally well on desktops and mobile devices. Downloading the Twitter Bootstrap library and using one of its examples as the layout for the website was simple&lt;/p&gt;
&lt;h3 id=&quot;theproblem&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#theproblem&quot; aria-label=&quot;theproblem permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The Problem&lt;/h3&gt;
&lt;p&gt;The main problem was that the customer wanted the footer and left sidebar of his website to look like the ones on &lt;a href=&quot;https://www.digitalocean.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Digital Ocean&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;the-solution-use-browser-detection-code&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-solution-use-browser-detection-code&quot; aria-label=&quot;the solution use browser detection code permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The solution: Use browser detection code&lt;/h3&gt;
&lt;p&gt;The answer to our problems was to use code that detects the size of the web browser. Most modern libraries support browser detection. I used following browser detection options:&lt;/p&gt;
&lt;h4 id=&quot;css-media-queries&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#css-media-queries&quot; aria-label=&quot;css media queries permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.w3schools.com/cssref/css3_pr_mediaquery.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CSS Media Queries&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;CSS Media Queries are supported in CSS3. They allow us to use certain CSS statements depending on the dimensions of the device. They provide a very simple way of getting your website to look good on mobile devices. For example the following CSS Media Query code will cause the browser to use certain CSS classes if the width of the browser is 600px or less:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/** Condition */&lt;/span&gt;
&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@media&lt;/span&gt; screen &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-device-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; screen &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/** CSS classes used if condition is true */&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=mobilewrapper]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;100%&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;auto&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=w320]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;320px&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;auto&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=split]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;320px&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;left&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;block &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=left-sidebar-container]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=center-sidebar-container]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[class=toc_container_mobile]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;block&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;*[id=comments-box]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #DCE2ED&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 7px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #ACB1BA solid 1px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin-right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this way you can use different CSS classes depending on the width of the device. One of the main changes that HTML 5 introduced was to force the use of CSS classes instead of the style attribute. This makes it much easier to change the presentation of a website using CSS Media Queries.&lt;/p&gt;
&lt;h4 id=&quot;browser-detection-using-jquery&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#browser-detection-using-jquery&quot; aria-label=&quot;browser detection using jquery permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Browser detection using JQuery&lt;/h4&gt;
&lt;p&gt;You can also detect the device width using JQuery. If you are using JQuery to create certain user interface elements, then you may want to use different JQuery code depending on the device.&lt;/p&gt;
&lt;p&gt;The article titled &lt;a href=&quot;http://www.sweet-web-design.com/wordpress/detecting-browser-window-size-resize-with-jquery/1614/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Detecting Browser Window Size/Resize with jQuery&lt;/a&gt; has a good description of how to detect browser width using JQuery.&lt;/p&gt;
&lt;h4 id=&quot;browser-detection-using-php&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#browser-detection-using-php&quot; aria-label=&quot;browser detection using php permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Browser detection using PHP&lt;/h4&gt;
&lt;p&gt;If you are using PHP and you want to use different server side code depending on the type of mobile device, then you can use the &lt;a href=&quot;http://mobiledetect.net/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mobiledetect&lt;/a&gt; library. This is an excellent library written in PHP that detects the user agent that is trying to access your web page. For example you can use the following code to detect if the website visitor is on a mobile device:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Include and instantiate the class.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;Mobile_Detect.php&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Include and instantiate the class.&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$detect&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Mobile_Detect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Any mobile device (phones or tablets).&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$detect&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;isMobile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;other-options-for-responsive-website-design&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#other-options-for-responsive-website-design&quot; aria-label=&quot;other options for responsive website design permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Other options for Responsive Website Design&lt;/h3&gt;
&lt;p&gt;Another useful library that can be used in Responsive Website Design is &lt;a href=&quot;http://en.wikipedia.org/wiki/Modernizr&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Modernizr&lt;/a&gt;. This is a JavaScript library that can be used to detect the HTML 5 and CSS3 features available to a visitor of your website. You can then change your JavaScript or CSS code depending on the features available to the user. For e.g if HTML 5 canvas features is available to a user then you can use canvas related code.&lt;/p&gt;
&lt;p&gt;It is also a good idea to make your website accessible to visually impaired users. A large number of internet users are visually impaired and use helper devices such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Braille&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Brail&lt;/a&gt; to access the internet. &lt;a href=&quot;http://www.hobo-web.co.uk/design-website-for-blind/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Design Websites For Blind/Visually Impaired, Deaf &amp;#x26; Disabled Visitors&lt;/a&gt; and &lt;a href=&quot;http://www.afb.org/info/accessibility/creating-accessible-websites/tips-and-tricks/235&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Tips and Tricks to Improve Web Accessibility&lt;/a&gt; are useful articles that describe how to make your website accessible for visually impaired users.&lt;/p&gt;
&lt;p&gt;You can check your website on your mobile phone or test it using online tools. Tools such as &lt;a href=&quot;https://www.google.com/webmasters/tools/mobile-friendly/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google’s Mobile Friendly Test&lt;/a&gt; and the &lt;a href=&quot;https://developer.mozilla.org/en/docs/Tools/Responsive_Design_View&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Responsive View in Firefox browser&lt;/a&gt; can be used for checking the accessibility of your website on mobile devices.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Responsive website design is a useful skill that can greatly improve the accessibility of your website. Websites are becoming increasingly popular and it is important for web masters to design websites that are accessible to all users.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Running LXC containers on a Google Compute Instance]]></title><description><![CDATA[Google Cloud Platform is a Google product that provides services related to Cloud Computing. Services provided by Google Cloud include Compute, Storage and Databases, Networking, Big Data, Machine Learning and more.]]></description><link>https://pakjiddat.netlify.app//posts/running-lxc-containers-on-a-google-compute-instance</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/running-lxc-containers-on-a-google-compute-instance</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://cloud.google.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google Cloud Platform&lt;/a&gt; is a Google product that provides services related to Cloud Computing. Services provided by Google Cloud include Compute, Storage and Databases, Networking, Big Data, Machine Learning and more.&lt;/p&gt;
&lt;p&gt;The Compute service includes Compute Engine, App Engine and Container Engine. Compute Engine allows management of virtual machines. App Engine is a powerful platform for building scalable web and mobile applications. Container Engine allows management of Docker Containers.&lt;/p&gt;
&lt;p&gt;This article describes how to run multiple websites on Google Cloud using an approach that is based on LXC containers.&lt;/p&gt;
&lt;h3 id=&quot;running-multiple-applications-in-the-cloud&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-multiple-applications-in-the-cloud&quot; aria-label=&quot;running multiple applications in the cloud permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running multiple applications in the cloud&lt;/h3&gt;
&lt;p&gt;If you want to run several applications in the cloud, one option is to run the applications on a single Docker Container or a single Compute instance. But what if the applications are based on different platforms such as (Linux, Apache, MySQL, PHP) LAMP stack and (MongoDb, Express, AngularJs, NodeJs) MEAN stack. You may want to keep your LAMP and MEAN applications separate. One option is to run the applications on multiple compute instances.&lt;/p&gt;
&lt;p&gt;If you have a small budget then this may not be possible. Another option is to run the applications within separate containers running on a single compute instance. LXC is a good choice for containers because it is present in the default package repository of most Linux distributions. It is also lightweight and consumes very little system resources.&lt;/p&gt;
&lt;h3 id=&quot;configuring-networking-for-lxc-containers&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-networking-for-lxc-containers&quot; aria-label=&quot;configuring networking for lxc containers permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring networking for LXC containers&lt;/h3&gt;
&lt;p&gt;The installation of Linux Containers (LXC) is straight forward and is described in &lt;a href=&quot;/posts/installing-lxc-containers-on-debian-jessie&quot;&gt;Installing LXC containers on Debian Jessie&lt;/a&gt;. There are different options for configuring networking for LXC containers.&lt;/p&gt;
&lt;p&gt;The approach I used is based on &lt;strong&gt;libvirt&lt;/strong&gt; and is described in the &lt;a href=&quot;https://wiki.debian.org/LXC/LibVirtDefaultNetwork&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Debian Wiki article on LXC networking&lt;/a&gt;. The libvirt network creates a bridge networking device on the main host. It also runs a DHCP server and a service called DNSMasq. The DNSMasq service provides DNS services to the containers. The containers run DHCP client services which are used to fetch the ip address from the DHCP server. The ebtables bridge firewall is also used. The main steps involved are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Installing Libvirt.&lt;/strong&gt; This can be done with the command &lt;strong&gt;apt-get install libvirt-bin&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuring the default network&lt;/strong&gt;. This involves editing the default.xml configuration file for the default libvirt network. The file requires the start and end DHCP ip addresses of the LXC containers and the ip address of the bridge interface&lt;/li&gt;
&lt;li&gt;**Start the libvirt default network.**The libvirt default network is started using the command &lt;strong&gt;virsh net-start default&lt;/strong&gt;. Use the &lt;strong&gt;ifconfig -a&lt;/strong&gt; command to verify the existence of the bridge interface&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Edit the container network configuration&lt;/strong&gt;. Edit the file: &lt;strong&gt;/var/lib/lxc/a_container/config&lt;/strong&gt;, where a_container is the name of your container. It should have a networking section similar to the following:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = virbr0
lxc.network.hwaddr = 00:FF:AA:00:00:03
lxc.network.ipv4 = 0.0.0.0/24&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Set the containers to auto start&lt;/strong&gt;. To auto start the containers each time the host server reboots, each container’s configuration file should have following lines:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;# Autostart
lxc.start.auto = 1
lxc.start.delay = 5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The line &lt;strong&gt;lxc.start.delay&lt;/strong&gt; is used to start the container after a delay of 5 seconds. This is done so that there is an interval between the starting of containers. For some reason this did not work for me and all the containers did not start on boot, so I had to add following to &lt;strong&gt;/etc/rc.local&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;lxc-start -n a_container -d&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;running-multiple-websites-behind-nginx-proxy-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-multiple-websites-behind-nginx-proxy-server&quot; aria-label=&quot;running multiple websites behind nginx proxy server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running multiple websites behind Nginx proxy server&lt;/h3&gt;
&lt;p&gt;It is possible to run multiple websites on different containers. These containers can run on a single host. The websites can be served by a single instance of Nginx running on the main host.&lt;/p&gt;
&lt;p&gt;The Nginx web server acts as a reverse proxy server and serves content from the different websites running on the containers. To configure Nginx as a reverse proxy server for a website the following configuration file can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;server {
  listen 80;
  listen [::]:80;

  root /var/www/html;

  # Add index.php to the list if you are using PHP
  index index.html index.htm index.nginx-debian.html;
  server_name hostname-of-your-website;

  location / {
    proxy_set_header Host $host;
    proxy_pass http://private-ip-address-of-your-container$uri$is_args$args;
  }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above configuration file should be created inside the &lt;strong&gt;/etc/nginx/sites-available&lt;/strong&gt; folder. A symbolic link to the file should be added to &lt;strong&gt;/etc/nginx/sites-enabled&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;This article described an approach for running multiple websites on a single Google Compute Instance. It suggests running the websites on different containers and accessing the websites through a single instance of Nginx web server. This approach can easily be used on other Cloud Computing platforms such as Amazon Web Services (AWS) and Microsoft Azure.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Some excellant Wordpress Plugins]]></title><description><![CDATA[This blog post is about my experience with using WordPress plugins. WordPress is an excellent blogging platform that is used by millions. It has an enormous number of plugins that are maintained by people all over the world. You can find a WordPress plugin for just about any function you can imagine.]]></description><link>https://pakjiddat.netlify.app//posts/some-excellant-wordpress-plugins</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/some-excellant-wordpress-plugins</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;This blog post is about my experience with using WordPress plugins. WordPress is an excellent blogging platform that is used by millions. It has an enormous number of plugins that are maintained by people all over the world. You can find a WordPress plugin for just about any function you can imagine.&lt;/p&gt;
&lt;p&gt;WordPress has evolved from a blogging platform to an application platform, content management system and more. Plugins such as &lt;a href=&quot;https://wordpress.org/plugins/buddypress/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Buddypress&lt;/a&gt; can transform your WordPress into a full featured online social community or even company intranet.&lt;/p&gt;
&lt;h3 id=&quot;wordpress-plugins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wordpress-plugins&quot; aria-label=&quot;wordpress plugins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;WordPress Plugins&lt;/h3&gt;
&lt;p&gt;I found the following WordPress plugins useful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/wordfence&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wordfence Security&lt;/a&gt;
This is an excellent plugin that keeps your WordPress secure. With increase in popularity, WordPress has become the target of hackers and bots. There are several viruses that target WordPress core and WordPress plugins.&lt;/p&gt;
&lt;p&gt;Wordfence scans your WordPress files and emails you if it finds a suspicious file. WordFence compares the WordPress files with the ones from wordpress.org. If it sees a changed file, it sends a notification email. It also emails you when someone logs in to your WordPress site.&lt;/p&gt;
&lt;p&gt;Wordfence also sends newsletters to its users by email. These contain important security related information for WordPress such as new WordPress viruses. One of their newsletters that I found interesting is titled &lt;a href=&quot;https://www.wordfence.com/blog/2014/11/wordpress-security-nulled-scripts-cryptophp-infection/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“WordPress Security: Nulled Scripts and the CryptoPHP Infection”&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I recently had to recover a hacked WordPress website and found &lt;a href=&quot;https://www.wordfence.com/docs/how-to-clean-a-hacked-wordpress-site-using-wordfence/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“How to Clean a Hacked WordPress Site using Wordfence”&lt;/a&gt;, from Wordfence very useful.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;wordpress-seo&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wordpress-seo&quot; aria-label=&quot;wordpress seo permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/wordpress-seo&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wordpress SEO&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is an excellent plugin that can help you boost your rankings on search engines. It lets you specify the meta keywords and description for each blog post. This allows you to set the blog information that would appear on search engines like Google.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;wp-slimstats&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#wp-slimstats&quot; aria-label=&quot;wp slimstats permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/wp-slimstat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WP Slimstats&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin collects and displays statistics about your blog posts, such as the number of visitors, duration of visits, number of page views etc. There are other analytic plugins for WordPress but I found this one quite useful since it integrates well with WordPress. It provides a nice dashboard from where you can view detailed statistics about your website visitors. One drawback of this plugin is that it can slow down your website.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;enlighter---javascript-based-syntax-highlighting&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#enlighter---javascript-based-syntax-highlighting&quot; aria-label=&quot;enlighter   javascript based syntax highlighting permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/enlighter/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Enlighter - Javascript based syntax highlighting&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This is a useful plugin for high lighting source code. If you are a developer like me and want to share code snippets then you will find this plugin useful. It displays your code in a nice highlighted box. You can change the style of the box. The plugin supports around 15 programming languages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;shareaholic--share-buttons-analytics-related-content&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#shareaholic--share-buttons-analytics-related-content&quot; aria-label=&quot;shareaholic  share buttons analytics related content permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/shareaholic/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Shareaholic | share buttons, analytics, related content&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin allows you to add share buttons on your blog articles. It allows your site visitors to share your content over different social networks. It currently supports several social networks including Twitter, Facebook, Linkedin and Pinterest. It even shows you how many users shared a particular blog.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;google-xml-sitemaps&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#google-xml-sitemaps&quot; aria-label=&quot;google xml sitemaps permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/google-sitemap-generator/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google XML Sitemaps&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin allows you to submit your blog posts to Google, Bing, Yahoo and other search engines. It does this by automatically generating sitemap files. It also automatically informs search engines in case blog posts change.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;infinite-scroll&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#infinite-scroll&quot; aria-label=&quot;infinite scroll permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/infinite-scroll/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Infinite Scroll&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin replaces the next/previous links on your blog with automatic scrolling. When the user reaches the end of the page, the next set of blog posts are automatically displayed. The user can view all your blog posts on one page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;nextgen-gallery-by-photocrati&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#nextgen-gallery-by-photocrati&quot; aria-label=&quot;nextgen gallery by photocrati permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;http://www.nextgen-gallery.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextGEN Gallery by Photocrati&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin allows you to embed photo galleries inside your blog posts. It allows fine grained control over gallery style. It also allows setting meta information for gallery images.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;nextscripts-social-networks-auto-poster&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#nextscripts-social-networks-auto-poster&quot; aria-label=&quot;nextscripts social networks auto poster permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://wordpress.org/plugins/social-networks-auto-poster-facebook-twitter-g/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextScripts: Social Networks Auto-Poster&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This plugin allows you to submit your WordPress blog post to a large number of social networks. e.g Twitter, Linkedin and Facebook. The plugin has excellent documentation on how to connect social network accounts to your WordPress blog. It also gives a lot of options for posting to social networks. e.g you can choose to include images in your twitter posts.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;WordPress has thousands of plugins. You can find several plugins that perform a required functions. e.g there are dozens of plugins for sharing on socials networks. Finding the right plugin for the job usually involves trial and error. You may have to try out several plugins before finding the one that best matches your requirements.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Tuning WordPress performance using Varnish]]></title><description><![CDATA[Recently I had the opportunity of on tuning website performance using Varnish. Varnish is called a Caching HTTP Reverse Proxy. This means it sits between your end user and one or more back-end servers such as Apache or Nginx and functions as a cache for HTTP traffic.]]></description><link>https://pakjiddat.netlify.app//posts/tuning-wordpress-performance-using-varnish</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/tuning-wordpress-performance-using-varnish</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of on tuning website performance using &lt;a href=&quot;https://www.varnish-cache.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Varnish&lt;/a&gt;. Varnish is called a Caching HTTP Reverse Proxy. This means it sits between your end user and one or more back-end servers such as Apache or Nginx and functions as a cache for HTTP traffic. Varnish can also function as a back-end server for a front-end such as Haproxy. This is the configuration in which we used Varnish.&lt;/p&gt;
&lt;p&gt;Varnish is an excellent option for busy websites. It is a very fast and efficient caching server that can greatly reduce the time taken for serving requests. Of course to get maximum benefit from Varnish we need to configure and tune it according to our needs&lt;/p&gt;
&lt;h3 id=&quot;installing-varnish&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-varnish&quot; aria-label=&quot;installing varnish permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Varnish&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.varnish-cache.org/docs&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Varnish online documentation&lt;/a&gt; is complete and covers all aspects of using Varnish from installation to configuration and troubleshooting. Installation for Redhat based systems is simple and only requires adding the varnish repository to yum and running &lt;strong&gt;yum install varnish.&lt;/strong&gt; This will install the latest version of varnish on your server.&lt;/p&gt;
&lt;p&gt;The latest version of varnish is 4.0.x. The 4.x branch of Varnish is very different from the 3.x branch so Varnish configuration for 3.x will probably not work on 4.x. Its also difficult to find configuration samples for 4.x branch. If you need help with tuning Varnish you should read their documentation and their &lt;a href=&quot;https://www.varnish-cache.org/support&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;online support forum&lt;/a&gt;. &lt;a href=&quot;https://www.varnish-cache.org/docs/4.0/whats-new/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Changes from the 3.x branch &lt;/a&gt;are documented on the Varnish website.&lt;/p&gt;
&lt;h3 id=&quot;basicconfiguration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#basicconfiguration&quot; aria-label=&quot;basicconfiguration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Basic Configuration&lt;/h3&gt;
&lt;p&gt;Once we installed Varnish on our Centos 6 server we configured it to listen on port 80 and configured Apache to listen on port 8008. To change listen port of Varnish we set the &lt;strong&gt;VARNISH_LISTEN_PORT=80&lt;/strong&gt; in the main Varnish configuration file &lt;strong&gt;/etc/sysconfig/varnish&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To change Apache port to 8008 we had to edit &lt;strong&gt;/etc/httpd/conf/httpd.conf&lt;/strong&gt; and add port 8008 to the Listen directive.&lt;/p&gt;
&lt;p&gt;After that we changed the Varnish backend port to 8008. This tells Varnish to communicate with Apache over port 8008. To do this we set **.port = “8008” **in &lt;strong&gt;/etc/varnish/default.vcl&lt;/strong&gt; and restarted Varnish using &lt;strong&gt;service varnish restart.&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Varnish can store its content in memory or in files. To configure Varnish so it saves content in memory we had to set&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;VARNISH_STORAGE=&quot;malloc,${VARNISH_STORAGE_SIZE}&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;in &lt;strong&gt;/etc/sysconfig/varnish&lt;/strong&gt;. Thats all that is needed for getting up and running with Varnish.&lt;/p&gt;
&lt;h3 id=&quot;serving-content-over-varnish&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#serving-content-over-varnish&quot; aria-label=&quot;serving content over varnish permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Serving content over Varnish&lt;/h3&gt;
&lt;p&gt;We had to tune and configure Varnish so it allows delivering content from our custom Content Delivery Network. We also had to configure Varnish so it supports WordPress. To do this we had to edit the main Varnish configuration file: &lt;strong&gt;/etc/sysconfig/varnish&lt;/strong&gt; and the default varnish configuration file &lt;strong&gt;/etc/varnish/default.vcl.&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;addingcontent-delivery-network-cdn-server-to-varnish&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#addingcontent-delivery-network-cdn-server-to-varnish&quot; aria-label=&quot;addingcontent delivery network cdn server to varnish permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding Content Delivery Network (CDN) server to Varnish&lt;/h3&gt;
&lt;p&gt;To add our Content Delivery Network (CDN) server to Varnish we did following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edited &lt;strong&gt;/etc/varnish/default.vcl&lt;/strong&gt; and added following lines below the backend statement:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;backend cdn {
  .host = &quot;192.168.1.10&quot;;
  .port = &quot;8000&quot;;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;192.168.1.10 is the IP address of the CDN server. 8000 is HTTP listen port of the CDN server.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Restarted Varnish&lt;/li&gt;
&lt;li&gt;Updated the DNS record for the CDN host name so it points to our Varnish server. Once we did that our CDN content was being served over Varnish.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;serving-wordpress-over-varnish&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#serving-wordpress-over-varnish&quot; aria-label=&quot;serving wordpress over varnish permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Serving WordPress over Varnish&lt;/h4&gt;
&lt;p&gt;In order to serve our WordPress website over Varnish we had to add specific configuration information for WordPress to &lt;strong&gt;/etc/varnish/default.vcl&lt;/strong&gt;. This file contains configuration information in a language called &lt;strong&gt;“Varnish Control Language”&lt;/strong&gt; or VCL.&lt;/p&gt;
&lt;p&gt;Using this language we can configure Varnish for various tasks. The VCL configuration file contains sub routines that correspond to different stages of request execution in Varnish. These sub routines are documented in the &lt;strong&gt;default.vcl&lt;/strong&gt; files. They are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;vcl_recv&lt;/strong&gt;. This is called by varnish just before it checks if the request is in cache or not. In this sub routine we can clear cookies from the request or rewrite the request.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;vcl_backend_response&lt;/strong&gt;. This is called just before Varnish reads the HTTP response headers from the back-end. In this sub routine we can clear cookies that are set by the back-end.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;vcl_deliver&lt;/strong&gt;. This is called just before the response is sent to the client. In this sub routine we can do basic accounting tasks or modify the final object before it is delivered to the client. For example we can set a HTTP response header indicating if the request was a cache hit or a cache miss.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;adding-http-headers-to-varnish-output&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-http-headers-to-varnish-output&quot; aria-label=&quot;adding http headers to varnish output permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding HTTP headers to Varnish output&lt;/h3&gt;
&lt;p&gt;If you have multiple Varnish back-ends. For example you have one HAProxy front-end that load balances between multiple Varnish back-ends, then it would be useful to know which Varnish back-end served a request. You can do this be using the following vcl code in &lt;strong&gt;vcl_deliver&lt;/strong&gt; sub routine.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;sub vcl_deliver {
resp.http.X-Server= &quot;dev.example.com&quot;;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It sets the server name to dev.example.com. You can view the HTTP headers added by Varnish such as cache hit/miss, cache duration etc from Google Chrome’s Developer Toolbox.&lt;/p&gt;
&lt;h3 id=&quot;download-the-vcl&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#download-the-vcl&quot; aria-label=&quot;download the vcl permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Download the VCL&lt;/h3&gt;
&lt;p&gt;Varnish has some useful &lt;a href=&quot;https://www.varnish-cache.org/trac/wiki/VCLExampleTemplateWordpressPurge&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;VCL code for WordPress&lt;/a&gt; but it only works with Varnish 3.x. I had to modify the code so it works with Varnish 4.x.&lt;/p&gt;
&lt;h3 id=&quot;varnish-plugin-for-wordpress&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#varnish-plugin-for-wordpress&quot; aria-label=&quot;varnish plugin for wordpress permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Varnish plugin for WordPress&lt;/h3&gt;
&lt;p&gt;WordPress has a useful plugin for Varnish called &lt;a href=&quot;https://wordpress.org/plugins/varnish-http-purge/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Varnish HTTP Purge&lt;/a&gt;. It allows WordPress admin users to remove or purge pages from the Varnish cache.&lt;/p&gt;
&lt;h3 id=&quot;securing-varnish&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#securing-varnish&quot; aria-label=&quot;securing varnish permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Securing Varnish&lt;/h3&gt;
&lt;p&gt;One of the tasks that are commonly carried out in Varnish is purging content from the Varnish cache. By default Varnish allows purging content from any host. This can create a security issue, so its best to configure Varnish so it allows purging content from local host or specific IPs.&lt;/p&gt;
&lt;p&gt;To do this we need to create an Access Control List in Varnish that defines which hosts are allowed to purge Varnish cache. The following VCL statements achieved this:&lt;/p&gt;
&lt;p&gt;Place following after the back-end statements:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;acl purge {
  &quot;localhost&quot;;
  &quot;127.0.0.1&quot;;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Place following inside &lt;strong&gt;vcl_recv sub routine&lt;/strong&gt;. It checks the HTTP request method. If the method is PURGE and the IP from where the purge request is made is supported by the above ACL then the object is purged from the Varnish cache and the next VCL statement is executed. If the IP is not supported by the ACL then an error is shown to the user.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;if (req.method == &quot;PURGE&quot;) {
  if (!client.ip } purge) {
    return(synth(405,&quot;Not allowed.&quot;));
  }
  return (purge);
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Place following inside &lt;strong&gt;vcl_hit&lt;/strong&gt; sub routine. vcl_hit is the function that is called when the object is found in the Varnish cache. If the request method is PURGE then Varnish returns success.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;if (req.method == &quot;PURGE&quot;) {    
  return(synth(200,&quot;OK&quot;));
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Place following inside vcl_miss sub routine. vcl_miss is the function that is called when the object is not found in the Varnish cache. If the request method is PURGE and the object was not found in the cache, then the sub routine returns success since the object was not in cache anyway.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;if (req.method == &quot;PURGE&quot;) {    
  return(synth(200,&quot;OK&quot;));
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also purge content from the Varnish cache using following command line: &lt;strong&gt;curl -X PURGE content_url&lt;/strong&gt;. Make sure you issue this command from a host that is allowed by the ACL that you defined in your varnish VCL file.&lt;/p&gt;
&lt;p&gt;The VCL configuration file of WordPress performs 2 main tasks. One is to allow purging of Varnish content from certain IPs. The other is to remove cookies from client HTTP requests and back-end HTTP response.&lt;/p&gt;
&lt;p&gt;Varnish never caches content that has cookies. So any content that needs to be cached must be stripped of all cookies.&lt;/p&gt;
&lt;p&gt;Of course you don’t want to cache content from WordPress admin pages so you need to add suitable VCL statements that exclude the admin pages. Another thing to note about Varnish is that it considers objects with different URL query strings as different.&lt;/p&gt;
&lt;p&gt;So if you want to prevent a JavaScript file from being cached one option is to append a query string to the URL and change the query string each time the JavaScript file is updated and needs to be removed from the Varnish cache.&lt;/p&gt;
&lt;h3 id=&quot;checking-errors&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#checking-errors&quot; aria-label=&quot;checking errors permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Checking errors&lt;/h3&gt;
&lt;p&gt;If you have an error in your VCL configuration file and you restart Varnish, then at least on Centos servers you wont see any descriptive error message. To see the error message you can start varnish manually from the command line using following: &lt;strong&gt;vanrishd -f /etc/varnish/default.vcl&lt;/strong&gt;. This will show the errors in the VCL configuration.&lt;/p&gt;
&lt;h3 id=&quot;viewing-statistics&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#viewing-statistics&quot; aria-label=&quot;viewing statistics permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Viewing statistics&lt;/h3&gt;
&lt;p&gt;Varnish also has built in tools for viewing statistics. These tools are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;varnishtop&lt;/strong&gt;. It reads the varnish shared memory logs and presents a list of the most commonly updated log entries. e.g it can list ranking of requested documents, clients, user agents etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;varnishhist&lt;/strong&gt;. It reads shared memory logs and displays continuously updated histogram showing distribution of last N requests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;varnishtop&lt;/strong&gt;. it displays different varnish counters such as hit rate, miss rate, information about storage, threads created, deleted objects etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;edge-side-includes&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#edge-side-includes&quot; aria-label=&quot;edge side includes permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Edge side includes&lt;/h3&gt;
&lt;p&gt;Varnish also has a feature called edge side includes or ESI. This allows different caching policies to be applied to different parts of a web page. For example if a web page includes a statement such as:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;esi:include src=&quot;/includes/some_content.html&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then that will cause Varnish to replace the include statement with the content. This can be used for example by a news web site for caching the list of top 10 news items.&lt;/p&gt;
&lt;p&gt;Varnish is a very popular choice for use as HTTP cache. Many I.T tools provide support for Varnish. For example the monitoring tool, &lt;a href=&quot;http://munin-monitoring.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Munin&lt;/a&gt; has a plugin for Varnish that allows users to graph Varnish statistics.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;While there are other HTTP caches such as &lt;a href=&quot;http://www.squid-cache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Squid&lt;/a&gt;, I found Varnish to be an excellent option. It has many configuration options, its easy to configure, it has good statistics and log monitoring tools and is being actively developed.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Upgrading JWPlayer to version 7]]></title><description><![CDATA[JWPlayer is one of the most widely used video players. It has evolved from a simple video player into a video publishing platform. The latest version 7 of the player is a major upgrade from the last version. Websites that use the old JWPlayer 6 should upgrade to the latest version.]]></description><link>https://pakjiddat.netlify.app//posts/upgrading-jwplayer-to-version-7</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/upgrading-jwplayer-to-version-7</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;JWPlayer is one of the most widely used video players. It has evolved from a simple video player into a video publishing platform. The latest version 7 of the player is a major upgrade from the last version. Websites that use the old JWPlayer 6 should upgrade to the latest version.&lt;/p&gt;
&lt;h3 id=&quot;changes-in-the-new-jwplayer&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#changes-in-the-new-jwplayer&quot; aria-label=&quot;changes in the new jwplayer permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changes in the new JWPlayer&lt;/h3&gt;
&lt;p&gt;The new version of JWPlayer contains many new features and has deprecated or removed many features in the old version.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://support.jwplayer.com/customer/en/portal/articles/2037989-migration-from-jw6-to-jw7&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;JWPlayer upgrade guide&lt;/a&gt; has useful documentation of the changes introduced in version 7. Briefly here are the changes in the new version:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The JW7 does not support the old XML based skin format of JW6. It uses a CSS based format for configuring skins&lt;/li&gt;
&lt;li&gt;The JW7 can only be embedded on web pages with doc-type of HTML 5&lt;/li&gt;
&lt;li&gt;The new JW7 uses RSS feed format for its playlists. It does not support the old XML format of JW6&lt;/li&gt;
&lt;li&gt;The layout of playlists in JW7 is very different from JW6. The JW7 has built in support for playlists and does not support the horizontal playlist layout of JW6. The JW7 does support changing the playlist layout. By using CSS and JavaScript it is possible to design horizontal playlist layout for the JW7. I was able to design a horizontal layout for the JW7&lt;/li&gt;
&lt;li&gt;The JW7 interface does not render with flash. It only renders with HTML 5. It does support flash media but renders with html5&lt;/li&gt;
&lt;li&gt;The JW7 supports the new Analytics.js library for Google Analytics support. It no longer supports the old ga.js library&lt;/li&gt;
&lt;li&gt;The JW7 no longer supports Internet Explorer 8&lt;/li&gt;
&lt;li&gt;The JW7 requires a license for all versions of the player. A free license is available&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The new JW7 is a major upgrade from the old JW6. Be sure to carefully read the documentation when upgrading to the new JW7&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Using Youtube API for validating URLs]]></title><description><![CDATA[Google recently updated its Developer Console into a unified platform for accessing all of its APIs. The Google Developer Console not only provides a single location for accessing information about all Google APIs but also provides links to code samples and API SDKs. It also provides online tools for testing the APIs.]]></description><link>https://pakjiddat.netlify.app//posts/using-youtube-api-for-validating-urls</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/using-youtube-api-for-validating-urls</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Google recently updated its Developer Console into a unified platform for accessing all of its APIs. The Google Developer Console not only provides a single location for accessing information about all Google APIs but also provides links to code samples and API SDKs. It also provides online tools for testing the APIs.&lt;/p&gt;
&lt;h3 id=&quot;the-youtube-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-youtube-api&quot; aria-label=&quot;the youtube api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;The YouTube API&lt;/h3&gt;
&lt;p&gt;The Google YouTube API is a comprehensive API for accessing YouTube features. The API has several methods grouped into resources. For example activity, thumbnail, video, watermark etc. Some of the methods require authentication using OAuth while others can be accessed without Authentication. However all API methods require an API Key. The API Key can be downloaded from the Development Console.&lt;/p&gt;
&lt;p&gt;The YouTube API supports 4 operations. These are list, update, delete and insert. These operations are carried out on resources. My task was to check if a movie clip is available on YouTube. The most suitable way to do this was to use the list operation on the video resource.&lt;/p&gt;
&lt;p&gt;The YouTube API is easy to download and use. Google provides excellent &lt;a href=&quot;https://developers.google.com/youtube/v3/getting-started#supported-operations&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;documentation on using the YouTube API&lt;/a&gt;. It also provides Client API Libraries and code samples for several languages.&lt;/p&gt;
&lt;p&gt;For example to access YouTube API using PHP you have to first download the Google API PHP Client from Git Hub. After that you have include the autoload.php file in your code. Next you need to instantiate an object of type Google_Service_YouTube and call the relevant function.&lt;/p&gt;
&lt;p&gt;To check for availability of a movie clip, you can use the function listVideos of the videos property. I used the following code for checking for availability of movie clips on YouTube:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;php&quot;&gt;&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/**
* Used to check if the given movie is available on youtube
*
* It uses youtube api and checks if given movie is available on youtube
* If a movie is not available then it returns false
*
* @param string $youtube_video_url the youtube movie url
*
* @return boolean $is_available indicates if the given video is available on youtube
*/&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function-definition function&quot;&gt;IsMovieAvailable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$youtube_video_url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** The autoload.php file is included */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;include_once&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;autoload.php&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** Is available is set to false */&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$is_available&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** The youtube video id is extracted */&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$video_id&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;https://www.youtube.com/watch?v=&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$youtube_video_url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$DEVELOPER_KEY&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$google_api_key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name class-name-fully-qualified&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;Google_Client&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setDeveloperKey&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$DEVELOPER_KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Define an object that will be used to make all API requests.&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$youtube&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name class-name-fully-qualified&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;Google_Service_YouTube&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Call the search.list method to retrieve results matching the specified&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// query term.&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$searchResponse&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$youtube&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;videos&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;listVideos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;status&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;id&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$video_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;/** Each item in the search results is checked */&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$searchResponse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;items&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token comment&quot;&gt;/** If the video id matches the given id then function returns true */&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$video&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&apos;id&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$video_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token variable&quot;&gt;$is_available&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$is_available&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The YouTube API is very detailed and supports all functions that are carried out on the YouTube website. The API is easy to use and is well documented.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Validate your WordPress blog using WordPress XML-RPC API, Php Tidy and Nu HTML Checker]]></title><description><![CDATA[WordPress is a very popular platform for hosting websites. Over 74 million websites are based on WordPress. WordPress is also increasingly being used to develop complex web based applications.]]></description><link>https://pakjiddat.netlify.app//posts/validate-your-wordpress-blog-using-wordpress-xml-rpc-api--php-tidy-and-nu-html-checker</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/validate-your-wordpress-blog-using-wordpress-xml-rpc-api--php-tidy-and-nu-html-checker</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;WordPress is a very popular platform for hosting websites. Over 74 million websites are based on WordPress. WordPress is also increasingly being used to develop complex web based applications.&lt;/p&gt;
&lt;p&gt;There is a need for a testing system that allows testing applications and websites based on WordPress. Recently I had the opportunity of setting up a simple testing system for WordPress that validates WordPress blogs using the WordPress XML-RPC API, PHP Tidy and the online Nu HTML Checker. I will describe my experience in this blog post. I will also briefly describe a couple of ways in which you can test server side code of your WordPress plugins.&lt;/p&gt;
&lt;h3 id=&quot;what-is-the-importance-of-validating-your-website&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#what-is-the-importance-of-validating-your-website&quot; aria-label=&quot;what is the importance of validating your website permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What is the importance of Validating your website&lt;/h3&gt;
&lt;p&gt;Its a good idea to ensure that your WordPress blog conforms to W3C standards. The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. The W3C standard is recognized by all major search engines. Websites that conform to its standards can be understood by search engines and web browses more easily.&lt;/p&gt;
&lt;p&gt;Such websites have fewer performance problems and function more reliably across multiple devices. They are also sure to receive a higher ranking on the major search engines.&lt;/p&gt;
&lt;h3 id=&quot;validating-your-blog-usingnu-html-checker&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#validating-your-blog-usingnu-html-checker&quot; aria-label=&quot;validating your blog usingnu html checker permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Validating your blog using Nu HTML Checker&lt;/h3&gt;
&lt;p&gt;The W3C validation website contains &lt;a href=&quot;http://w3c.github.io/developers/tools/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;several tools&lt;/a&gt; that you can use to validate your website pages. These tools include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/nu/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Nu HTML Checker&lt;/a&gt;. It can checks HTML of any document. It supports html5&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/checklink%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Link Checker&lt;/a&gt;. It checks for broken links on your page&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/RDF/Validator/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RDF Validator&lt;/a&gt;. It checks and visualizes RDF documents&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/mobile-alpha/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Mobile Checker&lt;/a&gt;. It checks the mobile friendliness of your website&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/i18n-checker/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Internationalization checker&lt;/a&gt;. It checks level of internationalization-friendliness of your website&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/feed/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;RSS feed validator&lt;/a&gt;. Validator for RSS and Atom feeds&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://jigsaw.w3.org/css-validator/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CSS Validator&lt;/a&gt;. Checks the CSS of your website&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Markup Validator&lt;/a&gt;. Checks the HTML or XHTML of your website&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://validator.w3.org/unicorn/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Unicorn&lt;/a&gt;. Unified validator. HTML, CSS, Links and Mobile validator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Nu HTML checker can be used to check any website for compliance with the new HTML 5 standard. I created a PHP script that uses the &lt;a href=&quot;https://codex.wordpress.org/XML-RPC_Support%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WordPress XML-RPC API&lt;/a&gt; for getting list of all pages, posts, custom posts on my blog. The XML-RPC API is very useful and you can use it to easily get list of all pages on your blog. Once you have the list of pages, you can test each page against different W3C standards.&lt;/p&gt;
&lt;p&gt;For each post the script validates the post HTML using the &lt;a href=&quot;http://php.net/manual/en/tidy.examples.basic.php%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PHP Tidy extension&lt;/a&gt; and the Nu HTML Checker. The PHP Tidy extension is a popular extension for PHP that allows repairing and formatting your HTML code. It supports HTML 4 validation but does not support HTML 5.&lt;/p&gt;
&lt;p&gt;If a post cannot be validated the test ends with an error. I ran this script with &lt;a href=&quot;https://phpunit.de/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;PhpUnit&lt;/a&gt; and added it to &lt;a href=&quot;https://jenkins-ci.org/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Jenkins Continuous Integration Server&lt;/a&gt;. I scheduled the script to run every day, so the script tests all pages automatically and sends me an email if any of the tests fail.&lt;/p&gt;
&lt;p&gt;Setting up projects in Jenkins is quite simple. You can refer to my earlier blog post titled &lt;a href=&quot;/posts/wordpress-deployment-with-jenkins-and-redmine%22&quot;&gt;Continuous integration and Project Management with Jenkins and Redmine&lt;/a&gt; for more information on how to add scripts to Jenkins.&lt;/p&gt;
&lt;h3 id=&quot;testing-server-side-code-of-your-plugins&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#testing-server-side-code-of-your-plugins&quot; aria-label=&quot;testing server side code of your plugins permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Testing Server Side code of your plugins&lt;/h3&gt;
&lt;p&gt;Testing a WordPress website using PhpUnit is different from testing websites based on other platforms. WordPress has its own authentication system which prevents testing WordPress plugins and themes like normal PHP scripts. There are 2 main options for testing the server side code of your plugins:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://wp-cli.org/%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WP-CLI&lt;/a&gt;. WP-CLI is a command line interface to WordPress. It can be used along with PhpUnit to unit test your WordPress plugins. The WP-CLI website has some useful &lt;a href=&quot;https://github.com/wp-cli/wp-cli/wiki/Plugin-Unit-Tests%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;documentation on how to test WordPress plugins&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://codex.wordpress.org/XML-RPC_Extending%22&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Extend the WordPress XML-RPC interface&lt;/a&gt; inside your plugins. This method allows you to test your plugins using WordPress XML-RPC interface. Basically it allows you to call your test functions using WordPress XML-RPC interface.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;WordPress is a very popular platform for websites. It is important to have a testing system in place that makes it easy to test WordPress based websites.&lt;/p&gt;
&lt;p&gt;Ensuring that your website conforms to W3C standards is very useful. It not only improves your SEO score but also ensures compatibility of your website across different devices and browsers.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[WordPress for small and medium businesses]]></title><description><![CDATA[WordPress is an excellent platform for small and medium businesses (SMBs). Recently I had the opportunity of constructing the home page for a small business. I will share my experience in this blog post.]]></description><link>https://pakjiddat.netlify.app//posts/wordpress-for-small-and-medium-businesses</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/wordpress-for-small-and-medium-businesses</guid><pubDate>Tue, 11 Apr 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;WordPress is an excellent platform for small and medium businesses (SMBs). Recently I had the opportunity of constructing the home page for a small business. I will share my experience in this blog post.&lt;/p&gt;
&lt;p&gt;After working as I.T manager for a small business for a few years, I realized how important requirements are to the company. Requirements that seem insignificant to a technical person can be a matter of life and death for the company.&lt;/p&gt;
&lt;p&gt;Its very important for the I.T support person to ensure company requirements are correctly and completely fulfilled. SMBs tend live on a day to day bases. Unlike large companies, SMBs have small capital and have to fight for survival. I.T support for SMBs needs to be alert and focused on the company requirements. Also the management of SMBs usually are not interested in technical concerns of I.T people. They just want the job done.&lt;/p&gt;
&lt;h3 id=&quot;it-requirements-of-smbs&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#it-requirements-of-smbs&quot; aria-label=&quot;it requirements of smbs permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;I.T Requirements of SMB’s&lt;/h3&gt;
&lt;p&gt;As web master for a SMB, I have learned that the company requirements tend to be very focused. At first the requirements seem very simple and can easily put off an “educated” I.T worker. However these requirements are very specific and meeting them correctly is no small task.&lt;/p&gt;
&lt;p&gt;The home page for a SMB represents the SMB on the internet. It needs to have following features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It should present the company’s work clearly&lt;/li&gt;
&lt;li&gt;It should promote the company’s services and products&lt;/li&gt;
&lt;li&gt;It needs to take advantage of business promotion features available on the internet, such as those provided by Twitter, Facebook and Linkedin&lt;/li&gt;
&lt;li&gt;It needs to be easy to manage. For example adding new features to the Home Page should be easy&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In my opinion, the most important feature of the home page is that it needs to be easy to manage. For this reason WordPress is my platform of choice for home page for a SMB.&lt;/p&gt;
&lt;h3 id=&quot;why-use-wordpress&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-use-wordpress&quot; aria-label=&quot;why use wordpress permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why use WordPress&lt;/h3&gt;
&lt;p&gt;WordPress is not only easy to administer, but it can also be extended easily. It has a large number of website themes to choose from. New features can be easily added as plugins. WordPress supports thousands of plugins. Some of the WordPress plugins I found useful are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://tribulant.com/plugins/view/13/wordpress-slideshow-gallery&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Slideshow Gallery&lt;/a&gt; plugin, for presenting product and service images attractively.&lt;/li&gt;
&lt;li&gt;Making contact forms with WordPress is easy with the help of plugins such as &lt;a href=&quot;https://wordpress.org/plugins/contact-form-7/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Contact Form 7&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;If you need to post your WordPress articles on social networks easily, you can use &lt;a href=&quot;http://www.nextscripts.com/social-networks-auto-poster-for-wordpress&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;NextScripts: Social Networks Auto-Poster&lt;/a&gt; plugin.&lt;/li&gt;
&lt;li&gt;If you want to make it easy for your website visitors to share information about your website, you can use the &lt;a href=&quot;https://shareaholic.com/publishers/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Shareaholic | share buttons, analytics, related content&lt;/a&gt; plugin.&lt;/li&gt;
&lt;li&gt;WordPress also has some nice plugins for web masters such as &lt;a href=&quot;http://wordpress.org/plugins/wp-slimstat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WP Slimstat&lt;/a&gt;, &lt;a href=&quot;https://yoast.com/wordpress/plugins/seo#utm_source=wpadmin&amp;#x26;utm_medium=plugin&amp;#x26;utm_campaign=wpseoplugin&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;WordPress SEO&lt;/a&gt; and &lt;a href=&quot;http://www.wordfence.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Wordfence Security&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It can be easy to get carried away with the large number of WordPress features. WordPress has plugins for just about any purpose. You can get lost trying to find the plugin that meets the actual requirement. Its important to stay focused on the task at hand and not experiment with different plugins.&lt;/p&gt;
&lt;p&gt;For a SMB website, its more important to just get the job done correctly. One may question the benefit of having thousands of plugins to choose from. I think WordPress has many great features but not all of them are suitable for a SMB website.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;I think being easy to manage and update is the best feature of WordPress for SMBs. Having thousands of plugins and themes and being easy to customize is great but more suitable for custom applications instead of simple web sites for SMBs.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Customizing Redmine layout]]></title><description><![CDATA[The user interface of Redmine can be easily customizing using the redmine_custom_css and redmine_custom_js plugins.]]></description><link>https://pakjiddat.netlify.app//posts/customizing-redmine-layout</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/customizing-redmine-layout</guid><pubDate>Mon, 13 Mar 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The user interface of Redmine can be easily customizing using the &lt;a href=&quot;http://www.redmine.org/plugins/redmine_custom_css&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;redmine_custom_css&lt;/a&gt; and &lt;a href=&quot;http://www.redmine.org/plugins/redmine_custom_js&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;redmine_custom_js&lt;/a&gt; plugins.&lt;/p&gt;
&lt;p&gt;To add a background image to the Redmine login page the following JavaScript code can be used:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; document &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#top-menu&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Sign out&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;main&apos;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;custom-background&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#content &gt; h2&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;hide&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;.splitcontentleft&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;float-right&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;    
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code checks if the “Sign out” link is present in the header. If it is not present, then it adds a CSS class called “custom-background” to the div with id “main”. It also does some minor formatting of the layout. The “custom-background” CSS class may be defined with the help of the redmine_custom_CSS plugin. It can be defined as follows:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.custom-background&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #ffffff &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;https://example.com/background.jpg&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt; no-repeat scroll 50px 0 &lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can edit the Redmine top menu bar with the help of the redmine_custom_js plugin. For example the following code adds a new menu item to the top menu bar when the user is logged in:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#top-menu&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;ul&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; updated_list_items &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;li class=&apos;item-0&apos;&gt;&amp;lt;a href=&apos;https:/example.com/&apos;&gt;Company Name&amp;lt;/a&gt;&amp;lt;/p&gt;&amp;lt;/li&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  updated_list_items     &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; updated_list_items &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#top-menu &gt; ul&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#top-menu &gt; ul&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;updated_list_items&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code first checks if the list of menu items is present. If it is present, then it creates a new menu item and adds it to the front of the list of menu items.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing W3C Markup Validator on Debian Jessie]]></title><description><![CDATA[The W3C Markup Validator is a useful tool that allows validating HTML text. It can be used to check if a given web page or text conforms to the HTML 5 standard.]]></description><link>https://pakjiddat.netlify.app//posts/installing-w3c-markup-validator-on-debian-jessie</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-w3c-markup-validator-on-debian-jessie</guid><pubDate>Mon, 13 Mar 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The &lt;a href=&quot;https://validator.w3.org/docs/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;W3C Markup Validator&lt;/a&gt; is a useful tool that allows validating html text. It can be used to check if a given web page or text conforms to the html 5 standard. The following points may be considered during installation of W3C markup validator:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;local copy of validator is more reliable and easy to use for bulk use&lt;/li&gt;
&lt;li&gt;W3C Markup Validator supports validation of html,xml, xhtml, html5, mathml and more&lt;/li&gt;
&lt;li&gt;html5 validation requires validator.nu installation&lt;/li&gt;
&lt;li&gt;deb file not available in default repository for Debian Jessie&lt;/li&gt;
&lt;li&gt;W3C Markup Validator has to be installed from source. install guide given on: &lt;a href=&quot;https://validator.w3.org/docs/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://validator.w3.org/docs/install.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;install guide for mod_perl from source (&lt;a href=&quot;https://perl.apache.org/docs/2.0/user/install/install.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://perl.apache.org/docs/2.0/user/install/install.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;following perl module had to be installed: SGML-Parser-OpenSP&lt;/li&gt;
&lt;li&gt;libperl-dev package required for mod_perl compilation (&lt;a href=&quot;http://tara24.de/fix-configure-errorperl-development-headers-found/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://tara24.de/fix-configure-errorperl-development-headers-found/&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;java 8 required for validator.nu&lt;/li&gt;
&lt;li&gt;java 8 for debian jessie requires backport repository (&lt;a href=&quot;http://backports.debian.org/Instructions/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;http://backports.debian.org/Instructions/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Responsive web design with HTML 5 and CSS 3]]></title><description><![CDATA[Responsive website design is a design practice which aims at designing web pages with a layout that works on all devices. It involves several techniques such as responsive images, grid layouts, fluid layouts, media queries and more.]]></description><link>https://pakjiddat.netlify.app//posts/responsive-web-design-with-html-5-and-css-3</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/responsive-web-design-with-html-5-and-css-3</guid><pubDate>Mon, 13 Mar 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Responsive website design is a design practice which aims at designing web pages with a layout that works on all devices. It involves several techniques such as responsive images, grid layouts, fluid layouts, media queries and more. The &lt;a href=&quot;https://www.w3schools.com/css/css_rwd_intro.asp&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Responsive Web Design - Introduction&lt;/a&gt; is a useful resource for learning about Responsive Web Design. Following are some frequently asked questions about responsive website design:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is the difference between mobile website design and responsive website design&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mobile website design means design of websites for mobile devices only. Responsive website design means designing websites for all devices including tablet, mobile, desktop etc. Mobile website design usually means using special frameworks only for mobile devices. Mobile websites do not always look good on desktops but Responsive websites looks good on all devices.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is the difference between view-port and screen size&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;view-port is viewing area of website. If you resize browser window then the view-port changes screen size is size of the device screen&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;So how do we apply view-port to resize&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;view-port is same as browser window, but without the toolbars and buttons. It is just the area where the website shows. Screen size is physical size of device window. When we say IPhone has 5 inch screen, it means screen size of IPhone is 5 inch. view-port is actual area where the website shows in the browser. When we resize browser window, the area where the website shows also resizes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is the key role of Graphics in Website design&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In Website design, before HTML 5 and CSS 3 we had to use tools like Flash and Photoshop, but now we can use HTML 5, JavaScript and CCS 3 for creating good looking affects for websites. For example we can create graphs, charts, animation effects, games and more using just HTML 5, JavaScript and CSS 3&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;So HTML 5 and CCS 3 can create images&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It depends on the type of images you need. But for most images you need a graphics tool like Photoshop or Gimp. Gimp is free and open source. You can also create graphs and charts with HTML 5 and CCS 3 and also animations and games.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Should I use Dreamweaver or Notepad++ for HTML 5 and CSS 3 ?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You may start with simple tools like Notepad++, then use more advanced tools like Dreamweaver or Gimp. It is usually better to first understand the concept using a simple tool.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[What is responsive design]]></title><description><![CDATA[Responsive Design is a new trend in Web Design. It was started by Ethan Marcotte. Responsive Design is the design of websites that work well when viewed on a wide range of devices. For example a responsive website will look good on Iphone, Ipad, Tablets, Laptops and Desktops.]]></description><link>https://pakjiddat.netlify.app//posts/what-is-responsive-design</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/what-is-responsive-design</guid><pubDate>Mon, 13 Mar 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Responsive Design is a new trend in Web Design. It was started by Ethan Marcotte. Responsive Design is the design of websites that work well when viewed on a wide range of devices. For example a responsive website will look good on Iphone, Ipad, Tablets, Laptops and Desktops.&lt;/p&gt;
&lt;p&gt;Responsive Design is not a single technique but a set of several CSS practices, such as proportional layouts, flexible design, flexible images, browser compatibility, pollyfilling, CSS media queries and more.&lt;/p&gt;
&lt;p&gt;A responsive design should be used in most cases. However if the website in question needs to have special requirements specific to a device such as mobile phone, then responsive design is not a good option&lt;/p&gt;
&lt;p&gt;A responsive website should look good across old browsers as well. However it is upto the web designer on how well old browsers are supported. Pollyfilling is a technique used by web designers for supporting old browsers. It requires using different HTML code for browsers that do not support certain HTML standards. There are several pollyfill libraries that provide fallback support to old browsers that do not support certain HTML 5 standards. e.g a video element may be replaced by an image or a paragraph saying the browser does not support the HTML 5 video element&lt;/p&gt;
&lt;p&gt;The book &lt;a href=&quot;https://www.packtpub.com/web-development/responsive-web-design-html5-and-css3&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Responsive Web Design with HTML5 and CSS3&lt;/a&gt; is a useful resource for learning about Responsive Web Design.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[What is the difference between viewports and device width]]></title><description><![CDATA[View port is the viewable area of a browser where the website is shown.]]></description><link>https://pakjiddat.netlify.app//posts/what-is-the-difference-between-viewports-and-device-width</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/what-is-the-difference-between-viewports-and-device-width</guid><pubDate>Mon, 13 Mar 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;View port is the viewable area of a browser where the website is shown.&lt;/p&gt;
&lt;p&gt;The device width is physical width of the device where the website is viewed. The view-port can be scaled using the HTML meta tag. e.g the code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meta&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;viewport&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;initial-scale=2.0,width=device-width&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;scales the viewing area of the browser so it is twice the width of the device. It means the viewing area will be scaled so the it looks like the website is being viewed on the device that is twice the width of the actual device.&lt;/p&gt;
&lt;p&gt;A simple way of changing the browser viewport is to simply resize the browser window.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Finding CPU usage using top command]]></title><description><![CDATA[The top command can be used in combination with bash tools to find CPU usage. The article: Finding CPU usage from top command describes how to find CPU usage using the top command.]]></description><link>https://pakjiddat.netlify.app//posts/finding-cpu-usage-using-top-command</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/finding-cpu-usage-using-top-command</guid><pubDate>Fri, 10 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The top command can be used in combination with bash tools to find CPU usage. The article: &lt;a href=&quot;https://askubuntu.com/questions/68741/finding-cpu-usage-from-top-command/687%2054#68754&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Finding CPU usage from top command&lt;/a&gt; describes how to find CPU usage using the &lt;strong&gt;top&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;The following command extracts CPU usage from the output of top command. The top command is run in batch mode so its output can be extracted:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;cpu_usage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d1&lt;/span&gt; -n1&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Cpu(s)&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;head&lt;/span&gt; -c21&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos; &apos;&lt;/span&gt; -f3&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;%&apos;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f1&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On some systems, in the above command f3 should be replaced with f2. The command returns the value for ‘us’, which is the percentage of the total CPU time spent running un-niced user processes. The output of the above command can be saved in a variable and sent by email using a command like mailx.&lt;/p&gt;
&lt;p&gt;For example the following command will send an alert email to the system administrator using gmail server:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello Admin. The CPU usage on server is &lt;span class=&quot;token variable&quot;&gt;$cpu_usage&lt;/span&gt;%. Please check!&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; /tmp/mail_body.txt
mailx &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;CPU usage on server is more than 70%. Please check!.&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;reply_email&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;smtp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;smtp.gmail.com:587&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-use-starttls &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;login &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;
smtp-auth-user&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_user&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth-password&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_password&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; ssl-verify&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;ignore recepiant_email &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; /tmp/mail_body.txt
&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-rf&lt;/span&gt; /tmp/mail_body&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Monitoring RAM usage on server]]></title><description><![CDATA[The RAM on a server can be monitored using /proc/meminfo and awk commands. /proc/ is a special file system created by the Linux kernel which contains kernel related information such as CPU and memory usage. /proc/meminfo contains information about memory usage.]]></description><link>https://pakjiddat.netlify.app//posts/monitoring-ram-usage-on-server</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/monitoring-ram-usage-on-server</guid><pubDate>Fri, 10 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The RAM on a server can be monitored using &lt;strong&gt;/proc/meminfo&lt;/strong&gt; and awk commands. &lt;strong&gt;/proc/&lt;/strong&gt; is a special file system created by the Linux kernel which contains kernel related information such as CPU and memory usage. &lt;strong&gt;/proc/meminfo&lt;/strong&gt; contains information about memory usage.&lt;/p&gt;
&lt;p&gt;The following bash script can be used to extract memory usage information from &lt;strong&gt;/proc/meminfo&lt;/strong&gt;. It uses the &lt;strong&gt;awk&lt;/strong&gt; text processing command for parsing memory information. It uses &lt;strong&gt;bc&lt;/strong&gt; command for performing floating point operations. The bash scripting language does not support arithmetic operations on floating point numbers so an external tool like &lt;strong&gt;bc&lt;/strong&gt; is needed&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# the total memory. the MemTotal row is extracted using awk. the second column of this row is then extracted and saved to total variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/MemTotal/ {print $2}&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; /proc/meminfo &lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the available memory. the MemAvailable row is extracted using awk. the second column of this row is then extracted and saved to available variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;available&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;/MemAvailable/ {print $2}&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; /proc/meminfo &lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# the formula for calculating percentage of available memory is piped to bc command. the output of bc command is saved to memory_available variable&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;memory_available&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;(&lt;span class=&quot;token variable&quot;&gt;$available&lt;/span&gt;*100/&lt;span class=&quot;token variable&quot;&gt;$total&lt;/span&gt;)&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;bc&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# if the available memory is less than 30%&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$memory_available&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-lt&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;30&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# the body of the alert email is saved to a temprary file&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello Admin. The Memory usage on server is &lt;span class=&quot;token variable&quot;&gt;$memory_available&lt;/span&gt;%. Please check!&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; /tmp/mail_body.txt
    &lt;span class=&quot;token comment&quot;&gt;# the mailx command is used to sent the email. it sends the email using gmail server.&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;# this is useful on servers that have limited access to email servers such as Google Compute instance&lt;/span&gt;
    mailx &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Memory usage on server is more than 70%. Please check!.&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;reply_email&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;smtp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;smtp.gmail.com:587&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt;    &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;br/&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;smtp-use-starttls &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;login &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth-user&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_address&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; smtp-auth-password&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;gmail_password&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;br/&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;ssl-verify&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;ignore recepiant_email &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; /tmp/mail_body.txt
    &lt;span class=&quot;token comment&quot;&gt;# the temprary file is removed&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-rf&lt;/span&gt; /tmp/mail_body
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Configuring Apache to process html files as php]]></title><description><![CDATA[To allow Apache web server, to process files ending with .html as PHP files, we need to do two things. First we need to set the content-type http header for .html files to text/html. Secondly, we need to tell the Apache web server to process HTML files as PHP files.]]></description><link>https://pakjiddat.netlify.app//posts/configuring-apache-to-process-html-files-as-php</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/configuring-apache-to-process-html-files-as-php</guid><pubDate>Mon, 06 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;To allow Apache web server, to process files ending with .html as PHP files, we need to do two things. First we need to set the content-type HTTP header for .html files to text/html. Secondly, we need to tell the Apache web server to process HTML files as PHP files.&lt;/p&gt;
&lt;p&gt;Usually this can be achieved by adding following two lines in .htaccess:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;AddHandler application/x-httpd-php .html
AddType text/html .html&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code should work if PHP is configured as an Apache module, but may not work for other configurations like FastCGI.&lt;/p&gt;
&lt;p&gt;To allow Apache to serve files ending with .html as PHP files, we need following code in vhost.conf file for the required virtual host:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;IfModule mod_fcgid.c&gt;
    &amp;lt;Files tilde (\.html)&gt;
        SetHandler fcgid-script
        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .html
        Options +ExecCGI
        allow from all
    &amp;lt;/Files&gt;
&amp;lt;/IfModule&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code is for FastCGI configuration. It will differ for other configurations like mod_php. After editing the file we need to run following command for re-configuring the web server:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;/usr/local/psa/admin/sbin/httpdmng --reconfigure-all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The article: &lt;a href=&quot;https://kb.odin.com/en/115773&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;How to process files with .html extension through PHP (Linux)&lt;/a&gt; describes how to process .html files through PHP on Linux.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Fetching PTR DNS records using Reverse DNS]]></title><description><![CDATA[Reverse DNS or RDNS is the process of fetching the host name for a given IP address. Reverse DNS works similarly to forward DNS.]]></description><link>https://pakjiddat.netlify.app//posts/fetching-ptr-dns-records-using-reverse-dns</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/fetching-ptr-dns-records-using-reverse-dns</guid><pubDate>Thu, 02 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Reverse_DNS_lookup&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Reverse DNS&lt;/a&gt; or RDNS is the process of fetching the host name for a given IP address. Reverse DNS works similarly to forward DNS. It is used in different situations. A common use of RDNS is to resolve an IP address to a host name. The process of resolving an IP address to a host name requires fetching the PTR record for the given IP address. It works as follows:&lt;/p&gt;
&lt;p&gt;The DNS resolver sends a request for an IP address. for example &lt;strong&gt;192.168.1.1&lt;/strong&gt;. The DNS resolver reverses the IP address and appends the domain: &lt;strong&gt;.in-addr.arpa&lt;/strong&gt;. So the request now becomes: &lt;strong&gt;1.1.168.192.in-addr.arpa&lt;/strong&gt;. The DNS resolver sends a request for the PTR record for: &lt;strong&gt;1.1.168.192.in-addr.arpa&lt;/strong&gt; to the root name server.&lt;/p&gt;
&lt;p&gt;The root name server forwards the request to the DNS server that is in charge of Class A IP addresses which is the classification for IP addresses that start with 192. In most cases the request is sent to the DNS servers of a “Regional Internet Registry” for example ARIN for North America, APNIC for Asia Pacific and RIPE for Europe.&lt;/p&gt;
&lt;p&gt;The “Regional Internet Registry” then forwards the PTR request to the DNS servers of the ISP that owns the IP address block. The ISP’s DNS server will forward the PTR request to the organizations DNS servers. The organization’s DNS servers should then respond with the contents of the PTR record.&lt;/p&gt;
&lt;p&gt;The process of Reverse DNS lookup is similar to a normal forward DNS lookup in that each section of the name is looked up. For example first it looks up the DNS servers for &lt;strong&gt;192.in-addr.arpa&lt;/strong&gt; then for DNS server for &lt;strong&gt;168.192.in-addr.arpa&lt;/strong&gt; and then DNS servers for &lt;strong&gt;1.1.168.192.in-addr.arpa&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;PTR DNS records can be regarded as a pointer to a DNS record. It essentially points to a host name. Configuration of PTR records must be done by the ISP first. The ISP’s DNS server usually has a NS or nameserver record with name: &lt;strong&gt;1.168.192.in-addr.arpa&lt;/strong&gt; and value: ip-of-organizations-dns-server. The organization’s DNS server then adds a PTR record with name: &lt;strong&gt;1&lt;/strong&gt; and value: &lt;strong&gt;required-host-name&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;PTR records are commonly used to verify email servers. An email server with an invalid PTR record will not be able to send email since it is not trusted by most email servers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.leadfeeder.com/what-is-reverse-dns-and-why-you-should-care/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;What is reverse DNS and why should you care?&lt;/a&gt; is a useful article that describes in layman’s terms how Reverse DNS and PTR records work. It explains the importance of Reverse DNS and PTR records and how they are used by Web Analytics software and email clients.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Server Migration with Plesk]]></title><description><![CDATA[Plesk is a commercial platform for managing website hosting. The cost of using Plesk depends on the number of domains to be managed, type of hosting (dedicated or VPS), addon products such as anti virus etc. Plesk allows managing FTP, Email, web site hosting, DNS and more.]]></description><link>https://pakjiddat.netlify.app//posts/server-migration-with-plesk</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/server-migration-with-plesk</guid><pubDate>Thu, 02 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Plesk is a commercial platform for managing website hosting. The cost of using Plesk depends on the number of domains to be managed, type of hosting (dedicated or VPS), addon products such as anti virus etc. Plesk allows managing FTP, Email, web site hosting, DNS and more. The user interface is easy to use and well organized. Plesk also has excellent online documentation, which makes it easy to troubleshoot problems.&lt;/p&gt;
&lt;p&gt;This articles describes my experience with migrating server data from one Plesk instance to another using the Plesk Migrator Extension. I had followed the &lt;a href=&quot;https://docs.plesk.com/en-US/onyx/migration-guide/introduction.75496/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Plesk Migration Guide&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;installation-and-pre-requisites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation-and-pre-requisites&quot; aria-label=&quot;installation and pre requisites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation and Pre-requisites&lt;/h3&gt;
&lt;p&gt;Log in as administrator to the Plesk destination server. Next go to “Tools and Settings”, then “Updates and Upgrades”, then go to Add/Remove components. After that select “Install” next to the Plesk Migrator component. Alternately, Plesk may be installed from the command line by running the &lt;strong&gt;plesk installer&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;In order to use the Plesk Migrator, certain TCP ports need to be opened on the source and destination servers. The installation of the Plesk Migrator is documented in this &lt;a href=&quot;https://docs.plesk.com/en-US/onyx/migration-guide/installation-and-prerequisites.75498/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;installation guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Plesk supports migration from following platforms: Plesk for Linux and Plesk for Windows, Cpanel, Confixx, Helm, Plesk Expand and Parallels Pro Control Panel for Linux.&lt;/p&gt;
&lt;p&gt;Following data is transferred: service plans, subscriptions with associated domains and website content. Website content includes database, files and email. The settings of Plesk services such as Php, Firewall, Apache are not transferred.&lt;/p&gt;
&lt;h3 id=&quot;migrating-from-the-web-interface&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-from-the-web-interface&quot; aria-label=&quot;migrating from the web interface permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating from the web interface&lt;/h3&gt;
&lt;h4 id=&quot;creating-a-migration-task&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#creating-a-migration-task&quot; aria-label=&quot;creating a migration task permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating a migration task&lt;/h4&gt;
&lt;p&gt;Log in to Plesk as admin user. Then go to &lt;strong&gt;“Server Management”-&gt;“Extensions”-&gt;“Plesk Migrator”-&gt;“Start a New Migration”&lt;/strong&gt;. For the Panel Type option select Plesk. For the ip address, enter the ip address of the Source Plesk server. For the root login field enter root. For the Authorization field, select either &lt;strong&gt;“User/password”&lt;/strong&gt; or SSH keys.&lt;/p&gt;
&lt;p&gt;If &lt;strong&gt;“User/password”&lt;/strong&gt; option is selected then enter the password for the root user on the source server. If the SSH keys option was selected, then enter the path to the private key file used to login to the target Plesk server.&lt;/p&gt;
&lt;p&gt;Next click on Prepare Migration. The Plesk Migrator will attempt to fetch information about the different subscriptions and domains. Plesk will now create an entry in the migration list. The migration entry can be edited any time.&lt;/p&gt;
&lt;h4 id=&quot;adding-subscriptions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#adding-subscriptions&quot; aria-label=&quot;adding subscriptions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding subscriptions&lt;/h4&gt;
&lt;p&gt;Click on the migration entry. This will open the add subscription tab. On this tab we can select the subscriptions to migration and the content to migrate. For example databases, email and website files. On this page, we must select the subscriptions to migrate. We cannot migrate individual domains within a subscription.&lt;/p&gt;
&lt;h4 id=&quot;migrating-the-subscription&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-the-subscription&quot; aria-label=&quot;migrating the subscription permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating the subscription&lt;/h4&gt;
&lt;p&gt;After selecting the subscriptions to migrate, we need to click on Migrate. Plesk then runs pre-migration checks which displays the list of possible issues. After these issues have been corrected, click on Refresh. Once the pre-migration check returns a clean report, click on “Start migration” to being the migration. The migration progress can be viewed on the overview tab.&lt;/p&gt;
&lt;p&gt;The migration process displays a status report for each subscription that is migrated. After a subscription has been migrated, we can re-sync the subscription by clicking on rsync besides the subscription. After the migration has completed, we can click on “Finish migration” to remove the migration from the list of on going migrations.&lt;/p&gt;
&lt;h4 id=&quot;assigning-ip-address-to-migrated-subscription&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#assigning-ip-address-to-migrated-subscription&quot; aria-label=&quot;assigning ip address to migrated subscription permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Assigning IP address to migrated subscription&lt;/h4&gt;
&lt;p&gt;When migrating a subscription, we will most likely want to change its IP address. We can do this from the subscriptions list tab. On this tab we need to select &lt;strong&gt;“Change IP mapping”&lt;/strong&gt; from the &lt;strong&gt;“IP addresses”&lt;/strong&gt; menu and then select the correct option.&lt;/p&gt;
&lt;h3 id=&quot;migrating-from-the-command-line&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-from-the-command-line&quot; aria-label=&quot;migrating from the command line permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating from the command line&lt;/h3&gt;
&lt;h4 id=&quot;running-the-pre-migration-check&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-the-pre-migration-check&quot; aria-label=&quot;running the pre migration check permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running the pre-migration check&lt;/h4&gt;
&lt;p&gt;Copy a sample configuration file from &lt;strong&gt;/usr/local/psa/admin/plib/modules/panel-migrator/backend/conf/samples/&lt;/strong&gt; folder to &lt;strong&gt;/usr/local/psa/var/modules/panel-migrator/conf/&lt;/strong&gt;. The available configuration files are:  &lt;strong&gt;plesk-unix.simple.ini, cpanel.simple.ini, confixx.simple.ini, and ppcpl.simple.ini&lt;/strong&gt;. I chose the &lt;strong&gt;plesk-unix.simple.ini&lt;/strong&gt; file since I wanted to migrate from a Plesk server running on Linux. After copying the file, rename it to &lt;strong&gt;config.ini&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next we need to edit the &lt;strong&gt;config.ini&lt;/strong&gt; file and specify the ip addresses of the source and target servers and also the login information for both servers.&lt;/p&gt;
&lt;h4 id=&quot;generating-the-migration-list&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#generating-the-migration-list&quot; aria-label=&quot;generating the migration list permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Generating the migration list&lt;/h4&gt;
&lt;p&gt;Next we need to generate the migration list by running the command: &lt;strong&gt;/usr/local/psa/admin/sbin/modules/panel-migrator/plesk-migrator generate-migration-list&lt;/strong&gt;. This will create the file &lt;strong&gt;migration-list&lt;/strong&gt; in the folder &lt;strong&gt;/usr/local/psa/var/modules/panel-migrator/sessions/migration-session/&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The migration list is a list of objects to migrate such as customer and re-seller account, service plans, domains etc. We can edit the migration list and remove domains that should not be migrated or re-assign them between customer accounts. This is one advantage of migrating from the command line. It allows us to select which domains to migrate and also makes it easier to troubleshoot errors.&lt;/p&gt;
&lt;h4 id=&quot;migrating-the-subscriptions&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#migrating-the-subscriptions&quot; aria-label=&quot;migrating the subscriptions permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Migrating the subscriptions&lt;/h4&gt;
&lt;p&gt;Next we need to determine which IP addresses should be used for the migrated subscriptions. The simplest method is to create a simple text file called &lt;strong&gt;ip-address-mappings&lt;/strong&gt; which contains the source and target IP address on each line separated by space. We can use the &lt;strong&gt;—ip-mapping-file&lt;/strong&gt; command line argument. After that we need to run the migration check using the command: &lt;strong&gt;/usr/local/psa/admin/sbin/modules/panel-migrator/plesk-migrator check&lt;/strong&gt;. This will run a migration check. The results of the check will be saved to a file. The issues mentioned in the file should be corrected and the command should be repeated.&lt;/p&gt;
&lt;p&gt;After that we need to run the command: &lt;strong&gt;/usr/local/psa/admin/sbin/modules/panel-migrator/plesk-migrator transfer-accounts —ip-mapping-file ip-address-mappings&lt;/strong&gt;. This will start the migration. After the migration has completed, we can test the result of the migration with the command: &lt;strong&gt;/usr/local/psa/admin/sbin/modules/panel-migrator/plesk-migrator test-all&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Plesk is widely used for managing website hosting. It is easy to manage and has lots of features that greatly simplify web host management.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Rocket Chat installation tips]]></title><description><![CDATA[The following script can be used to run an instance of Rocket Chat]]></description><link>https://pakjiddat.netlify.app//posts/rocket-chat-installation-tips</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/rocket-chat-installation-tips</guid><pubDate>Thu, 12 Jan 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The following script can be used to run an instance of &lt;a href=&quot;https://rocket.chat/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rocket Chat&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token shebang important&quot;&gt;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ps&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; uid,cmd &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token environment constant&quot;&gt;$USER&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; rocketchat &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wc&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token entity&quot; title=&quot;\n&quot;&gt;\n&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;PATH&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/usr/local/bin:&lt;span class=&quot;token environment constant&quot;&gt;$PATH&lt;/span&gt;
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;MONGO_OPLOG_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;mongodb://localhost:27017/local
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;ROOT_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;http://your-domain/
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;MONGO_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;mongodb://localhost:27017/your-database
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;
        &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;MAIL_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;smtp://gmail_email_address:password@smtp.gmail.com:465
        /root/.nvm/versions/node/v4.5.0/bin/forever start &lt;span class=&quot;token parameter variable&quot;&gt;--minUptime&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--spinSleepTime&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10000&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--sourceDir&lt;/span&gt; path-to-rocket-chat main.js &lt;span class=&quot;token parameter variable&quot;&gt;-l&lt;/span&gt; /var/log/forever.log &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; /var/log/forever-out.log &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; /var/log/forever-err.log
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above command checks if an instance of Rocket Chat is already running. If it is not running, then the Rocket Chat is run using the forever command. The forever command ensures that the Rocket Chat keeps running. It restarts the Rocket Chat automatically in case it stops.&lt;/p&gt;
&lt;p&gt;The forever script can be installed with the command: &lt;strong&gt;npm install forever&lt;/strong&gt;. The above script may be run when the system boots up using the following cron job command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;@reboot /root/scripts/rc_starter.sh &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; /dev/null &lt;span class=&quot;token operator&quot;&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;2&lt;/span&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If your Rocket Chat upgrade fails with the error:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;Your database migration failed&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you may need to unlock the migration in mongodb and also increase database version to the next version.&lt;/p&gt;
&lt;p&gt;You can do this by accessing the mongo shell and then entering the rocketchat database using the command: use rocketchat. After that run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;db.migrations.update({_id: &apos;control&apos;},{$set:{locked:false,version:19}})&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Replace 19 with the current version of your database migration.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;https://rocket.chat/docs/administrator-guides/database-migration/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Rocket Chat Database Migration&lt;/a&gt; guide for more information on migrating Rocket Chat instances.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Designing APIs]]></title><description><![CDATA[Application Programming Interfaces (APIs) may be regarded as the building blocks of software applications. APIs provide a subset of the functionality of a system to an application. An API may be regarded as a set of libraries that allows an application to be used by multiple applications.]]></description><link>https://pakjiddat.netlify.app//posts/designing-apis</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/designing-apis</guid><pubDate>Fri, 04 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Application Programming Interfaces (APIs) may be regarded as the building blocks of software applications. APIs provide a subset of the functionality of a system to an application. An API may be regarded as a set of libraries that allows an application to be used by multiple applications.&lt;/p&gt;
&lt;p&gt;Since APIs can be used by multiple applications, it is import for APIs to be well written and concise. APIs should be carefully planned. The following points may be considered when designing APIs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;authenticating&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#authenticating&quot; aria-label=&quot;authenticating permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Authenticating&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The API Your API should be called by valid users that are authorized and authenticated.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;caching-api-results&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#caching-api-results&quot; aria-label=&quot;caching api results permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Caching API results&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should cache the results of API call. This will allow your API to handle requests more quickly, and it will be able to handle more requests per second. Memcache can be used to cache results of API call.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;the-api-architecture&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#the-api-architecture&quot; aria-label=&quot;the api architecture permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;The API architecture&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;RESTFul APIs have less overhead as compared to SOAP based APIs. SOAP based APIs have better support for authentication. They are also better structured then RESTFul APIs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-documentation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-documentation&quot; aria-label=&quot;api documentation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API documentation&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should be well documented and easy for users to understand.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-scope&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-scope&quot; aria-label=&quot;api scope permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API scope&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should have a well defined scope. For example will it be used over the internet as a public API or will it be used as private API inside corporate intranet.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;device-support&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#device-support&quot; aria-label=&quot;device support permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Device support&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When designing your API you should keep in mind the devices that will consume your API. For example smart phones, desktop application, browser based application, server application etc&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-output-format&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-output-format&quot; aria-label=&quot;api output format permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API output format&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When designing your API you should keep in mind the format of the output. For example will the output contain user interface related data or just plain data. One popular approach is known as separation of concerns &lt;a href=&quot;https://en.wikipedia.org/wiki/Separation_of_concerns&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Separation of Concerns&lt;/a&gt;. For example separating the backend and frontend logic.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;rate-limiting-and-throttling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#rate-limiting-and-throttling&quot; aria-label=&quot;rate limiting and throttling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Rate limiting and throttling&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should implement rate limiting and throttling to prevent overuse and misuse of the API.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-versioning-and-backward-compatibility&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-versioning-and-backward-compatibility&quot; aria-label=&quot;api versioning and backward compatibility permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API versioning and backward compatibility&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should be carefully versioned. For example if you update your API, then the new version of your API should support API clients that use an older version of your API. Your API should continue to support the old API clients until all the API clients have migrated to the new version of your API.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-pricing-and-monitoring&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-pricing-and-monitoring&quot; aria-label=&quot;api pricing and monitoring permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API pricing and monitoring&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The usage of your API should be monitored, so you know who is using your API and how it is being used. You may also charge users for using your API.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;metric-for-success&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#metric-for-success&quot; aria-label=&quot;metric for success permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Metric for success&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should also decide which metric to use for measuring the success of your API. For example number of API calls per second or monitory earnings from your API. Activities involved in the development of your API, such as research, publication of articles, open source code, participation in online forums etc may also be considered when determining the success of your API.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-response-time&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-response-time&quot; aria-label=&quot;api response time permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API Response time&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your API should have a low response time. It should be possible to monitor the API response time and notify the developer if the API response time above average.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;api-error-handling&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#api-error-handling&quot; aria-label=&quot;api error handling permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;API Error Handling&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In case of errors, your API should return a suitable message to the API client. It should also send notification email to the API developer.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;estimation-of-cost-involved&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#estimation-of-cost-involved&quot; aria-label=&quot;estimation of cost involved permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Estimation of cost involved&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should also calculate the cost of developing and deploying your API. For example how much time it will take you to produce a usable version of your API. How much of your development time the API takes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;updating-your-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#updating-your-api&quot; aria-label=&quot;updating your api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;strong&gt;Updating your API&lt;/strong&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should also decide how often to update your API. For example how often should new features be added. You should also keep in mind the backward compatibility of your API, so updating your API should not negatively affect your clients.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Deploying APIs on Google Cloud Endpoints]]></title><description><![CDATA[Google Cloud Endpoint is a service that allows developing, deploying and managing APIs on Google Cloud. This article describes how to get started with Google Cloud Endpoint.]]></description><link>https://pakjiddat.netlify.app//posts/deploying-apis-on-google-cloud-endpoints</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/deploying-apis-on-google-cloud-endpoints</guid><pubDate>Thu, 03 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Google Cloud Endpoint is a service that allows developing, deploying and managing APIs on Google Cloud. This article describes how to get started with Google Cloud Endpoint.&lt;/p&gt;
&lt;p&gt;Cloud Endpoint is very well documented. Quick start guides are available which describe how to use Cloud Endpoint with different Cloud Backends such as App Engine, Compute Engine and Container Engine.&lt;/p&gt;
&lt;p&gt;I had followed the &lt;a href=&quot;https://cloud.google.com/endpoints/docs/quickstart-compute-engine&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Quickstart for Endpoints on Compute Engine&lt;/a&gt;. It describes how to deploy a sample API on a Compute instance. The sample API is based on Python language but can easily be substituted for other programming languages such as PHP or Java.&lt;/p&gt;
&lt;h3 id=&quot;deploying-the-sample-api-to-cloud-endpoint&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deploying-the-sample-api-to-cloud-endpoint&quot; aria-label=&quot;deploying the sample api to cloud endpoint permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deploying the sample API to Cloud Endpoint&lt;/h3&gt;
&lt;p&gt;Deploying a sample API to Cloud Endpoints requires Google Cloud SDK, a running Compute instance and a proxy server based on Nginx called Extensible Service Proxy (ESP). Deployment of the sample API requires several steps and is described below:&lt;/p&gt;
&lt;h4 id=&quot;configuring-the-pre-requisites&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-the-pre-requisites&quot; aria-label=&quot;configuring the pre requisites permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring the pre-requisites&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Create a new &lt;a href=&quot;https://console.cloud.google.com/project&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cloud Platform Console Project&lt;/a&gt; or select an existing project. Note down the project id. Enable billing for this project&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install Curl. Then &lt;a href=&quot;https://cloud.google.com/sdk/docs/quickstarts&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Download and install the Google Cloud SDK&lt;/a&gt;. These two steps should be done on both main server and your local development machine&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update the Cloud SDK, install the endpoint components and set the default project id to your &lt;strong&gt;[YOUR_PROJECT_ID]&lt;/strong&gt;. Use following code:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcloud components update
gcloud components &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; beta
gcloud config &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; project &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;YOUR_PROJECT_ID&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Clone the sample API from the source code repository with the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/GoogleCloudPlatform/python-docs-samples&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Change to the directory that contains the sample code. Use following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; python-docs-samples/appengine/flexible/endpoints&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;swagger.yaml&lt;/strong&gt; file, replace all instances of &lt;strong&gt;YOUR_PROJECT_ID&lt;/strong&gt; with your project id. Swagger is an open standard for specifying APIs. Swagger is now known as &lt;a href=&quot;https://openapis.org/specification&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Open API Specification&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;deploying-the-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#deploying-the-api&quot; aria-label=&quot;deploying the api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deploying the API&lt;/h4&gt;
&lt;p&gt;To deploy the API use following command: &lt;strong&gt;gcloud beta service-management deploy swagger.yaml&lt;/strong&gt;. This command will return several lines including the server name and service version.&lt;/p&gt;
&lt;h4 id=&quot;create-compute-instance&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#create-compute-instance&quot; aria-label=&quot;create compute instance permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create Compute instance&lt;/h4&gt;
&lt;p&gt;Next create a new Compute instance or use an existing instance. On the settings page for the instance configure the meta data. Add a new meta data item with key: &lt;strong&gt;endpoints-service-name&lt;/strong&gt; and value: &lt;strong&gt;YOUR-PROJECT-ID.appspot.com&lt;/strong&gt;. Next add another meta data item with key: &lt;strong&gt;endpoints-service-version&lt;/strong&gt; and value same as the service version returned by the API deployment command.&lt;/p&gt;
&lt;h4 id=&quot;running-the-sample-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#running-the-sample-api&quot; aria-label=&quot;running the sample api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Running the sample API&lt;/h4&gt;
&lt;p&gt;To run the sample API, on your local machine set the zone for your project with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcloud config &lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; compute/zone &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;YOUR-&lt;span class=&quot;token environment constant&quot;&gt;INSTANCE&lt;/span&gt;-ZONE&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the API directory &lt;strong&gt;python-docs-samples/appengine/flexible/endpoints&lt;/strong&gt;, copy the API files from your local machine to your server. Use following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcloud compute copy-files * &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;INSTANCE&lt;/span&gt;-NAME&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;:/full-path-to-sample-api-files&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next connect to your instance with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcloud compute &lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;INSTANCE&lt;/span&gt;-NAME&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next set up a Python virtual environment on your main server using the commands:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; easy_install virtualenv
virtualenv&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These commands should be run on your main server in the same folder that contains the API code.&lt;/p&gt;
&lt;p&gt;Next install the requirements of the API sample using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;./bin/pip &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-r&lt;/span&gt; requirements.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that start the gunicorn web server with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;./bin/gunicorn &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; :8081 main:app&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will start the API server on port 8081. Next we need to install and configure the Extensible Service Proxy (ESP).&lt;/p&gt;
&lt;h4 id=&quot;installing-and-configuring-the-extensible-service-proxy-esp&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-and-configuring-the-extensible-service-proxy-esp&quot; aria-label=&quot;installing and configuring the extensible service proxy esp permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing and configuring the Extensible Service Proxy (ESP)&lt;/h4&gt;
&lt;p&gt;The ESP is a proxy server based on Nginx. It sits in front of your API back-end and provides Authentication, API Key Management, Logging and other Endpoint Management features.&lt;/p&gt;
&lt;p&gt;To install the ESP run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; endpoints-runtime&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on your main server. If the package cannot be installed then you need to add the correct package repository to your package manager. See the quick start guide for more information.&lt;/p&gt;
&lt;p&gt;Next in /etc/default/nginx set the port number to 80 and restart the ESP with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt; nginx restart&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;sending-requests-to-the-sample-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#sending-requests-to-the-sample-api&quot; aria-label=&quot;sending requests to the sample api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Sending requests to the sample API&lt;/h4&gt;
&lt;p&gt;To send requests to the API, create an API key on the &lt;a href=&quot;https://console.cloud.google.com/apis/credentials&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;API credentials page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next make a HTTP request to the API using the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;{&quot;message&quot;:&quot;hello world&quot;}&apos;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;content-type:application/json&quot;&lt;/span&gt; http://&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;IP_ADDRESS&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;:80/echo?key&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;${ENDPOINTS_KEY}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Replace IP_ADDRESS with the external IP address of your instance. Replace ENDPOINTS_KEY with your API key.&lt;/p&gt;
&lt;p&gt;Next view the &lt;a href=&quot;https://console.cloud.google.com/endpoints&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;activity graphs&lt;/a&gt; for your API in the endpoints page.&lt;/p&gt;
&lt;h4 id=&quot;updating-the-sample-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#updating-the-sample-api&quot; aria-label=&quot;updating the sample api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Updating the sample API&lt;/h4&gt;
&lt;p&gt;If you have made changes to your API, then you need to redeploy the API. To redeploy the API, make changes to your API source code and then edit the &lt;strong&gt;swagger.yaml&lt;/strong&gt; file to reflect the changes. Then redeploy the API with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcloud beta service-management deploy swagger.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next the meta data values for your compute instance need to be updated with the correct API service version number.&lt;/p&gt;
&lt;p&gt;If you have deleted your API by mistake like me, and you want to restore it, then you need to run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gcurl &lt;span class=&quot;token parameter variable&quot;&gt;-X&lt;/span&gt; DELETE https://servicemanagement.googleapis.com/v1/services/endpointsapis.appspot.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;gcurl&lt;/strong&gt; is simply the curl command with authentication variables for Google Cloud. It is setup as a bash command. To setup gcurl we need to first follow the &lt;a href=&quot;https://cloud.google.com/service-management/getting-started&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;getting started guide for service management&lt;/a&gt;. The configuration of gcurl is described in the installation of &lt;a href=&quot;https://github.com/google/oauth2l&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;oauth2l&lt;/a&gt;. I had run into this problem and had to post &lt;a href=&quot;http://stackoverflow.com/questions/39846232/how-to-undelete-a-google-api-service&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;undelete a Google Service API&lt;/a&gt; on Stackoverflow.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Google Cloud Endpoints is a complete platform for developing, deploying and monitoring APIs. It allows deploying scalable, well managed APIs.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Developing APIs using Google Apps Script]]></title><description><![CDATA[Google Apps Script is a platform for developing scripts for Google Products. It allows developers to interact with Google Products from JavaScript. It also allows extending the functionality of Google Products using JavaScript.]]></description><link>https://pakjiddat.netlify.app//posts/developing-apis-using-google-apps-script</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/developing-apis-using-google-apps-script</guid><pubDate>Thu, 03 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Google Apps Script is a platform for developing scripts for Google Products. It allows developers to interact with Google Products from JavaScript. It also allows extending the functionality of Google Products using JavaScript.&lt;/p&gt;
&lt;h4 id=&quot;how-it-works&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#how-it-works&quot; aria-label=&quot;how it works permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How it works&lt;/h4&gt;
&lt;p&gt;To use Google Apps Script you need to sign in to &lt;a href=&quot;https://script.google.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Google App Scripts&lt;/a&gt; with your Google Account. This will open a page that introduces Apps Script. Click on start scripting to continue to the script editor.&lt;/p&gt;
&lt;p&gt;The script editor allows developers to manage their Google Apps scripts online. The editor has a useful auto complete feature that displays information on JavaScript classes.&lt;/p&gt;
&lt;p&gt;Google Apps Script provides JavaScript classes for interacting with Google products such as Google Sheets. For example the following code returns a sheet object which represents the active Spreadsheet object in GoogleSheets:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; sheet &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; SpreadsheetApp&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getActiveSheet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The script editor allows running the JavaScript code from the editor window. It also allows deploying the Apps Script project as a standalone web app or as an Android add-on or as a Chrome Store Add-On. Google Apps Script also provides an API that allows executing an Apps Script from different environments such as .Net, PHP, Java etc.&lt;/p&gt;
&lt;p&gt;The Google Apps Script documentation provides easy to follow &lt;a href=&quot;https://developers.google.com/apps-script/overview&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;5 minute tutorials&lt;/a&gt; for learning Apps Script. I was able to easily follow this &lt;a href=&quot;https://developers.google.com/apps-script/overview&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;tutorial&lt;/a&gt; which allows creating a new Google Document and emailing the link.&lt;/p&gt;
&lt;p&gt;Other uses of Apps Script include adding custom functions and user interface features to Google Apps products, interacting with external APIs and Google services and connecting with external databases such as MySQL.&lt;/p&gt;
&lt;p&gt;Google Apps Script also supports triggers which are functions that are executed when certain events occur, such as opening a word document. We can easily create powerful APIs with Google Apps Script. These APIs can be consumed by different applications.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Google Apps Script is an excellent platform for interacting with Google Products such as Google Sheets, Google Docs, Google Sites etc. It can also be used to extend the functionality of Google Apps.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Deploying WSO2 Api Manager]]></title><description><![CDATA[The WSO2 API Manager is a platform for managing APIs. It allows deploying, monitoring and testing APIs. It is a complete API management platform that allows building scalable APIs.]]></description><link>https://pakjiddat.netlify.app//posts/deploying-wso2-api-manager</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/deploying-wso2-api-manager</guid><pubDate>Thu, 03 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The WSO2 API Manager is a platform for managing APIs. It allows deploying, monitoring and testing APIs. It is a complete API management platform that allows building scalable APIs.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;
&lt;p&gt;The WSO2 API Manager is well documented. Its installation is described in &lt;a href=&quot;https://docs.wso2.com/display/AM200/Quick+Start+Guide&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The WSO2 API Quick Start Guide&lt;/a&gt;. The WSO2 API Manager can be installed in three simple steps:&lt;/p&gt;
&lt;p&gt;First we need to install Oracle Java JDK version 1.7 or 1.8. Then we need to set the JAVA_HOME variable. After that we need to download the WSO2 API Manager. Next we need to start the WSO2 API Manager with the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;APIM_HOME&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;/bin/wso2server.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that we should be able to access the WSO2 API Publisher on &lt;strong&gt;&lt;a href=&quot;https://hostname:9443/publisher&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://hostname:9443/publisher&lt;/a&gt;&lt;/strong&gt;. We can login with user admin and password admin.&lt;/p&gt;
&lt;h3 id=&quot;using-the-wso2-api-manager&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#using-the-wso2-api-manager&quot; aria-label=&quot;using the wso2 api manager permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using the WSO2 API Manager&lt;/h3&gt;
&lt;p&gt;The WSO2 API Manager consists of an API Publisher and an API Store. The API publisher allows developers to publish APIs. The API store allows developers to use or subscribe to APIs.&lt;/p&gt;
&lt;p&gt;To publish an API you have to login to the WSO2 API Publisher on &lt;strong&gt;&lt;a href=&quot;https://hostname:9443/publisher&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://hostname:9443/publisher&lt;/a&gt;&lt;/strong&gt; with user name admin and password admin. After logging in click on the &lt;strong&gt;Deploy Sample API&lt;/strong&gt; button. It deploys a sample API called PizzaShackAPI into the API Manager. The API will now show under the APIS tab.&lt;/p&gt;
&lt;p&gt;To subscribe to the API login to the API store at: &lt;strong&gt;&lt;a href=&quot;https://hostname:9443/store&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;https://hostname:9443/store&lt;/a&gt;&lt;/strong&gt; with user name admin and password admin. The newly created API is visible under APIs menu. Click the API to open its menu.&lt;/p&gt;
&lt;p&gt;Next select a default application and an available tier and then click on Subscribe. Next click on the Production Keys tab and then click on generate keys to generate an access token to invoke the API. You have successfully subscribed to the API.&lt;/p&gt;
&lt;p&gt;Next go back to the APIs menu and click on the PizzaShackAPI. Next click on the API console tab. Next expand the GET method and then click on the &lt;strong&gt;Try it out&lt;/strong&gt; button. The response of the API invocation shows a list of menu items.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;APIs play an important role in Software Development. Web Applications in particular benefit greatly from APIs. A well built API can be consumed by applications on different platforms and can form the backbone of a multi platform application.&lt;/p&gt;
&lt;p&gt;The WSO2 API Manager is an excellent platform for managing APIs. It is a scalable platform with useful features for managing different aspects of APIs.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Samba - An open source File Server and Active Directory Controller]]></title><description><![CDATA[Recently I had the task of setting up central user management for Windows servers. This blog post describes my experience with trying to setup central user management for Windows servers in an open source Linux based environment.]]></description><link>https://pakjiddat.netlify.app//posts/samba---an-open-source-file-server-and-active-directory-controller</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/samba---an-open-source-file-server-and-active-directory-controller</guid><pubDate>Thu, 03 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the task of setting up central user management for Windows servers. This blog post describes my experience with trying to setup central user management for Windows servers in an open source Linux based environment.&lt;/p&gt;
&lt;p&gt;My client is fond of free and open source tools, so I had to find a free and open source tool that provides central user management for Windows based servers. After some searching on the internet, I came across &lt;a href=&quot;http://www.samba.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Samba&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Samba is basically a file sharing server that can be used by all devices that support &lt;a href=&quot;http://en.wikipedia.org/wiki/Server_Message_Block&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SMB/CIFS&lt;/a&gt;. These include Linux and Windows based servers. Version 4 of Samba, which was released in 2012 had a new feature that allowed it to function as an Active Directory Domain Controller.&lt;/p&gt;
&lt;p&gt;This is a very useful feature as it allows Windows based hosts to authenticate against Linux based Samba Authentication Server. This opens up the possibility of cross platform user management, which is very useful in a heterogeneous I.T environment with different operating systems.&lt;/p&gt;
&lt;h3 id=&quot;installation-and-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation-and-configuration&quot; aria-label=&quot;installation and configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation and configuration&lt;/h3&gt;
&lt;p&gt;Configuring Samba to work as an Active Directory Domain Controller is simple. Installing and configuring the Samba server and configuring a Windows server to authenticate against the Samba server takes less than 20 minutes.&lt;/p&gt;
&lt;p&gt;Instructions on configuring Active Directory on Samba are given on the &lt;a href=&quot;https://wiki.samba.org/index.php/Joining_a_Windows_Client_to_a_Domain&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Samba Wiki&lt;/a&gt;. &lt;a href=&quot;https://wiki.samba.org/index.php/Joining_a_Windows_Client_to_a_Domain&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Instructions on connecting a Windows client to a Samba AD DC&lt;/a&gt; are also given. Of course if you have specific requirements then you can read the articles on the &lt;a href=&quot;https://wiki.samba.org/index.php/User_Documentation&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Samba Wiki&lt;/a&gt; or read the Samba &lt;a href=&quot;https://lists.samba.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mailing archives&lt;/a&gt;. To install Samba and configure it as a Domain Controller follow these steps:&lt;/p&gt;
&lt;h4 id=&quot;install-samba&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#install-samba&quot; aria-label=&quot;install samba permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Samba&lt;/h4&gt;
&lt;p&gt;I used the samba package repository provided by SerNet. SerNet provides package repositories for the major Linux distributions. Create an account on &lt;a href=&quot;https://samba.plus/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SAMBA+&lt;/a&gt;. Then download and install the package repository and package signing key. Follow the given instructions.&lt;/p&gt;
&lt;p&gt;Then install the Samba packages. For Centos enter the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt; sernet-samba sernet-samba-ad sernet-samba-client&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enter following commands to verify correct installation. &lt;strong&gt;Samba -V&lt;/strong&gt; and &lt;strong&gt;smbclient -V&lt;/strong&gt;. These commands return the version of Samba server and Samba client that was installed. Its best to install the latest version.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;provisioning-the-samba-active-directory&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#provisioning-the-samba-active-directory&quot; aria-label=&quot;provisioning the samba active directory permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Provisioning The Samba Active Directory&lt;/h4&gt;
&lt;p&gt;This configures Active Directory Domain Controller. It also configures Kerberos on the server. Kerberos is a mechanism for encrypting authentication information. It is used by Active Directory Domain Controller to provide secure authentication to the domain clients. &lt;a href=&quot;http://web.mit.edu/kerberos/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The Kerberos website&lt;/a&gt; has useful information on Kerberos configuration.&lt;/p&gt;
&lt;p&gt;To start the Samba AD DC provisioning enter the following command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;samba-tool domain provision --use-rfc2307 &lt;span class=&quot;token parameter variable&quot;&gt;--interactive&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will then be asked about the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Samba Realm&lt;/strong&gt; (Set this to a sub domain of your main domain. e.g WIN.EXAMPLE.COM)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain&lt;/strong&gt; (Set this to the first part of your Samba Realm. e.g WIN)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Server Role&lt;/strong&gt; (Set this to dc since we are trying to set up a domain controller)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DNS Backend&lt;/strong&gt; (Set this to SAMBA_INTERNAL)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DNS forwarder IP address&lt;/strong&gt; (Set this to NONE or the IP address of your DNS forwarder)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Administrator password&lt;/strong&gt; (Set this to the admin password for your domain controller)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If all goes well the command will end without errors. You can read more about the Provisioning command on &lt;a href=&quot;https://wiki.samba.org/index.php/Samba_AD_DC_HOWTO#Provisioning_The_Samba_Active_Directory&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Setup a Samba Active Directory Domain Controller”&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;start-samba&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#start-samba&quot; aria-label=&quot;start samba permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Start samba.&lt;/h4&gt;
&lt;p&gt;Setup a startup script for Samba. You can use the &lt;a href=&quot;https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Service_Using_Systemd&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Samba4/InitScript&lt;/a&gt;. Start Samba. e.g on Centos enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;systemctl start samba-ad-dc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;test-samba-domain-controller&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#test-samba-domain-controller&quot; aria-label=&quot;test samba domain controller permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test Samba Domain Controller&lt;/h4&gt;
&lt;p&gt;Enter the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;smbclient &lt;span class=&quot;token parameter variable&quot;&gt;-L&lt;/span&gt; localhost -U%&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should return some information about your Samba configuration. Enter the command: &lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;smbclient //localhost/netlogon &lt;span class=&quot;token parameter variable&quot;&gt;-UAdministrator&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;ls&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will connect you to the netlogon share, using the Domain Administrator account, created during provisioning. If these commands fail then check the Samba AD DC &lt;a href=&quot;https://wiki.samba.org/index.php/Samba_AD_DC_Troubleshooting&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Troubleshooting guide&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;configure-dns-configuration-file&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configure-dns-configuration-file&quot; aria-label=&quot;configure dns configuration file permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configure DNS configuration file&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Add the IP address of your DNS server. This DNS server must have the correct DNS records created. Following DNS records need to be created for your DNS zone. Your DNS zone is same as the Realm name you gave during provisioning. Login to your DNS server and create the following records for your DNS zone:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Create a record with the name _ldap._tcp and type SRV. use priority 0, weight 100, port 389 and the name of your Samba server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a record with the name _kerberos._udp and type SRV. use priority 0, weight 100, port 88 and the name of your Samba server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a record with the host name of your Samba server and type A. Use the ip address of your Samba server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a record with the name _ldap._tcp.dc._msdcs and type SRV. use priority 0, weight 100, port 389 and the name of your Samba server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4 id=&quot;verify-dns-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#verify-dns-configuration&quot; aria-label=&quot;verify dns configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Verify DNS configuration.&lt;/h4&gt;
&lt;p&gt;Enter the following commands on your Samba server to verify correct working of the DNS. If you receive any errors, check your system log.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; SRV _ldap._tcp.WIN.EXAMPLE.COM.
&lt;span class=&quot;token function&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; SRV _kerberos._udp.WIN.EXAMPLE.COM.
&lt;span class=&quot;token function&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; A addc.WIN.EXAMPLE.COM.
&lt;span class=&quot;token function&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; A WIN.EXAMPLE.COM.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;kerberos-configuration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#kerberos-configuration&quot; aria-label=&quot;kerberos configuration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Kerberos Configuration.&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Kerberos configuration can be quite complex. Thankfully the Provisioning tool takes care of the Kerberos configuration. During provisioning the file**/usr/local/samba/private/krb5.conf** is generated. Location of this file can vary depending on your system. Copy the file &lt;strong&gt;krb5.conf&lt;/strong&gt; to &lt;strong&gt;/etc/krb5.conf&lt;/strong&gt;. This is the main kerberos configuration file. You can read more about &lt;a href=&quot;https://kb.iu.edu/d/aumh&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;configuring Kerberos&lt;/a&gt; on the Kerberos website.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;testing-kerberos&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#testing-kerberos&quot; aria-label=&quot;testing kerberos permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Testing Kerberos&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Obtain a Kerberos ticket by using the kinit command. Enter following: &lt;strong&gt;kinit &lt;a href=&quot;mailto:administrator@WIN.EXAMPLE.COM&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;administrator@WIN.EXAMPLE.COM&lt;/a&gt;&lt;/strong&gt;. You will then have to enter the administrator password that you gave during provisioning. To verify that the command worked enter the command: &lt;strong&gt;klist&lt;/strong&gt;. It should return the Kerberos ticket that you just created.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;h4 id=&quot;time-synchronization&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#time-synchronization&quot; aria-label=&quot;time synchronization permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Time Synchronization&lt;/h4&gt;
&lt;p&gt;Use NTP (Network time protocol) on your Samba server and Windows clients. This ensures that the time on the Server and Clients is synchronized. This is very important for correct working of Kerberos.&lt;/p&gt;
&lt;p&gt;Samba does not have a full fledged forum but instead uses a &lt;a href=&quot;https://lists.samba.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;mailing list&lt;/a&gt;. You can ask a question by posting to a mailing list. I was interested to know if its possible to synchronize FreeIPA users with Samba AD DC users. I asked on their &lt;a href=&quot;https://lists.samba.org/archive/samba/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;general samba mailing list&lt;/a&gt; and also mentioned my experience with installing Samba.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Samba is an excellent open source tool that offers the possibility of managing Linux and Windows users from a single tool. Samba is usually used as a file sharing server in enterprises and is a useful tool to learn.&lt;/p&gt;
&lt;h3 id=&quot;references&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#references&quot; aria-label=&quot;references permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;References:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/Kerberos&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Kerberos general information&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://kb.iu.edu/d/aumh#list&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Kerberos keytab management&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.thegeekstuff.com/2014/05/install-kerberos-server/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Kerberos server installation and basic configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/Samba/Kerberos&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Kerberos configuration related to Samba&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.samba.org/index.php/Samba_AD_DC_HOWTO&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Samba Active Directory Domain Controller installation guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[FreeIPA - An open source centralized user management system]]></title><description><![CDATA[This blog post is about FreeIPA, a very useful open source centralized user management solution from Red Hat. I had the opportunity of installing FreeIPA in a virtualized environment. I want to share my experience in this blog post.]]></description><link>https://pakjiddat.netlify.app//posts/freeipa---an-open-source-centralized-user-management-system</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/freeipa---an-open-source-centralized-user-management-system</guid><pubDate>Mon, 24 Oct 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;This blog post is about &lt;a href=&quot;http://www.freeipa.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;FreeIPA&lt;/a&gt;, a very useful open source centralized user management solution from Red Hat. I had the opportunity of installing FreeIPA in a virtualized environment. I want to share my experience in this blog post.&lt;/p&gt;
&lt;p&gt;FreeIPA can be considered as the Linux equivalent of Active Directory. IPA stands for Identity, Policy and Audit. FreeIPA is actually a lot more than a centralized user management system. Along with user management it also provides integrated DNS, Certificate Authority and Access Control.&lt;/p&gt;
&lt;p&gt;FreeIPA is a collection of the following open source tools: A Linux (Fedora), 389 Directory Server (LDAP), MIT Kerberos, NTP, DNS, Dogtag (Certificate System). It also supports Active Directory sync. FreeIPA uses LDAP for storing its data which includes DNS, host and user information.&lt;/p&gt;
&lt;h3 id=&quot;why-use-freeipa&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-use-freeipa&quot; aria-label=&quot;why use freeipa permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why use FreeIPA&lt;/h3&gt;
&lt;h4 id=&quot;centralized-user-management&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#centralized-user-management&quot; aria-label=&quot;centralized user management permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Centralized user management&lt;/h4&gt;
&lt;p&gt;Why would you want to use FreeIPA?. Well if you have hundreds of Linux based servers, for example in a virtualized environment, it would be really useful to manage users for all your servers from one place. FeeIPA lets you do that. FreeIPA provides a web interface and command line tools to manage users all from one place. Since FreeIPA uses LDAP for user management you can connect it to any LDAP client. Most open source tools support LDAP.&lt;/p&gt;
&lt;h4 id=&quot;quick-and-easy-installation&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#quick-and-easy-installation&quot; aria-label=&quot;quick and easy installation permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Quick and easy installation&lt;/h4&gt;
&lt;p&gt;Installation of FreeIPA has to be done once on the server and once for each client to be managed. Both client and server installations are easy and take less than 15 minutes. In less than 15 minutes you can have a centralized user management solution for free !. And it comes with a nice GUI as well !. Of course customizing and learning about FreeIPA will take some time. Red Hat has a useful guide titled &lt;a href=&quot;https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Linux_Domain_Identity_Authentication_and_Policy_Guide/index.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;“Linux Domain Identity, Authentication, and Policy Guide”&lt;/a&gt;, that explains all aspects of FreeIPA including installation and administration.&lt;/p&gt;
&lt;h3 id=&quot;installation-and-configuring&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installation-and-configuring&quot; aria-label=&quot;installation and configuring permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation and Configuring&lt;/h3&gt;
&lt;h4 id=&quot;installing-freeipa-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-freeipa-server&quot; aria-label=&quot;installing freeipa server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing FreeIPA Server&lt;/h4&gt;
&lt;p&gt;Red Hat derived operating systems, e.g Centos and Fedora have FreeIPA in the default package repositories. Installing FreeIPA is as simple as entering the command :&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; ipa-client&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on Centos. The following command should be entered on Fedora&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; freeipa-client&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To install FreeIPA on other Linux systems you will have to install from source.&lt;/p&gt;
&lt;h4 id=&quot;configuring-freeipa-server&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-freeipa-server&quot; aria-label=&quot;configuring freeipa server permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring FreeIPA server&lt;/h4&gt;
&lt;p&gt;After installation the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ipa-server-install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;has to be run. This starts the FreeIPA installer, which configures the FreeIPA. The configuration can be run interactively or silently by passing command line options. &lt;a href=&quot;https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Linux_Domain_Identity_Authentication_and_Policy_Guide/installing-ipa.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Installing an IDM Server&lt;/a&gt;, describes the complete configuration steps.&lt;/p&gt;
&lt;h4 id=&quot;installing-freeipa-client&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-freeipa-client&quot; aria-label=&quot;installing freeipa client permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing FreeIPA client&lt;/h4&gt;
&lt;p&gt;To install the FreeIPA client on Centos you have to run:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; ipa-client&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On Fedora run:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;yum &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; freeipa-client&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On other Linux operating systems you will have to follow the manual installation steps given in the Red Hat documentation.&lt;/p&gt;
&lt;h4 id=&quot;configuring-freeipa-client&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#configuring-freeipa-client&quot; aria-label=&quot;configuring freeipa client permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring FreeIPA client&lt;/h4&gt;
&lt;p&gt;After installation run the command:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ipa-client-install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to start the configuration. The client side of FreeIPA is based on SSSD Linux Daemon. SSSD is a caching daemon that sits between services such as Linux authentication service and the authentication storage. &lt;a href=&quot;https://fedorahosted.org/sssd/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;SSSD&lt;/a&gt; intercepts the request sent by the service and can return a cached response or it can send the request to another service such as a FreeIPA server. See &lt;a href=&quot;https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Linux_Domain_Identity_Authentication_and_Policy_Guide/setting-up-clients.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Setting up systems as IDM clients&lt;/a&gt; for complete information on installing the FreeIPA client.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Once the client installation is complete, you can manage all your users, DNS, hosts, certificates and more from the FreeIPA web interface. FreeIPA is a great tool that combines several well known Linux solutions into an integrated identity management platform. It is very easy to install and configure. You don’t have to know the workings of the tools that are internally used by FreeIPA such as bind, open LDAP, DogTag. But learning about these tools will give you a better idea of how the FreeIPA works.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Installing FreeIPA client on Debian]]></title><description><![CDATA[Recently I had the opportunity of installing FreeIPA client on servers running the Debian operating system. I will share my experience in this blog post. FreeIPA is an excellent centralized user management system from FreeIPA.]]></description><link>https://pakjiddat.netlify.app//posts/installing-freeipa-client-on-debian</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/installing-freeipa-client-on-debian</guid><pubDate>Thu, 25 Aug 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of installing FreeIPA client on servers running the Debian operating system. I will share my experience in this blog post. FreeIPA is an excellent centralized user management system from &lt;a href=&quot;http://www.freeipa.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;FreeIPA&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is free and open source. FreeIPA has lot of features other than user management such as DNS, Certificate management, Encrypted Authentication and more. In my earlier blog post titled &lt;a href=&quot;/posts/freeipa---an-open-source-centralized-user-management-system&quot;&gt;FreeIPA - An open source centralized user management system&lt;/a&gt;, I have described the installation and configuration of FreeIPA server&lt;/p&gt;
&lt;h3 id=&quot;installing-freeipa-client&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#installing-freeipa-client&quot; aria-label=&quot;installing freeipa client permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing FreeIPA Client&lt;/h3&gt;
&lt;p&gt;FreeIPA server and client are very easy to install on Centos and Fedora. &lt;a href=&quot;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/identity_management_guide/installing_the_ipa_client_on_linux&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Configuring a Linux system as an IDM Client&lt;/a&gt;, is a useful guide from RedHat on installing FreeIPA clients on RedHat based systems.&lt;/p&gt;
&lt;p&gt;Installing FreeIPA on other operating systems is a lot more difficult. Even though RedHat provides a guide titled &lt;a href=&quot;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/configuring_identity_management/linux-manual&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Manually configuring a Linux client&lt;/a&gt;, I was not able to get it to work on Debian. &lt;a href=&quot;http://www.freeipa.org/page/HowTos&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;The HowTo guides&lt;/a&gt; on the FreeIPA wiki describes the process of installing FreeIPA on non Red Hat based operating systems and integration with different applications. However these guides were not useful.&lt;/p&gt;
&lt;p&gt;Ubuntu provides &lt;a href=&quot;https://launchpad.net/freeipa&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;FreeIPA server and client packages on Launchpad&lt;/a&gt;. Ubuntu is based on Debian, but is not Debian so I went on searching for a solution for Debian. I came across a thread titled “freeipa-client on Debian Wheezy” on the Ubuntu FreeIPA mailing list. It was posted by one of the contributors of the Ubuntu FreeIPA project. He created a package for Debian and provided a repository for easy installation.&lt;/p&gt;
&lt;p&gt;Here is how to install FreeIPA client on Debian.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# First add the following 2 lines to /etc/apt/sources.list file:&lt;/span&gt;
deb http://apt.numeezy.fr wheezy main
deb-src http://apt.numeezy.fr wheezy main

&lt;span class=&quot;token comment&quot;&gt;# Then install the package signature verification key using:&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;wget&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-qO&lt;/span&gt; - http://apt.numeezy.fr/numeezy.asc &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; apt-key &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; -

&lt;span class=&quot;token comment&quot;&gt;# Update your package lists:&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; update

&lt;span class=&quot;token comment&quot;&gt;# Set your server host name to a fully qualified domain name. e.g server.domain.com&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;hostname&lt;/span&gt; server.domain.com
&lt;span class=&quot;token function&quot;&gt;vi&lt;/span&gt; /etc/hostname
&lt;span class=&quot;token comment&quot;&gt;# Install FreeIPA client&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-y&lt;/span&gt; freeipa-client

&lt;span class=&quot;token comment&quot;&gt;# Create folder for storing certificate database&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; /etc/pki/nssdb

&lt;span class=&quot;token comment&quot;&gt;# Create empty database for storing certificates&lt;/span&gt;
certutil &lt;span class=&quot;token parameter variable&quot;&gt;-N&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; /etc/pki/nssdb

&lt;span class=&quot;token comment&quot;&gt;# Create folder&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; /var/run/ipa

&lt;span class=&quot;token comment&quot;&gt;# Remove existing FreeIPA client configuration&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; /etc/ipa/default.conf

&lt;span class=&quot;token comment&quot;&gt;# Run the script for installing FreeIPA client&lt;/span&gt;
ipa-client-install --no-ntp --no-dns-sshfp &lt;span class=&quot;token parameter variable&quot;&gt;--mkhomedir&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Enable auto creation of LDAP user folders&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&apos;session required pam_mkhomedir.so&apos;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&gt;&gt;&lt;/span&gt; /etc/pam.d/common-session

&lt;span class=&quot;token comment&quot;&gt;# Add following lines to /etc/nsswitch.conf file or update existing lines&lt;/span&gt;
passwd: files sss
group: files sss
shadow: files sss
&lt;span class=&quot;token comment&quot;&gt;# Reboot you server&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;reboot&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;After that you should be able to login to your server as a LDAP user. The user needs to be created on your FreeIPA server. I was able to get FreeIPA client working on Debian running Proxmox. In case you run into problems you an check out the &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/freeipa/+bug/1280215&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;bug list on Ubuntu FreeIPA forums&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Proxmox - An open source Virtualization Platform]]></title><description><![CDATA[This blog post is about my experience with using Proxmox Virtualization Platform. Proxmox is an excellent open source virtualization platform from the German company Proxmox Server Solutions GmbH. It is used by tens of thousands of users.]]></description><link>https://pakjiddat.netlify.app//posts/proxmox---an-open-source-virtualization-platform</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/proxmox---an-open-source-virtualization-platform</guid><pubDate>Thu, 25 Aug 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;This blog post is about my experience with using &lt;a href=&quot;http://proxmox.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Proxmox Virtualization Platform&lt;/a&gt;. Proxmox is an excellent open source virtualization platform from the German company Proxmox Server Solutions GmbH. It is used by tens of thousands of users.&lt;/p&gt;
&lt;h3 id=&quot;proxmox-features&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#proxmox-features&quot; aria-label=&quot;proxmox features permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Proxmox Features&lt;/h3&gt;
&lt;h4 id=&quot;centralized-web-interface&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#centralized-web-interface&quot; aria-label=&quot;centralized web interface permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Centralized Web Interface&lt;/h4&gt;
&lt;p&gt;You have to first install Proxmox from an ISO file that you can download from the Proxmox website. Proxmox needs to be installed on each server that needs to run virtual machines. Proxmox allows you to manage all your virtual machines and hosts from a single web interface.&lt;/p&gt;
&lt;p&gt;Proxmox is a very good option for building your own private cloud. Proxmox supports &lt;a href=&quot;http://www.linux-kvm.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;KVM&lt;/a&gt; and &lt;a href=&quot;http://openvz.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;OpenVZ&lt;/a&gt; virtual machines. The current Proxmox version which is 4.0 no longer supports OpenVZ virtual machines. Instead it supports LXC containers.&lt;/p&gt;
&lt;h4 id=&quot;support-for-kvm-virtual-machines&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#support-for-kvm-virtual-machines&quot; aria-label=&quot;support for kvm virtual machines permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Support for KVM virtual machines&lt;/h4&gt;
&lt;p&gt;KVM virtual machines consume fixed CPU and Memory and can run any operating system that supports virtualization, including FreeBSD, Linux, Windows etc. KVM virtual machines can run network gateways, NAS servers, monitoring servers. Basically any server that can be installed from ISO.&lt;/p&gt;
&lt;p&gt;You can have all your mail servers, DNS, database, NAS servers etc all running as virtual machines. Installing a server is as simple as uploading the server ISO file to your Proxmox server and following the installation instructions&lt;/p&gt;
&lt;h4 id=&quot;support-for-openvz-virtual-machines&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#support-for-openvz-virtual-machines&quot; aria-label=&quot;support for openvz virtual machines permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Support for OpenVZ virtual machines&lt;/h4&gt;
&lt;p&gt;OpenVZ virtual machines are light weight containers that share the host servers hardware resources. They only support Linux operating system. The latest version of Proxmox no longer supports OpenVZ. Instead it supports a similar container technology called LXC which stands for Linux Containers.&lt;/p&gt;
&lt;h4 id=&quot;easy-administration&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#easy-administration&quot; aria-label=&quot;easy administration permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Easy Administration&lt;/h4&gt;
&lt;p&gt;Unlike other cloud platforms such as AWS and OpenStack, Proxmox is very easy to use and requires no expert knowledge. Creating virtual machines is as simple as clicking a button and filling out a short form.&lt;/p&gt;
&lt;p&gt;The Proxmox user interface is very simple and easy to use. It does have complex features such as distributed storage, user privileges and backups, but the complex features are well hidden. To see resource usage statistics such as CPU and Memory of a virtual machine, all you have to do is click on a virtual machine and then click on the summary tab.&lt;/p&gt;
&lt;p&gt;Changing RAM and Memory is as simple as clicking on the hardware tab and editing text fields. You can also easily take backups of virtual machines. Proxmox has fine grained user permissions that allow you to configure the actions that users are allowed to take. For example, permissions to start and stop virtual machines.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Proxmox is a very flexible and easy to use virtualization solution. It is an excellent option for hosting a private cloud. By simplifying server administration, Proxmox makes it easy to publish innovative services on the internet at low cost. Virtualization removes the need for large number of expensive servers in institutions and companies. It forms the backbone of cloud services.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Cloudinary CDN - A free Content Delivery Network]]></title><description><![CDATA[Recently I had the opportunity of integrating a free Content Delivery Network (CDN) called Cloudinary with my clients website. I will describe my experience in this blog post. Cloudinary is an excellent Content Delivery Network that can be used to serve static website content such as images, video, audio, HTML, CSS, JavaScript files and more. Cloudinary has an excellent free plan with great features.]]></description><link>https://pakjiddat.netlify.app//posts/cloudinary-cdn---a-free-content-delivery-network</link><guid isPermaLink="false">https://pakjiddat.netlify.app//posts/cloudinary-cdn---a-free-content-delivery-network</guid><pubDate>Thu, 18 Aug 2016 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;introduction&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#introduction&quot; aria-label=&quot;introduction permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Recently I had the opportunity of integrating a free Content Delivery Network (CDN) called Cloudinary with my clients website. I will describe my experience in this blog post. Cloudinary is an excellent Content Delivery Network that can be used to serve static website content such as images, video, audio, HTML, CSS, JavaScript files and more. Cloudinary has an excellent free plan with great features.&lt;/p&gt;
&lt;p&gt;Actually Cloudinary supports any type of static content. If you need your website’s static content delivered with high reliability and good performance, then Cloudinary is a good option.&lt;/p&gt;
&lt;h3 id=&quot;why-use-cloudinary&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#why-use-cloudinary&quot; aria-label=&quot;why use cloudinary permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why use Cloudinary&lt;/h3&gt;
&lt;p&gt;There are a few free CDN services such as &lt;a href=&quot;http://www.bootstrapcdn.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Boostrap CDN&lt;/a&gt;, &lt;a href=&quot;https://www.cloudflare.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;CloudFlare&lt;/a&gt;, &lt;a href=&quot;http://www.coralcdn.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Coral Content Distribution Network&lt;/a&gt; and &lt;a href=&quot;https://www.incapsula.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Incapsula&lt;/a&gt;. However none of these Free CDN services could meet my requirements. I needed an easy to use Free CDN service that was reliable and had good performance. Only Cloudinary CDN could meet these requirements.&lt;/p&gt;
&lt;p&gt;The main issue with other CDNs was that they offered too many services such as web hosting, web application firewall, DNS services etc. These services are usually integrated with their free CDN service and in most cases are offered for free but on a trial basis.&lt;/p&gt;
&lt;h3 id=&quot;features-of-cloudinary-cdn&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#features-of-cloudinary-cdn&quot; aria-label=&quot;features of cloudinary cdn permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features of Cloudinary CDN&lt;/h3&gt;
&lt;h4 id=&quot;free-plan&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#free-plan&quot; aria-label=&quot;free plan permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Free plan&lt;/h4&gt;
&lt;p&gt;The features of Cloudinary CDN that I found most attractive are that its CDN service is free without any trial limits. Their free plan allows 7,500 images, 75,000 total images, 2G storage and 5G monthly viewing bandwidth. These limits can be doubled if you share their profile on social networks such as Twitter and Facebook.&lt;/p&gt;
&lt;h4 id=&quot;support-for-different-file-types&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#support-for-different-file-types&quot; aria-label=&quot;support for different file types permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Support for different file types&lt;/h4&gt;
&lt;p&gt;I needed a CDN that supported audio files for my WordPress plugin. My plugin allows users to listen to audio translations of Holy Quran verses, so I needed a CDN that supported MP3 files. Cloudinary provided the ideal solution.&lt;/p&gt;
&lt;h4 id=&quot;flexible-application-programming-interface-api&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#flexible-application-programming-interface-api&quot; aria-label=&quot;flexible application programming interface api permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Flexible Application Programming Interface (API)&lt;/h4&gt;
&lt;p&gt;One problem I faced when using the Cloudinary CDN was that when we upload media files to the CDN they get renamed automatically. Fortunately Cloudinary has an excellent API with many functions one of which allows us to rename uploaded files. I was able to easily use their API and rename the uploaded images.&lt;/p&gt;
&lt;p&gt;While running some performance tests on the website I noticed the images take a long time to get served. I needed a free CDN that was easy to use with WordPress. Cloudinary again provided the solution.&lt;/p&gt;
&lt;p&gt;Cloudinary has a plugin for WordPress called &lt;a href=&quot;https://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener noreferrer&quot;&gt;Cloudinary - Image management and manipulation in the cloud + CDN&lt;/a&gt; that allows easy integration with their Free CDN service and WordPress based websites. Once you have installed the plugin you can easily serve your blog images from the Cloudinary CDN.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot; style=&quot;position:relative;&quot;&gt;&lt;a href=&quot;#conclusion&quot; aria-label=&quot;conclusion permalink&quot; class=&quot;anchor before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Cloudinary is an excellent Content Delivery Network that has many features including image manipulation, free cloud storage, support for all file types, fast delivery, easy to use administration interface, Software Developer Kits (SDKs) in multiple languages and support for security and privacy. It has over 50,000 customers. In my opinion Cloudinary is a very useful cloud service that helps in the creation of innovative services.&lt;/p&gt;</content:encoded></item></channel></rss>