<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://cse.ucdenver.edu/~biswasa/feed.xml" rel="self" type="application/atom+xml" /><link href="https://cse.ucdenver.edu/~biswasa/" rel="alternate" type="text/html" /><updated>2026-05-07T22:23:47-06:00</updated><id>https://cse.ucdenver.edu/~biswasa/feed.xml</id><title type="html">Dr. B</title><subtitle>Ashis Kumer Biswas -- Profile site</subtitle><author><name>Ashis Kumer Biswas</name></author><entry><title type="html">Managing SSL Certificates with Amazon AWS Lightsail instance with Apache2 webservice</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-aws-lightsail-ssl-apache2/" rel="alternate" type="text/html" title="Managing SSL Certificates with Amazon AWS Lightsail instance with Apache2 webservice" /><published>2024-01-14T00:00:00-07:00</published><updated>2024-01-15T00:34:35-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-aws-lightsail-ssl-apache2/"><![CDATA[<p>This post is for enabling a SSL certificate <code class="language-plaintext highlighter-rouge">for free</code> from <a href="https://www.cloudflare.com">Cloudflare.com</a>. Say, you purchased a domain name (e.g., <code class="language-plaintext highlighter-rouge">example.com</code> from <a href="https://www.godaddy.com">Godaddy</a>). Now, you want an inexpensive way to host your website. Again, say you hosted the website at <a href="https://aws.amazon.com/lightsail/">Amazon AWS Lightsail (either $3.50/mo or $5.00/mo as of the time of writing)</a> with configuration like: {<code class="language-plaintext highlighter-rouge">Platform</code>: <code class="language-plaintext highlighter-rouge">Linux/Unix</code>, <code class="language-plaintext highlighter-rouge">blueprint</code>:<code class="language-plaintext highlighter-rouge">Os only</code>, <code class="language-plaintext highlighter-rouge">OS</code>:<code class="language-plaintext highlighter-rouge">Ubuntu 22.04</code>}. You then bind a AWS provided static IP with the instance and create a <code class="language-plaintext highlighter-rouge">DNS zone</code> with couple of <code class="language-plaintext highlighter-rouge">DNS records</code> like: {<code class="language-plaintext highlighter-rouge">A records</code>:[<code class="language-plaintext highlighter-rouge">Record name</code>:<code class="language-plaintext highlighter-rouge">example.com</code>,<code class="language-plaintext highlighter-rouge">Route traffic to</code>:<code class="language-plaintext highlighter-rouge">1.2.3.4</code>],[<code class="language-plaintext highlighter-rouge">Record name</code>:<code class="language-plaintext highlighter-rouge">*.example.com</code>,<code class="language-plaintext highlighter-rouge">Route traffic to</code>:<code class="language-plaintext highlighter-rouge">1.2.3.4</code>]}. Also assign the created <code class="language-plaintext highlighter-rouge">DNS zone</code> to the instance. Finally, copy the AWS provided list of <code class="language-plaintext highlighter-rouge">Name servers</code> into Godaddy’s <code class="language-plaintext highlighter-rouge">Nameservers</code> management page for your purchased domain while removing existing ones. And, you host your website files with Apache2 in your Lightsail instance. <a href="/posts/2023/09/biswas/blog-apache2-ubuntu/">Here is a post I wrote on how to configure a site with apache2</a>.</p>

<h2 id="pre-requisites">Pre-requisites</h2>
<ul>
  <li>You have done everything I said in the paragraph above.</li>
</ul>

<h2 id="steps-to-enable-ssl-in-your-lightsail-hosted-website">Steps to enable SSL in your lightsail hosted website</h2>
<ol>
  <li>Signup a free account at <a href="https://www.cloudflare.com">Cloudflare.com</a>, if you have no prior accounts there.</li>
  <li>Login at Cloudflare.</li>
  <li><code class="language-plaintext highlighter-rouge">Add a site</code> into your Cloudflare dashboard and enter the site name: <code class="language-plaintext highlighter-rouge">example.com</code></li>
  <li><code class="language-plaintext highlighter-rouge">Free Plan</code> is the plan you’d select, and click <code class="language-plaintext highlighter-rouge">Get started</code>. The free plan option can be anywhere in the <code class="language-plaintext highlighter-rouge">Select a plan</code> page. So, please be curious enough to find it.
    <ul>
      <li>Then, Cloudflare would perform a quick scan to show you current DNS records of your domain. Make a note of the summary, as you will have to come back to re-configure this at a later step.</li>
      <li>Hit the <code class="language-plaintext highlighter-rouge">Continue</code> button.</li>
    </ul>
  </li>
  <li>Cloudflare will offer you few steps to <code class="language-plaintext highlighter-rouge">change your nameservers</code>. For instance,
    <ul>
      <li>Determine your registrar via <a href="https://lookup.icann.org/en/lookup">WHOIS</a></li>
      <li>Login to Godaddy (in my case it was the registrar)</li>
      <li>Remove the existing nameservers (i.e., the ones you got from AWS lightsail)</li>
      <li>Add the Cloudflare provided nameservers.</li>
      <li>Save your changes and wait (couple of minutes; atmost 24 hours). Check the WHOIS lookup again to see if the nameserver updates are completed or not.</li>
    </ul>
  </li>
  <li>Once Cloudflare determines that your domain’s nameservers are updated accordingly, you’ll receive a <code class="language-plaintext highlighter-rouge">Status active</code> email, and also see the expected changes in the WHOIS lookup.</li>
  <li>At the Cloudflare dashboard do the following:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">DNS</code> pane:
        <ul>
          <li>Remove existing <code class="language-plaintext highlighter-rouge">DNS records</code>.</li>
          <li><code class="language-plaintext highlighter-rouge">Add record</code>: {<code class="language-plaintext highlighter-rouge">type</code>:<code class="language-plaintext highlighter-rouge">A</code>, <code class="language-plaintext highlighter-rouge">Name</code>:<code class="language-plaintext highlighter-rouge">*</code>, <code class="language-plaintext highlighter-rouge">IPv4 address</code>:<code class="language-plaintext highlighter-rouge">1.2.3.4</code>}
            <ul>
              <li>This specific <code class="language-plaintext highlighter-rouge">A record</code> is to enable domain name mapping for services like <code class="language-plaintext highlighter-rouge">ssh</code>, or <code class="language-plaintext highlighter-rouge">ping</code> etc.</li>
            </ul>
          </li>
          <li><code class="language-plaintext highlighter-rouge">Add record</code>: {<code class="language-plaintext highlighter-rouge">type</code>:<code class="language-plaintext highlighter-rouge">A</code>, <code class="language-plaintext highlighter-rouge">Name</code>:<code class="language-plaintext highlighter-rouge">@</code>, <code class="language-plaintext highlighter-rouge">IPv4 address</code>:<code class="language-plaintext highlighter-rouge">1.2.3.4</code>}</li>
          <li><code class="language-plaintext highlighter-rouge">Add record</code>: {<code class="language-plaintext highlighter-rouge">type</code>:<code class="language-plaintext highlighter-rouge">CNAME</code>, <code class="language-plaintext highlighter-rouge">Name</code>:<code class="language-plaintext highlighter-rouge">www</code>, <code class="language-plaintext highlighter-rouge">IPv4 address</code>:<code class="language-plaintext highlighter-rouge">1.2.3.4</code>}</li>
        </ul>
      </li>
      <li><code class="language-plaintext highlighter-rouge">SSL/TSL</code> pane:
        <ul>
          <li>At the <code class="language-plaintext highlighter-rouge">Overview</code> sub-pane: choose the option <code class="language-plaintext highlighter-rouge">Full (strict)</code></li>
          <li>At the <code class="language-plaintext highlighter-rouge">Origin Servers</code> sub-pane: <code class="language-plaintext highlighter-rouge">create a certificate</code>.
            <ul>
              <li>Choose option <code class="language-plaintext highlighter-rouge">Generate private key and CSR with Cloudflare</code>. Select <code class="language-plaintext highlighter-rouge">RSA (2048)</code> as the private key type. Make sure the hostnames are selected as: <code class="language-plaintext highlighter-rouge">*.example.com</code>, <code class="language-plaintext highlighter-rouge">example.com</code>. You have option choose even <code class="language-plaintext highlighter-rouge">15 years</code> as the validity period for the generated SSL certificate. Then, hit the <code class="language-plaintext highlighter-rouge">Create</code> button.</li>
              <li>Copy the content of <code class="language-plaintext highlighter-rouge">Origin certificate</code> content into a file named, <code class="language-plaintext highlighter-rouge">example.com.pem</code></li>
              <li>Copy the content of <code class="language-plaintext highlighter-rouge">Private key</code> content into a file named, <code class="language-plaintext highlighter-rouge">example.com.key</code></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><code class="language-plaintext highlighter-rouge">Edge Certificates</code> pane:
        <ul>
          <li>Configure status of the generated SSL certificate. Don’t worry about the expiry date as it’s going to be auto-renewed every 3 months for 15 years (if you chose that option in the previous step).</li>
          <li><code class="language-plaintext highlighter-rouge">Always Use HTTPS</code>: Turn this option to <code class="language-plaintext highlighter-rouge">ON</code> position.</li>
          <li><code class="language-plaintext highlighter-rouge">Automatic HTTPS Rewrites</code>: Turn this option to <code class="language-plaintext highlighter-rouge">ON</code> position.</li>
        </ul>
      </li>
      <li><code class="language-plaintext highlighter-rouge">Overview</code> pane:
        <ul>
          <li>(Temporarily) turn on the <code class="language-plaintext highlighter-rouge">Development mode</code> to disable the caching.</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>At the Lightsail console:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">Instance</code> &gt; <code class="language-plaintext highlighter-rouge">Networking</code> tab: at the <code class="language-plaintext highlighter-rouge">IPv4 Firewall</code> section add a new rule for the <code class="language-plaintext highlighter-rouge">HTTPS</code>: {<code class="language-plaintext highlighter-rouge">Application</code>:<code class="language-plaintext highlighter-rouge">HTTPS</code>, <code class="language-plaintext highlighter-rouge">Protocol</code>:<code class="language-plaintext highlighter-rouge">TCP</code>, <code class="language-plaintext highlighter-rouge">Port or range</code>: <code class="language-plaintext highlighter-rouge">443</code>}</li>
      <li>Copy the <code class="language-plaintext highlighter-rouge">example.com.pem</code> and <code class="language-plaintext highlighter-rouge">example.com.key</code> files into <code class="language-plaintext highlighter-rouge">/etc/ssl/</code> directory.</li>
      <li>Assuming <code class="language-plaintext highlighter-rouge">example.com.conf</code> is available at the <code class="language-plaintext highlighter-rouge">/etc/apache2/sites-available/</code> directory. If not, make sure the following is configured in the <code class="language-plaintext highlighter-rouge">/etc/apache2/sites-available/example.com.conf</code>:</li>
    </ul>
  </li>
</ol>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;VirtualHost *:80&gt;
    ServerName example.com
    ServerAlias www.exammple.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/example.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
&lt;/VirtualHost&gt;
</code></pre></div></div>

<ul>
  <li>Now, create the <code class="language-plaintext highlighter-rouge">example.com-ssl.conf</code> file with SSL configuration:</li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;VirtualHost *:443&gt;
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/example.com
    SSLEngine on
    SSLCertificateFile /etc/ssl/example.com.pem
    SSLCertificateKeyFile /etc/ssl/example.com.key
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
&lt;/VirtualHost&gt;
</code></pre></div></div>

<ul>
  <li>Tell ubuntu system to use it by:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">sudo a2ensite example.com.conf</code></li>
      <li><code class="language-plaintext highlighter-rouge">sudo a2ensite example.com-ssl.conf</code></li>
      <li>You may need to remmove the default ones, depending on your use case.</li>
      <li><code class="language-plaintext highlighter-rouge">sudo a2enmod ssl</code></li>
      <li>Reboot the <code class="language-plaintext highlighter-rouge">apache2</code> service: <code class="language-plaintext highlighter-rouge">sudo systemctl restart apache2</code></li>
    </ul>
  </li>
</ul>

<h2 id="testing-if-the-sslhttps-is-active-for-your-site">Testing if the SSL/HTTPS is active for your site</h2>
<ul>
  <li>Open a browser and go <code class="language-plaintext highlighter-rouge">example.com</code>
    <ul>
      <li>It should automatically go to <code class="language-plaintext highlighter-rouge">https://example.com</code>, and you’d see the <code class="language-plaintext highlighter-rouge">lock</code> icon at the browser’s address bar noting the connection is secure. You can inspect the certificate to review the details.</li>
    </ul>
  </li>
</ul>

<h2 id="possible-hiccups-while-going-through-the-steps-above">Possible Hiccups while going through the steps above</h2>
<ul>
  <li><strong>Issue 1</strong>: 522 timeout received with the website host not responding.
    <ul>
      <li><strong>Solution</strong>: Either <code class="language-plaintext highlighter-rouge">apache2</code> is not configured properly to serve any <code class="language-plaintext highlighter-rouge">https</code> requests, or your lightsail instance’s <code class="language-plaintext highlighter-rouge">ipv4 firewall</code> is blocking any <code class="language-plaintext highlighter-rouge">443</code> port requests which is essential for <code class="language-plaintext highlighter-rouge">https</code>.</li>
    </ul>
  </li>
  <li><strong>Issue 2</strong>: website not loaded / recursive forward error.
    <ul>
      <li><strong>Solution</strong>: Please do not add any additional page forwarding rules to switch from <code class="language-plaintext highlighter-rouge">http</code> to <code class="language-plaintext highlighter-rouge">https</code> as at <code class="language-plaintext highlighter-rouge">Cloudflare</code> dashboard we have already configured options like <code class="language-plaintext highlighter-rouge">always use https</code>, etc.</li>
    </ul>
  </li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="https" /><category term="ssl" /><category term="cloudflare" /><category term="aws" /><category term="lightsail" /><category term="apache2" /><category term="ubuntu" /><category term="domain-hosting" /><summary type="html"><![CDATA[This post is for enabling a SSL certificate for free from Cloudflare.com. Say, you purchased a domain name (e.g., example.com from Godaddy). Now, you want an inexpensive way to host your website. Again, say you hosted the website at Amazon AWS Lightsail (either $3.50/mo or $5.00/mo as of the time of writing) with configuration like: {Platform: Linux/Unix, blueprint:Os only, OS:Ubuntu 22.04}. You then bind a AWS provided static IP with the instance and create a DNS zone with couple of DNS records like: {A records:[Record name:example.com,Route traffic to:1.2.3.4],[Record name:*.example.com,Route traffic to:1.2.3.4]}. Also assign the created DNS zone to the instance. Finally, copy the AWS provided list of Name servers into Godaddy’s Nameservers management page for your purchased domain while removing existing ones. And, you host your website files with Apache2 in your Lightsail instance. Here is a post I wrote on how to configure a site with apache2.]]></summary></entry><entry><title type="html">Jupyter Notebook to pdf/html file</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-jupyter-nbconvert/" rel="alternate" type="text/html" title="Jupyter Notebook to pdf/html file" /><published>2024-01-10T00:00:00-07:00</published><updated>2024-01-15T00:52:46-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-jupyter-nbconvert/"><![CDATA[<p>If you would like to create a pdf/html from your jupyter notebook, you can use the handy <code class="language-plaintext highlighter-rouge">nbconvert</code> tool of <code class="language-plaintext highlighter-rouge">jupyter</code>. Here is how you can use it.</p>

<h3 id="setup">Setup</h3>
<ul>
  <li>Make sure you have <code class="language-plaintext highlighter-rouge">jupyter</code> and <code class="language-plaintext highlighter-rouge">nbconvert</code> installed in your activated python virtual environment. You can install <code class="language-plaintext highlighter-rouge">nbconvert</code> by just this command: <code class="language-plaintext highlighter-rouge">pip install nbconvert</code></li>
</ul>

<h3 id="converting-a-notebook-into-pdf">Converting a notebook into PDF</h3>

<p><code class="language-plaintext highlighter-rouge">jupyter nbconvert --to pdf yourNotebook.ipynb</code></p>
<ul>
  <li>This generates a PDF via your system’s <code class="language-plaintext highlighter-rouge">latex</code> (or more specifically <code class="language-plaintext highlighter-rouge">xelatex</code>) command. So, make sure you have these installed in your system otherwise the <code class="language-plaintext highlighter-rouge">nbconvert</code> will fail.</li>
</ul>

<h3 id="converting-a-notebook-into-html">Converting a notebook into HTML</h3>
<p><code class="language-plaintext highlighter-rouge">jupyter nbconvert --to html yourNotebook.ipynb</code></p>
<ul>
  <li>This exports a html version of the jupyter notebook.</li>
</ul>

<h3 id="converting-a-notebook-into-webpdf">Converting a notebook into WebPDF</h3>

<p><code class="language-plaintext highlighter-rouge">jupyter nbconvert --to webpdf yourNotebook.ipynb</code></p>
<ul>
  <li>This generates a PDF by first rendering to HTMMLM, and rendering the HTML chromium headless, and exporting to PDF. The exporter supports the same template as <code class="language-plaintext highlighter-rouge">--to html</code>. The <code class="language-plaintext highlighter-rouge">webpdf</code> exporter requires the <code class="language-plaintext highlighter-rouge">playwright</code> Chromium automation library, which can be installed via <code class="language-plaintext highlighter-rouge">pip install nbconvert[webpdf]</code> command.</li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="jupyter" /><category term="notebook" /><category term="nbconvert" /><category term="pdf" /><summary type="html"><![CDATA[If you would like to create a pdf/html from your jupyter notebook, you can use the handy nbconvert tool of jupyter. Here is how you can use it.]]></summary></entry><entry><title type="html">Github command line with new authentication</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-github-command-line-with-new-authentication/" rel="alternate" type="text/html" title="Github command line with new authentication" /><published>2024-01-05T00:00:00-07:00</published><updated>2024-01-06T00:29:00-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-github-command-line-with-new-authentication/"><![CDATA[<p>Since 2021, github underwent a major change in their platform is removing password based authentication (in both web and command line). This blog is going to re-iterate their instructions on how you can do what you did before this overhaul with the new access mechanism in-place in the platform.</p>

<h2 id="step-1-create-personal-access-tokens">Step 1: Create Personal Access Tokens</h2>
<ul>
  <li>You can use a personal access token in place of a password when authenticating to GitHub in the command line or with the API.</li>
  <li><strong>Warning</strong>: Treat your access tokens like passwords.</li>
  <li>Go to Settings &gt; Developer Settings &gt; Personal access tokens &gt; click <code class="language-plaintext highlighter-rouge">Tokens (classic)</code>.</li>
  <li>Select Generate new token, then click Generate new token (classic).</li>
  <li>In the “Note” field, give your token a descriptive name.</li>
  <li>To give your token an expiration, select Expiration, then choose a default option or click Custom to enter a date. You must give expiry date. <strong>Warning</strong>: do not choose <code class="language-plaintext highlighter-rouge">Never</code>.</li>
  <li>Select the scopes you’d like to grant this token. To use your token to access repositories from the command line, select repo. A token with no assigned scopes can only access public information</li>
  <li>Click Generate token.</li>
  <li>Write down (or copy) the generated token as it can’t be seen again in this page.</li>
  <li>That’s it. You now have a personal access token to be used for github authentication through command line.</li>
</ul>

<h2 id="step-2-install-github-cli-gh-to-usestore-authentication-tokens">Step 2: Install <code class="language-plaintext highlighter-rouge">Github CLI: gh</code> to use/store authentication tokens</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">type -p curl &gt;/dev/null || (sudo apt update &amp;&amp; sudo apt install curl -y)</code></li>
  <li><code class="language-plaintext highlighter-rouge">curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg</code></li>
  <li><code class="language-plaintext highlighter-rouge">sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg</code></li>
  <li><code class="language-plaintext highlighter-rouge">echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list &gt; /dev/null</code></li>
  <li><code class="language-plaintext highlighter-rouge">sudo apt update</code></li>
  <li><code class="language-plaintext highlighter-rouge">sudo apt install gh</code></li>
  <li>Check if <code class="language-plaintext highlighter-rouge">gh</code> is installed by running <code class="language-plaintext highlighter-rouge">gh --version</code></li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gh version 2.40.1 (2023-12-13)
https://github.com/cli/cli/releases/tag/v2.40.1
</code></pre></div></div>

<h2 id="step-3-login-at-the-command-line-with-the-gh-tool">Step 3: login at the command line with the <code class="language-plaintext highlighter-rouge">gh</code> tool</h2>

<ul>
  <li><code class="language-plaintext highlighter-rouge">gh auth login</code></li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>? What account do you want to log into? **GitHub.com**
? What is your preferred protocol for Git operations on this host? **HTTPS**
? Authenticate Git with your GitHub credentials? **Yes**
? How would you like to authenticate GitHub CLI? **Paste an authentication token**
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org', 'workflow'.
? Paste your authentication token: ****************************************
- gh config set -h github.com git_protocol https
✓ Configured git protocol
! Authentication credentials saved in plain text
✓ Logged in as `xxx`
</code></pre></div></div>

<h2 id="step-4-you-are-ready">Step 4: You are ready</h2>
<ul>
  <li>you can now invoke <code class="language-plaintext highlighter-rouge">git</code> commands on your specified repository. It won’t ask for password/access token again (or until the expiry date of the token passes).</li>
  <li><code class="language-plaintext highlighter-rouge">git clone https://github.com/xxx/xyz-mnop-rstuv.git</code>
```</li>
</ul>

<h2 id="references">References</h2>
<ul>
  <li><a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens">Managing your personal access tokens</a></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="linux" /><category term="ubuntu" /><category term="ubutun22.04" /><category term="github" /><category term="gh" /><category term="github-auth" /><category term="gh-auth" /><category term="git" /><summary type="html"><![CDATA[Since 2021, github underwent a major change in their platform is removing password based authentication (in both web and command line). This blog is going to re-iterate their instructions on how you can do what you did before this overhaul with the new access mechanism in-place in the platform.]]></summary></entry><entry><title type="html">Github commands at the command line: a typical workflow with github</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-github-commands/" rel="alternate" type="text/html" title="Github commands at the command line: a typical workflow with github" /><published>2024-01-05T00:00:00-07:00</published><updated>2024-01-21T21:31:34-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-biswas-2</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2024/01/biswas/blog-github-commands/"><![CDATA[<p>Make sure to authenticate your github pass token at the command line. You may find my this blog post useful: <a href="/posts/2024/01/biswas/blog-github-command-line-with-new-authentication/">Github command line with new authentication</a>.</p>

<h2 id="frequently-used-git-commands">Frequently used git commands</h2>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Command</th>
      <th style="text-align: left">Purpose</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git clone https://github.com/xxx/my-repo.git</code></td>
      <td style="text-align: left">clone repo</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git pull</code></td>
      <td style="text-align: left">fetch and merge any commits from the tracking remote branch.</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git status</code></td>
      <td style="text-align: left">track changes</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git add a_file.txt</code></td>
      <td style="text-align: left">adds <code class="language-plaintext highlighter-rouge">a_file.txt</code> into <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git add --all</code></td>
      <td style="text-align: left">adds everything in the dir into <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git commit -m "a message"</code></td>
      <td style="text-align: left">commits everything at the current <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git push</code></td>
      <td style="text-align: left">pushes latest commit into the remote repo</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git push origin branchX</code></td>
      <td style="text-align: left">pushes latest commit into the remote repo branch named <code class="language-plaintext highlighter-rouge">branchX</code></td>
    </tr>
  </tbody>
</table>

<h2 id="list-of-git-commands">List of git commands</h2>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Command</th>
      <th style="text-align: left">Purpose</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git clone https://github.com/xxx/my-repo.git</code></td>
      <td style="text-align: left">clone repo</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git pull</code></td>
      <td style="text-align: left">fetch and merge any commits from the tracking remote branch.</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git status</code></td>
      <td style="text-align: left">track changes</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git diff</code></td>
      <td style="text-align: left">shows file differences not yet staged</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git diff --staged</code></td>
      <td style="text-align: left">shows file differences between staging and the last file version</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git branch</code></td>
      <td style="text-align: left">Lists all local branches in the current repository</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git branch branchZ</code></td>
      <td style="text-align: left">Creates a new branch named <code class="language-plaintext highlighter-rouge">branchZ</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git log -3</code></td>
      <td style="text-align: left">check the last 3 logs of git repository</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git log --graph</code></td>
      <td style="text-align: left">draw text-based graphical representation of commit history</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git add a_file.txt</code></td>
      <td style="text-align: left">adds <code class="language-plaintext highlighter-rouge">a_file.txt</code> into <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git add --all</code></td>
      <td style="text-align: left">adds everything in the dir into <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git commit -m "a message"</code></td>
      <td style="text-align: left">commits everything at the current <code class="language-plaintext highlighter-rouge">staging area</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git config --global user.email "name@email.com"</code></td>
      <td style="text-align: left">a configuration required to post commits</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git config --global user.name "myname"</code></td>
      <td style="text-align: left">another configuration required to post any commmit</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git push</code></td>
      <td style="text-align: left">pushes latest commit into the remote repo</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git push origin branchX</code></td>
      <td style="text-align: left">pushes latest commit into the remote repo branch named <code class="language-plaintext highlighter-rouge">branchX</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git checkout -- another_file.txt</code></td>
      <td style="text-align: left">undoing file modifications before staging (with <code class="language-plaintext highlighter-rouge">git add</code>) is performed</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git reset HEAD a_file.txt</code></td>
      <td style="text-align: left">unstaging any staged changes on <code class="language-plaintext highlighter-rouge">a_file.txt</code>, but preserving its contents.</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git reset HEAD~</code></td>
      <td style="text-align: left">undoing latest commit</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git checkout -b branchY</code></td>
      <td style="text-align: left">create a new branch, and automatically land on the new branch named <code class="language-plaintext highlighter-rouge">branchY</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git checkout branchX</code></td>
      <td style="text-align: left">switch to branch <code class="language-plaintext highlighter-rouge">branchX</code></td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git checkout master; git merge branchX</code></td>
      <td style="text-align: left">this is how to merge <code class="language-plaintext highlighter-rouge">branchX</code> branch to the <code class="language-plaintext highlighter-rouge">master</code> branch.</td>
    </tr>
    <tr>
      <td style="text-align: left"><code class="language-plaintext highlighter-rouge">git branch -d branchY</code></td>
      <td style="text-align: left">delete a branch named <code class="language-plaintext highlighter-rouge">branchY</code></td>
    </tr>
  </tbody>
</table>

<h2 id="clone-a-repository">Clone a repository</h2>
<ul>
  <li>In your local computer, change current working directory to the directory where you want to clone a github repository. Say, <code class="language-plaintext highlighter-rouge">cd _myGITs/</code></li>
  <li><code class="language-plaintext highlighter-rouge">git clone https://github.com/xxx/my-repo.git</code>
    <ul>
      <li>The <code class="language-plaintext highlighter-rouge">git clone</code> command copies your repository from the Github into your local directory.</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">cd my-repo</code>
    <ul>
      <li>And, inspect <code class="language-plaintext highlighter-rouge">ls -a</code>, and you will find <code class="language-plaintext highlighter-rouge">.git</code>, <code class="language-plaintext highlighter-rouge">.gitignore</code> files besides the repository contents.</li>
    </ul>
  </li>
</ul>

<h2 id="make-changes-to-your-repository">Make changes to your repository</h2>
<ul>
  <li>Anything you’d like with editors you have in your local system. You can add/edit/remove files as you go.</li>
</ul>

<h2 id="track-and-add-changes-to-the-local-git-repo">Track and add changes to the local git repo</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">git status</code>
    <ul>
      <li>This will display a list of modifications made.</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">git add README.md a_file.txt</code></li>
  <li>This will add one or more files which are listed changes into the <code class="language-plaintext highlighter-rouge">staging area</code></li>
  <li>You may use <code class="language-plaintext highlighter-rouge">git add --all</code>, but it is strongly discouraged as you may accidentally add things like credential files. If you really want to do it regardless, move sensitive data out of the repository.</li>
  <li><code class="language-plaintext highlighter-rouge">git commit -m "a message meaningful enough for the people you work with</code>
    <ul>
      <li>It takes everything from the staging area and makes a permanent snapshot of the current state of the repository that is associated with a unique id.</li>
      <li>First attemt of <code class="language-plaintext highlighter-rouge">git commit</code> command may ask you to set the <code class="language-plaintext highlighter-rouge">user.email</code> and <code class="language-plaintext highlighter-rouge">user.name</code> values:
        <ul>
          <li><code class="language-plaintext highlighter-rouge">git config --global user.email "myemail@domain.com"</code></li>
          <li><code class="language-plaintext highlighter-rouge">git config --global user.email "my name is xxx"</code></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<h2 id="push-changes-to-github-ie-push-to-remote">Push changes to Github (i.e., push to remote)</h2>
<ul>
  <li>So far we have only modified our local (revised) copy of the repository we were working in.</li>
  <li>To add the changes to your remote git repo, you need to <code class="language-plaintext highlighter-rouge">git push</code> them to Github.</li>
  <li>You can push your changes to Github with <code class="language-plaintext highlighter-rouge">git push</code>
    <ul>
      <li>You will then be prompted for Github authentication (if not set already with <code class="language-plaintext highlighter-rouge">gh auth login</code>, or the stored access token not having correct privileges to make those changes).</li>
    </ul>
  </li>
</ul>

<h2 id="undoing-unstaged-changes-ie-prior-to-calling-git-add">Undoing unstaged changes (i.e., prior to calling <code class="language-plaintext highlighter-rouge">git add</code>)</h2>
<ul>
  <li>If a file has been changed, but the changes have not yet been staged with <code class="language-plaintext highlighter-rouge">git add</code>, then the changes can be undone using <code class="language-plaintext highlighter-rouge">git checkout -- myFile.txt</code>
    <ul>
      <li>This will discard the changes made on the <code class="language-plaintext highlighter-rouge">myFile.txt</code>. The command <code class="language-plaintext highlighter-rouge">git checkout --</code> will revert back to the last committed version.</li>
      <li>Check the status with <code class="language-plaintext highlighter-rouge">git status</code> to see if the undoing was successful.</li>
    </ul>
  </li>
</ul>

<h2 id="undoing-staged-changes-ie-after-changes-are-added-with-git-add">Undoing staged changes (i.e., after changes are added with <code class="language-plaintext highlighter-rouge">git add</code>)</h2>
<ul>
  <li>Once you add a set of changes to git using <code class="language-plaintext highlighter-rouge">git add</code>, the file is then staged.</li>
  <li>If a file has been changed and then staged via <code class="language-plaintext highlighter-rouge">git add</code>, then use <code class="language-plaintext highlighter-rouge">git reset</code> to pull the most recently committed version of the file and undo the changes that you’ve made.
    <ul>
      <li><code class="language-plaintext highlighter-rouge">git reset HEAD myFile.txt</code>
        <ul>
          <li>This command unstages our changes. The <code class="language-plaintext highlighter-rouge">HEAD</code> refers to the most recently committed version of the file <code class="language-plaintext highlighter-rouge">myFile.txt</code>. You can also revert to an older version with <code class="language-plaintext highlighter-rouge">HEAD-1</code>, <code class="language-plaintext highlighter-rouge">HEAD-2</code>, etc.</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>When you use <code class="language-plaintext highlighter-rouge">git reset</code>, your changes still exist in the file, but the file has been <code class="language-plaintext highlighter-rouge">unstaged</code>, that is the changes are not added to git, yet.
    <ul>
      <li>You can confirm this with <code class="language-plaintext highlighter-rouge">git status</code> suggesting you to use <code class="language-plaintext highlighter-rouge">git checkout</code> to discard the changes in working directory.
        <ul>
          <li><code class="language-plaintext highlighter-rouge">git checkout -- myFile.txt</code></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<h2 id="undoing-a-commit">Undoing a commit</h2>
<ul>
  <li>If you have modified, added and committed changes to a file, and want to undo the changes, then you can use <code class="language-plaintext highlighter-rouge">git reset HEAD~</code> to undo your commit.
    <ul>
      <li>Confirm the status with <code class="language-plaintext highlighter-rouge">git status</code> . You’d notice that your file is no longer being tracked.</li>
      <li>If you inspect the output of <code class="language-plaintext highlighter-rouge">git log</code>, you will notice that your previous commit is no longer part of the repo history.</li>
      <li>Similar to previous example, when you use <code class="language-plaintext highlighter-rouge">git reset</code> the modifications will be unstaged. You need to <code class="language-plaintext highlighter-rouge">git checkout --</code> to discard the changes.</li>
    </ul>
  </li>
</ul>

<h2 id="ignore-sentitive-files">Ignore sentitive files</h2>
<ul>
  <li>If you do have sensitive files in a repo directory that you never want to track with git, you can add those file names to a file called <code class="language-plaintext highlighter-rouge">.gitignore</code>.</li>
</ul>

<h2 id="references">References</h2>
<ul>
  <li><a href="https://www.earthdatascience.org/workshops/intro-version-control-git/">Earth Data Analytics Online Certificate – Lesson 1. Version control intro and setup Intro version control git Workshop</a></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="linux" /><category term="ubuntu" /><category term="ubutun22.04" /><category term="github" /><summary type="html"><![CDATA[Make sure to authenticate your github pass token at the command line. You may find my this blog post useful: Github command line with new authentication.]]></summary></entry><entry><title type="html">Acccessing Windows 10 Shared folders (samba shares) from Ubuntu 22.04</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-windows-samba-folders-from-ubuntu/" rel="alternate" type="text/html" title="Acccessing Windows 10 Shared folders (samba shares) from Ubuntu 22.04" /><published>2023-12-12T00:00:00-07:00</published><updated>2023-12-12T14:47:53-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-biswas-2</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-windows-samba-folders-from-ubuntu/"><![CDATA[<p>Say, you have some files/folder, say <code class="language-plaintext highlighter-rouge">D:\my_box_folder\</code> you would want to access from Ubuntu (terminal). Here are few steps you can follow:</p>

<h2 id="step-1-share-the-folder-in-windows-10">Step 1: Share the folder in Windows 10</h2>
<ul>
  <li>Right click on <code class="language-plaintext highlighter-rouge">D:\my_box_folder\</code>, click <code class="language-plaintext highlighter-rouge">Properties</code>. Then, on the <code class="language-plaintext highlighter-rouge">Sharing</code> tab, click <code class="language-plaintext highlighter-rouge">Share</code> button.</li>
</ul>

<h2 id="step-2-admin-only-access-the-folder-from-ubuntu-2204-terminal">Step 2: (Admin only) Access the folder from Ubuntu 22.04 terminal</h2>
<ul>
  <li>Make sure you have the <code class="language-plaintext highlighter-rouge">cifs-utils</code> package installed. Or, install it by <code class="language-plaintext highlighter-rouge">sudo apt install cifs-utils</code>.
    <ul>
      <li>Please note: CIFS stands for Common Internet File System. Also note, CIFS is now obsolete. It’s replaced with SAMBA.</li>
    </ul>
  </li>
  <li>Mount the shared folder into <code class="language-plaintext highlighter-rouge">/mnt/cifs-my-box-folder</code>. If the folder is not there, create it.
    <ul>
      <li><code class="language-plaintext highlighter-rouge">sudo mount -t cifs //10.11.12.13/my_box_folder/ /mnt/cifs-my_box_folder -o username=XXX</code>
        <ul>
          <li>Here, replace <code class="language-plaintext highlighter-rouge">XXX</code> with Windows 10  username. Also, change the IP of the Windows 10 system.</li>
          <li>It will definitely you ask you for the password for the user <code class="language-plaintext highlighter-rouge">XXX</code></li>
        </ul>
      </li>
    </ul>
  </li>
  <li>That’s it. If successful, you can get access to the <code class="language-plaintext highlighter-rouge">D:\my_box_folder</code> from your ubuntu system..</li>
</ul>

<h2 id="references">References</h2>
<ul>
  <li>How to mount a SMB share in Ubuntu by Howard Young <a href="https://support.zadarastorage.com/hc/en-us/articles/213024986-How-to-Mount-a-SMB-Share-in-Ubuntu"> Link </a></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="linux" /><category term="ubuntu" /><category term="ubutun22.04" /><category term="windows" /><category term="windows10" /><category term="samba" /><category term="shared-folder" /><summary type="html"><![CDATA[Say, you have some files/folder, say D:\my_box_folder\ you would want to access from Ubuntu (terminal). Here are few steps you can follow:]]></summary></entry><entry><title type="html">Changing the Box drive sync directory (in Windows 10)</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-box-drive-path-update/" rel="alternate" type="text/html" title="Changing the Box drive sync directory (in Windows 10)" /><published>2023-12-12T00:00:00-07:00</published><updated>2023-12-12T12:38:25-07:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/12/biswas/blog-box-drive-path-update/"><![CDATA[<p>As of today, <a href="https://www.box.com">Box drive</a> only provides support for Windows and Mac operating systems. Yet, some of its users (including me) may be experiencing issue in Windows 10 to not being able to change the directory where the files will be synced to. That means, the default box directory, which is the boot drive could not be changed through the installed Box application.</p>

<p>You may wonder why would you want to change the box sync directory location. Okay, that’s a fair question: consider my situation. I have a very limited hard disk budget for a Windows10 operating system’s boot partition, but I have an extensive storage that I want all kinds of data to be stored. Did you get my issue using Box?</p>

<p>Here is a temporary fix (hoping someday Box will add options in their application):</p>
<ol>
  <li>Exit the <code class="language-plaintext highlighter-rouge">Box</code> application from the system tray.</li>
  <li>Check if where the box default cache path is. Most likely it is sitting in your <code class="language-plaintext highlighter-rouge">C:\Users\XXX\AppData\Local\Box\Box\cache</code>, where replace <code class="language-plaintext highlighter-rouge">XXX</code> with your username in your system.</li>
  <li>You can take a backup of this directory for now, or want to do fresh start of the sync. Simply delete the <code class="language-plaintext highlighter-rouge">cache</code> directory.</li>
  <li>Assuming, you would want <code class="language-plaintext highlighter-rouge">D:\my_box_directory\cache</code> to be your new sync path. You need to create this path first.</li>
  <li>Create a directory synbolic link (in Windows it’s called junction) with this command: <code class="language-plaintext highlighter-rouge">mklink /J "C:\Users\XXX\AppData\Local\Box\Box\cache" "D:\my_box_directory\cache"</code></li>
  <li>Start the box application.</li>
</ol>

<h2 id="references">References</h2>
<ul>
  <li>Box drive change location of cache folder (Windows 10) by Dimitris Moutsatsos at Medium <a href="https://ugh82.medium.com/box-drive-change-location-of-cache-folder-windows-10-16c9e81b6193"> Link </a></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="windows" /><category term="windows10" /><category term="box" /><category term="cache" /><summary type="html"><![CDATA[As of today, Box drive only provides support for Windows and Mac operating systems. Yet, some of its users (including me) may be experiencing issue in Windows 10 to not being able to change the directory where the files will be synced to. That means, the default box directory, which is the boot drive could not be changed through the installed Box application.]]></summary></entry><entry><title type="html">Markdown (md/txt) file to PDF conversion (in Ubuntu 22.04)</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-markdown-to-pdf/" rel="alternate" type="text/html" title="Markdown (md/txt) file to PDF conversion (in Ubuntu 22.04)" /><published>2023-10-18T00:00:00-06:00</published><updated>2023-10-21T00:21:11-06:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-markdown-to-pdf/"><![CDATA[<p>If you are writing in markdown, at times you may want to convert those into PDF file. Here are few steps you need:</p>

<ul>
  <li>Download few dependencies (if not present in your system):
    <ul>
      <li><code class="language-plaintext highlighter-rouge">sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra</code></li>
    </ul>
  </li>
  <li>Now convert using:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">pandoc my-markdown-file.md -o my-markdown-file.pdf</code></li>
      <li><code class="language-plaintext highlighter-rouge">pandoc my-markdown-file.txt -o my-markdown-file.pdf</code></li>
    </ul>
  </li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="ubuntu" /><category term="ubuntu 22.04" /><category term="linux" /><category term="markdown" /><category term="pdf" /><summary type="html"><![CDATA[If you are writing in markdown, at times you may want to convert those into PDF file. Here are few steps you need:]]></summary></entry><entry><title type="html">Ubuntu 22.04 – Change what is displayed at Login shell / Message of the Day</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-motd/" rel="alternate" type="text/html" title="Ubuntu 22.04 – Change what is displayed at Login shell / Message of the Day" /><published>2023-10-12T00:00:00-06:00</published><updated>2023-10-21T00:21:11-06:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/10/biswas/blog-motd/"><![CDATA[<p>You can customize the CLI login shell of Ubuntu (e.g., 22.04) by updating the <code class="language-plaintext highlighter-rouge">motd</code> (message of the day) file. <code class="language-plaintext highlighter-rouge">MOTD</code>` is a simple text file in a Linux/Debian-based system that is used to display some custom text message on login using the command line, locally or via SSH.</p>

<ul>
  <li>You can add your ASCII art /custom text –
    <ul>
      <li>either in <code class="language-plaintext highlighter-rouge">/etc/motd</code> file,</li>
      <li>or add a script in <code class="language-plaintext highlighter-rouge">/etc/update-motd.d/</code> directory. For instance, <code class="language-plaintext highlighter-rouge">00-header</code> file containing your text.</li>
    </ul>
  </li>
  <li>You may need to reboot (!)</li>
  <li>It is just a normal text file, but it accepts a good number of escape sequences:</li>
</ul>

<hr />
<p>| Escape character | Description |
| :- | :- | 
| <code class="language-plaintext highlighter-rouge">\b</code> | Baud rate (the rate at which information is transferred in a communication channel) of the current line |
| <code class="language-plaintext highlighter-rouge">\d</code>| Current date|
| <code class="language-plaintext highlighter-rouge">\s</code> | System name, the name of the operating system |
| <code class="language-plaintext highlighter-rouge">\l</code> | Name of the current tty line |
| <code class="language-plaintext highlighter-rouge">\m</code> | Architecture identifier of the machine, eg. i486 |
| <code class="language-plaintext highlighter-rouge">\n</code> | Node name of the machine, also known as the hostname |
| <code class="language-plaintext highlighter-rouge">\o</code> | Domain name of the machine |
| <code class="language-plaintext highlighter-rouge">\r</code> | Release number of the OS, eg. 1.1.9 |
| <code class="language-plaintext highlighter-rouge">\t</code> |  Current time |
| <code class="language-plaintext highlighter-rouge">\u</code> | Number of current users logged in |
| <code class="language-plaintext highlighter-rouge">\U</code> | The string <code class="language-plaintext highlighter-rouge">1 user</code> or <code class="language-plaintext highlighter-rouge">x users</code> where <code class="language-plaintext highlighter-rouge">x</code> is the number of current users logged in |
| <code class="language-plaintext highlighter-rouge">\v</code> | Version of the OS, eg. the build-date etc. |</p>

<ul>
  <li>You can also add command like <code class="language-plaintext highlighter-rouge">banner "   gpux4</code> to create something like this:</li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>                                                        #
                          ####   #####   #    #  #    # #    #
                         #    #  #    #  #    #   #  #  #    #
                         #       #    #  #    #    ##   #######
                         #  ###  #####   #    #    ##        #
                         #    #  #       #    #   #  #       #
                          ####   #        ####   #    #      #
</code></pre></div></div>
<ul>
  <li>Finally, this was the content from my server at <code class="language-plaintext highlighter-rouge">/etc/update-motd.d/00-header</code>:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"##########################################################################"</span><span class="p">;</span> 
banner <span class="s2">"   gpux4   "</span>
<span class="nb">echo</span> <span class="s2">"##########################################################################"</span><span class="p">;</span> 

<span class="o">[</span> <span class="nt">-r</span> /etc/lsb-release <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nb">.</span> /etc/lsb-release

<span class="k">if</span> <span class="o">[</span> <span class="nt">-z</span> <span class="s2">"</span><span class="nv">$DISTRIB_DESCRIPTION</span><span class="s2">"</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">[</span> <span class="nt">-x</span> /usr/bin/lsb_release <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
        <span class="c"># Fall back to using the very slow lsb_release utility</span>
        <span class="nv">DISTRIB_DESCRIPTION</span><span class="o">=</span><span class="si">$(</span>lsb_release <span class="nt">-s</span> <span class="nt">-d</span><span class="si">)</span>
<span class="k">fi

</span><span class="nb">printf</span> <span class="s2">"Welcome to %s (%s %s %s)</span><span class="se">\n</span><span class="s2">"</span> <span class="s2">"</span><span class="nv">$DISTRIB_DESCRIPTION</span><span class="s2">"</span> <span class="s2">"</span><span class="si">$(</span><span class="nb">uname</span> <span class="nt">-o</span><span class="si">)</span><span class="s2">"</span> <span class="s2">"</span><span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span><span class="s2">"</span> <span class="s2">"</span><span class="si">$(</span><span class="nb">uname</span> <span class="nt">-m</span><span class="si">)</span><span class="s2">"</span>
</code></pre></div></div>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="motd" /><category term="ubuntu" /><category term="ubuntu22.04" /><category term="login shell" /><summary type="html"><![CDATA[You can customize the CLI login shell of Ubuntu (e.g., 22.04) by updating the motd (message of the day) file. MOTD` is a simple text file in a Linux/Debian-based system that is used to display some custom text message on login using the command line, locally or via SSH.]]></summary></entry><entry><title type="html">Drone DatCon 3.6.1 – V3 .CSV description</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-datcon/" rel="alternate" type="text/html" title="Drone DatCon 3.6.1 – V3 .CSV description" /><published>2023-09-18T00:00:00-06:00</published><updated>2023-10-21T00:21:11-06:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-biswas-1</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-datcon/"><![CDATA[<p>I have compiled a short list of variables from the <code class="language-plaintext highlighter-rouge">DatCon 3.6.1 (7/30/2018)</code> <a href="https://datfile.net/DatCon/fieldsV3.html">V3 .CSV column format</a>. Please note, the following variables are either absent in the data files I worked with, or I removed due privacy concerns.</p>

<ul>
  <li>Removed the following columns:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(0):Longitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(0):Latitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(0):distanceHP</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(0):distanceTravelled</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(1):Longitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(1):Latitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(1):distanceHP</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMU_ATTI(1):distanceTravelled</code></li>
      <li><code class="language-plaintext highlighter-rouge">eventLog</code></li>
      <li><code class="language-plaintext highlighter-rouge">GPS(0):Long</code></li>
      <li><code class="language-plaintext highlighter-rouge">GPS(0):Lat</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMUEX(0):rtk_Longitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMUEX(0):rtk_Latitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMUEX(1):rtk_Longitude</code></li>
      <li><code class="language-plaintext highlighter-rouge">IMUEX(1):rtk_Latitude</code></li>
    </ul>
  </li>
  <li>I have added a column <code class="language-plaintext highlighter-rouge">Operating_Phase</code> :
    <ul>
      <li>Possible values of this column are {‘Resting’, ‘Taking-Off’, ‘Hovering’, ‘Climbing’, ‘Landing’}</li>
    </ul>
  </li>
  <li>PDF was generated with <code class="language-plaintext highlighter-rouge">pandoc 2.14.2</code></li>
  <li><strong>Please note:</strong> not all signals could be cataloged nor properly described here, but nor should you ignore them for these reasons.</li>
  <li>Alright, the catalog of <code class="language-plaintext highlighter-rouge">V3 .CSV columns</code> goes here:</li>
</ul>

<table>
  <thead>
    <tr>
      <th style="text-align: left">No.</th>
      <th style="text-align: left">Name</th>
      <th style="text-align: left">Description</th>
      <th style="text-align: center">Frequency (Hz)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">1</td>
      <td style="text-align: left">Tick#</td>
      <td style="text-align: left">Internal bus clock</td>
      <td style="text-align: center">platform dependent</td>
    </tr>
    <tr>
      <td style="text-align: left">2</td>
      <td style="text-align: left">offsetTime</td>
      <td style="text-align: left">Elapsed time</td>
      <td style="text-align: center">variable</td>
    </tr>
    <tr>
      <td style="text-align: left">3</td>
      <td style="text-align: left">IMU_ATTI(0):numSats</td>
      <td style="text-align: left">Number of Satellites</td>
      <td style="text-align: center"> </td>
    </tr>
    <tr>
      <td style="text-align: left">4</td>
      <td style="text-align: left">IMU_ATTI(0):barometer:Raw</td>
      <td style="text-align: left">Meters. Raw data from barometer.</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">5</td>
      <td style="text-align: left">IMU_ATTI(0):barometer:Smooth</td>
      <td style="text-align: left">Meteres. Smoothed barometer data</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">6</td>
      <td style="text-align: left">IMU_ATTI(0):accel:X</td>
      <td style="text-align: left">Meters per second. Acceleration along X axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">7</td>
      <td style="text-align: left">IMU_ATTI(0):accel:Y</td>
      <td style="text-align: left">Meters per second. Acceleration along Y axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">8</td>
      <td style="text-align: left">IMU_ATTI(0):accel:Z</td>
      <td style="text-align: left">Meters per second. Acceleration along Z axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">9</td>
      <td style="text-align: left">IMU_ATTI(0):accel:Composite</td>
      <td style="text-align: left">Meters per second. $\sqrt{\text{accel}^2_X + \text{accel}^2_Y + \text{accel}^2_Z}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">10</td>
      <td style="text-align: left">IMU_ATTI(0):gyro:X</td>
      <td style="text-align: left">Degrees per second. Rotation about the X axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">11</td>
      <td style="text-align: left">IMU_ATTI(0):gyro:Y</td>
      <td style="text-align: left">Degrees per second. Rotation about the Y axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">12</td>
      <td style="text-align: left">IMU_ATTI(0):gyro:Z</td>
      <td style="text-align: left">Degrees per second. Rotation about the Z axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">13</td>
      <td style="text-align: left">IMU_ATTI(0):gyro:Composite</td>
      <td style="text-align: left">Degrees per second.  $\sqrt{\text{gyro}^2_X + \text{gyro}^2_Y + \text{gyro}^2_Z}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">14</td>
      <td style="text-align: left">IMU_ATTI(0):mag:X</td>
      <td style="text-align: left">Micro Tesla. Magnetometer reading about the X axis</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">15</td>
      <td style="text-align: left">IMU_ATTI(0):mag:Y</td>
      <td style="text-align: left">Micro Tesla. Magnetometer reading about the X axis</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">16</td>
      <td style="text-align: left">IMU_ATTI(0):mag:Z</td>
      <td style="text-align: left">Micro Tesla. Magnetometer reading about the X axis</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">17</td>
      <td style="text-align: left">IMU_ATTI(0):mag:Mod</td>
      <td style="text-align: left">Micro Tesla.  $\sqrt{\text{mag}^2_X + \text{mag}^2_Y + \text{mag}^2_Z}$</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">18</td>
      <td style="text-align: left">IMU_ATTI(0):velN</td>
      <td style="text-align: left">Meters per second. Velocity North</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">19</td>
      <td style="text-align: left">IMU_ATTI(0):velE</td>
      <td style="text-align: left">Meters per second. Velocity East</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">20</td>
      <td style="text-align: left">IMU_ATTI(0):velD</td>
      <td style="text-align: left">Meters per second. Velocity Down</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">21</td>
      <td style="text-align: left">IMU_ATTI(0):velComposite</td>
      <td style="text-align: left">Meters per second. $\sqrt{\text{Vel}^2_N + \text{Vel}^2_E + \text{Vel}^2_D}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">22</td>
      <td style="text-align: left">IMU_ATTI(0):velH</td>
      <td style="text-align: left">Meters per second. Horizontal velocity, that is: $\sqrt{\text{Vel}^2_N + \text{Vel}^2_E}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">23</td>
      <td style="text-align: left">IMU_ATTI(0):GPS-H</td>
      <td style="text-align: left">Meters per second. Difference between velocity computed from successive GPS coordinates and horizontal velocity computed from IMU sensors (Vel:Horizontal, $\text{Vel}_H$)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">24</td>
      <td style="text-align: left">IMU_ATTI(0):roll</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">25</td>
      <td style="text-align: left">IMU_ATTI(0):pitch</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">26</td>
      <td style="text-align: left">IMU_ATTI(0):yaw</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">27</td>
      <td style="text-align: left">IMU_ATTI(0):yaw360</td>
      <td style="text-align: left">Degrees. Range 0 - 360</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">28</td>
      <td style="text-align: left">IMU_ATTI(0):totalGyro:Z</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:Z. Can be used to compute Gyro:Z error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">29</td>
      <td style="text-align: left">IMU_ATTI(0):totalGyro:X</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:X. Can be used to compute Gyro:X error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">30</td>
      <td style="text-align: left">IMU_ATTI(0):totalGyro:Y</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:Y. Can be used to compute Gyro:Y error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">31</td>
      <td style="text-align: left">IMU_ATTI(0):magYaw</td>
      <td style="text-align: left">Yaw value computed from magnetometers and corrected with pitch and roll. Not the same as Yaw which comes from the Flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">32</td>
      <td style="text-align: left">IMU_ATTI(0):directionOfTravel[mag]</td>
      <td style="text-align: left">Degrees. Range = [-180,180]. Computed from successive latitude/longitude coordinates. Not corrected with local geomagnetic declination., i.e., value can be compared against P3 yaw.</td>
      <td style="text-align: center">1</td>
    </tr>
    <tr>
      <td style="text-align: left">33</td>
      <td style="text-align: left">IMU_ATTI(0):directionOfTravel[true]</td>
      <td style="text-align: left">Degrees. Range = [-180,180]. Computed from successive latitude/longitude coordinates. Corrected with local geomagnetic declination., i.e., value can not be compared against P3 yaw.</td>
      <td style="text-align: center">1</td>
    </tr>
    <tr>
      <td style="text-align: left">34</td>
      <td style="text-align: left">IMU_ATTI(0):temperature</td>
      <td style="text-align: left">IMU temp. Steady state 65 degree celsius</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">35</td>
      <td style="text-align: left">General:relativeHeight</td>
      <td style="text-align: left">Meters. Altitude above Home Point</td>
      <td style="text-align: center">10</td>
    </tr>
    <tr>
      <td style="text-align: left">36</td>
      <td style="text-align: left">General:absoluteHeight</td>
      <td style="text-align: left">Meters. Populated if the Home Point elevation has been set</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">37</td>
      <td style="text-align: left">GPS(0):Date</td>
      <td style="text-align: left">Integer that contains date, e.g., 20171003 means 2017-10-03 GMT</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">38</td>
      <td style="text-align: left">GPS(0):Time</td>
      <td style="text-align: left">Integer that contains time, e.g., 100334 means 10:03:34 GMT</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">39</td>
      <td style="text-align: left">GPS:dateTimeStamp</td>
      <td style="text-align: left">alternate name: dateTime. DateTime in ISO-8601 format. Not available in CsvView</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">40</td>
      <td style="text-align: left">GPS(0):heightMSL</td>
      <td style="text-align: left">Meters. height above mean sea level</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">41</td>
      <td style="text-align: left">GPS(0):hDOP</td>
      <td style="text-align: left">Horizontal dilution of precision. Units unknown.</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">42</td>
      <td style="text-align: left">GPS(0):pDOP</td>
      <td style="text-align: left">Position dilution of precision. Units unknown.</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">43</td>
      <td style="text-align: left">GPS(0):sAcc</td>
      <td style="text-align: left">Some kind of accuracy measure.</td>
      <td style="text-align: center"> </td>
    </tr>
    <tr>
      <td style="text-align: left">44</td>
      <td style="text-align: left">GPS(0):numGPS</td>
      <td style="text-align: left">Number of GPS satellites</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">45</td>
      <td style="text-align: left">GPS(0):numGLNAS</td>
      <td style="text-align: left">Number of GLONAS satellites</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">46</td>
      <td style="text-align: left">GPS(0):numSV</td>
      <td style="text-align: left">Total number of satellites</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">47</td>
      <td style="text-align: left">GPS(0):velN</td>
      <td style="text-align: left">Meters per second. Velocity North</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">48</td>
      <td style="text-align: left">GPS(0):velE</td>
      <td style="text-align: left">Meters per second. Velocity East</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">49</td>
      <td style="text-align: left">GPS(0):velD</td>
      <td style="text-align: left">Meters per second. Velocity Down</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">50</td>
      <td style="text-align: left">RC:Aileron</td>
      <td style="text-align: left">Range [-10000, 10000] Neutral = 0. Stick left or down = -10000. Stick right or up = 10000</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">51</td>
      <td style="text-align: left">RC:Elevator</td>
      <td style="text-align: left">Range [-10000, 10000] Neutral = 0. Stick left or down = -10000. Stick right or up = 10000</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">52</td>
      <td style="text-align: left">RC:Rudder</td>
      <td style="text-align: left">Range [-10000, 10000] Neutral = 0. Stick left or down = -10000. Stick right or up = 10000</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">53</td>
      <td style="text-align: left">RC:Throttle</td>
      <td style="text-align: left">Range [-10000, 10000] Neutral = 0. Stick left or down = -10000. Stick right or up = 10000</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">54</td>
      <td style="text-align: left">Controller:navHealth</td>
      <td style="text-align: left">Same as General:gpsHealth. Useful when looking at a tablet .DAT</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">55</td>
      <td style="text-align: left">Controller:ctrl_level</td>
      <td style="text-align: left">Unknown, maybe a gpsHealth for the RC</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">56</td>
      <td style="text-align: left">OA:frontDistance</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">10</td>
    </tr>
    <tr>
      <td style="text-align: left">57</td>
      <td style="text-align: left">Motor:Speed:RFront</td>
      <td style="text-align: left">Actual Motor speed. RPM</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">58</td>
      <td style="text-align: left">Motor:Speed:LFront</td>
      <td style="text-align: left">Actual Motor speed. RPM</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">59</td>
      <td style="text-align: left">Motor:Speed:LBack</td>
      <td style="text-align: left">Actual Motor speed. RPM</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">60</td>
      <td style="text-align: left">Motor:Speed:RBack</td>
      <td style="text-align: left">Actual Motor speed. RPM</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">61</td>
      <td style="text-align: left">Motor:EscTemp:RFront</td>
      <td style="text-align: left">ESC temperature, not motor temperature</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">62</td>
      <td style="text-align: left">Motor:EscTemp:LFront</td>
      <td style="text-align: left">ESC temperature, not motor temperature</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">63</td>
      <td style="text-align: left">Motor:EscTemp:LBack</td>
      <td style="text-align: left">ESC temperature, not motor temperature</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">64</td>
      <td style="text-align: left">Motor:EscTemp:RBack</td>
      <td style="text-align: left">ESC temperature, not motor temperature</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">65</td>
      <td style="text-align: left">Motor:PPMrecv:RFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">66</td>
      <td style="text-align: left">Motor:PPMrecv:LFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">67</td>
      <td style="text-align: left">Motor:PPMrecv:LBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">68</td>
      <td style="text-align: left">Motor:PPMrecv:RBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">69</td>
      <td style="text-align: left">Motor:PPMsend:RFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">70</td>
      <td style="text-align: left">Motor:PPMsend:LFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">71</td>
      <td style="text-align: left">Motor:PPMsend:LBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">72</td>
      <td style="text-align: left">Motor:PPMsend:RBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">73</td>
      <td style="text-align: left">Motor:V_out:RFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">74</td>
      <td style="text-align: left">Motor:V_out:LFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">75</td>
      <td style="text-align: left">Motor:V_out:LBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">76</td>
      <td style="text-align: left">Motor:V_out:RBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">77</td>
      <td style="text-align: left">Motor:Volts:RFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">78</td>
      <td style="text-align: left">Motor:Volts:LFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">79</td>
      <td style="text-align: left">Motor:Volts:LBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">80</td>
      <td style="text-align: left">Motor:Volts:RBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">81</td>
      <td style="text-align: left">Motor:Current:RFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">82</td>
      <td style="text-align: left">Motor:Current:LFront</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">83</td>
      <td style="text-align: left">Motor:Current:LBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">84</td>
      <td style="text-align: left">Motor:Current:RBack</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">85</td>
      <td style="text-align: left">Motor:Status:RFront</td>
      <td style="text-align: left">0 = Normal, other values unknown</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">86</td>
      <td style="text-align: left">Motor:Status:LFront</td>
      <td style="text-align: left">0 = Normal, other values unknown</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">87</td>
      <td style="text-align: left">Motor:Status:LBack</td>
      <td style="text-align: left">0 = Normal, other values unknown</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">88</td>
      <td style="text-align: left">Motor:Status:RBack</td>
      <td style="text-align: left">0 = Normal, other values unknown</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">89</td>
      <td style="text-align: left">Motor:thrustAngle</td>
      <td style="text-align: left">Degrees. Computed from motor speeds. Direction the A/C is being pushed by the motors. Relative to the A/C, not the inertial frame.</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">90</td>
      <td style="text-align: left">AirComp:AirSpeedBody:X</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">91</td>
      <td style="text-align: left">AirComp:AirSpeedBody:Y</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">92</td>
      <td style="text-align: left">AirComp:Alti</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">93</td>
      <td style="text-align: left">AirComp:VelNorm</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">94</td>
      <td style="text-align: left">AirComp:VelTime:1</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">95</td>
      <td style="text-align: left">AirComp:VelTime:2</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">96</td>
      <td style="text-align: left">AirComp:VelLevel</td>
      <td style="text-align: left">These fields are not fully understood</td>
      <td style="text-align: center">5</td>
    </tr>
    <tr>
      <td style="text-align: left">97</td>
      <td style="text-align: left">IMU_ATTI(1):numSats</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center"> </td>
    </tr>
    <tr>
      <td style="text-align: left">98</td>
      <td style="text-align: left">IMU_ATTI(1):barometer:Raw</td>
      <td style="text-align: left">Meters. Raw data from barometer.</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">99</td>
      <td style="text-align: left">IMU_ATTI(1):barometer:Smooth</td>
      <td style="text-align: left">Meters. Smoothed barometer data</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">100</td>
      <td style="text-align: left">IMU_ATTI(1):accel:X</td>
      <td style="text-align: left">Meters per second. Acceleration along the X axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">101</td>
      <td style="text-align: left">IMU_ATTI(1):accel:Y</td>
      <td style="text-align: left">Meters per second. Acceleration along the Y axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">102</td>
      <td style="text-align: left">IMU_ATTI(1):accel:Z</td>
      <td style="text-align: left">Meters per second. Acceleration along the Z axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">103</td>
      <td style="text-align: left">IMU_ATTI(1):accel:Composite</td>
      <td style="text-align: left">Meters per second. $\sqrt{\text{accel}^2_X + \text{accel}^2_Y + \text{accel}^2_Z}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">104</td>
      <td style="text-align: left">IMU_ATTI(1):gyro:X</td>
      <td style="text-align: left">Degrees per second. Rotation about the X axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">105</td>
      <td style="text-align: left">IMU_ATTI(1):gyro:Y</td>
      <td style="text-align: left">Degrees per second. Rotation about the Y axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">106</td>
      <td style="text-align: left">IMU_ATTI(1):gyro:Z</td>
      <td style="text-align: left">Degrees per second. Rotation about the Z axis</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">107</td>
      <td style="text-align: left">IMU_ATTI(1):gyro:Composite</td>
      <td style="text-align: left">Degrees per second. $\sqrt{\text{gyro}^2_X + \text{gyro}^2_Y + \text{gyro}^2_Z}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">108</td>
      <td style="text-align: left">IMU_ATTI(1):mag:X</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">109</td>
      <td style="text-align: left">IMU_ATTI(1):mag:Y</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">110</td>
      <td style="text-align: left">IMU_ATTI(1):mag:Z</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">111</td>
      <td style="text-align: left">IMU_ATTI(1):mag:Mod</td>
      <td style="text-align: left">$\sqrt{\text{mag}^2_X + \text{mag}^2_Y + \text{mag}^2_Z}$</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">112</td>
      <td style="text-align: left">IMU_ATTI(1):velN</td>
      <td style="text-align: left">Meters per second. Velocity North</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">113</td>
      <td style="text-align: left">IMU_ATTI(1):velE</td>
      <td style="text-align: left">Meters per second. Velocity East</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">114</td>
      <td style="text-align: left">IMU_ATTI(1):velD</td>
      <td style="text-align: left">Meters per second. Velocity Down</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">115</td>
      <td style="text-align: left">IMU_ATTI(1):velComposite</td>
      <td style="text-align: left">Meters per second. $\sqrt{\text{Vel}^2_N + \text{Vel}^2_E + \text{Vel}^2_D}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">116</td>
      <td style="text-align: left">IMU_ATTI(1):velH</td>
      <td style="text-align: left">Meters per second. Horizontal Velocity. $\sqrt{\text{Vel}^2_N + \text{Vel}^2_E}$</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">117</td>
      <td style="text-align: left">IMU_ATTI(1):GPS-H</td>
      <td style="text-align: left">Meters per second. Difference between velocity computed from successive GPS coordinates and horizontal velocity computed from IMU sensors (Vel:Horizontal, $\text{Vel}_H$)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">118</td>
      <td style="text-align: left">IMU_ATTI(1):roll</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">119</td>
      <td style="text-align: left">IMU_ATTI(1):pitch</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">120</td>
      <td style="text-align: left">IMU_ATTI(1):yaw</td>
      <td style="text-align: left">Degrees. Note, the yaw value will be corrected for geomagnetic declination after GPS data is valid, i.e., yaw will be true and not magnetic</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">121</td>
      <td style="text-align: left">IMU_ATTI(1):yaw360</td>
      <td style="text-align: left">Degrees. Range 0 - 360</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">122</td>
      <td style="text-align: left">IMU_ATTI(1):totalGyro:Z</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:Z. Can be used to compute Gyro:Z error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">123</td>
      <td style="text-align: left">IMU_ATTI(1):totalGyro:X</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:X. Can be used to compute Gyro:Z error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">124</td>
      <td style="text-align: left">IMU_ATTI(1):totalGyro:Y</td>
      <td style="text-align: left">Degrees. Integration and summation of Gyro:Y. Can be used to compute Gyro:Z error. Also, useful for checking roll, pitch, and yaw values coming from flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">125</td>
      <td style="text-align: left">IMU_ATTI(1):magYaw</td>
      <td style="text-align: left">Yaw value computed from magnetometers and corrected with pitch and roll. Not the same as Yaw which comes from the Flight controller (FC)</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">126</td>
      <td style="text-align: left">IMU_ATTI(1):directionOfTravel[mag]</td>
      <td style="text-align: left">Degrees. Range = [-180, 180]. Computed from successive latitude/longitude coordinates. Not corrected with local geomagnetic declination. i.e., value can be compared against P3 yaw.</td>
      <td style="text-align: center">1</td>
    </tr>
    <tr>
      <td style="text-align: left">127</td>
      <td style="text-align: left">IMU_ATTI(1):directionOfTravel[true]</td>
      <td style="text-align: left">Degrees. Range = [-180, 180]. Computed from successive latitude/longitude coordinates. Corrected with local geomagnetic declination. i.e., value can not be compared against P3 yaw.</td>
      <td style="text-align: center">1</td>
    </tr>
    <tr>
      <td style="text-align: left">128</td>
      <td style="text-align: left">IMU_ATTI(1):temperature</td>
      <td style="text-align: left">IMU temp. Steady state = 65 degree celsius.</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">129</td>
      <td style="text-align: left">IMUEX(0):err</td>
      <td style="text-align: left">None, SPEED_LARGE_ERROR, GPS_YAW_ERROR</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">130</td>
      <td style="text-align: left">IMUEX(0):rtk_Alti</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">131</td>
      <td style="text-align: left">IMUEX(1):err</td>
      <td style="text-align: left">None, SPEED_LARGE_ERROR, GPS_YAW_ERROR</td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">132</td>
      <td style="text-align: left">IMUEX(1):rtk_Alti</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">200</td>
    </tr>
    <tr>
      <td style="text-align: left">133</td>
      <td style="text-align: left">MotorCtrl:PWM:RFront</td>
      <td style="text-align: left">Pulse width modulation. Can be used to determine commanded motor speed. Range 0-100%</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">134</td>
      <td style="text-align: left">MotorCtrl:PWM:LFront</td>
      <td style="text-align: left">Pulse width modulation. Can be used to determine commanded motor speed. Range 0-100%</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">135</td>
      <td style="text-align: left">MotorCtrl:PWM:LBack</td>
      <td style="text-align: left">Pulse width modulation. Can be used to determine commanded motor speed. Range 0-100%</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">136</td>
      <td style="text-align: left">MotorCtrl:PWM:RBack</td>
      <td style="text-align: left">Pulse width modulation. Can be used to determine commanded motor speed. Range 0-100%</td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">137</td>
      <td style="text-align: left">AirCraftCondition:fsmState</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">138</td>
      <td style="text-align: left">AirCraftCondition:nearGround</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">139</td>
      <td style="text-align: left">AirCraftCondition:landState</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">140</td>
      <td style="text-align: left">AirCraftCondition:UP_acc_t</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">141</td>
      <td style="text-align: left">AirCraftCondition:UP_TF_t</td>
      <td style="text-align: left"> </td>
      <td style="text-align: center">50</td>
    </tr>
    <tr>
      <td style="text-align: left">142</td>
      <td style="text-align: left">Operating_Phase</td>
      <td style="text-align: left">operating phase of the drone at the moment (i.e., at Tick#)</td>
      <td style="text-align: center">Variable</td>
    </tr>
  </tbody>
</table>

<h2 id="references-as-of-962023">References (as of 9/6/2023)</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">DatCon 3.6.1 (7/30/2018)</code> <a href="https://datfile.net/DatCon/fieldsV3.html">V3 .CSV column format</a></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="laravel" /><summary type="html"><![CDATA[I have compiled a short list of variables from the DatCon 3.6.1 (7/30/2018) V3 .CSV column format. Please note, the following variables are either absent in the data files I worked with, or I removed due privacy concerns.]]></summary></entry><entry><title type="html">Basics of Laravel – A PHP Framework</title><link href="https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-laravel/" rel="alternate" type="text/html" title="Basics of Laravel – A PHP Framework" /><published>2023-09-08T00:00:00-06:00</published><updated>2023-10-21T00:21:11-06:00</updated><id>https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-biswas-3</id><content type="html" xml:base="https://cse.ucdenver.edu/~biswasa/posts/2023/09/biswas/blog-laravel/"><![CDATA[<p>Laravel is an open-source PHP web framework that follows the <code class="language-plaintext highlighter-rouge">model-view-controller (MVC)</code> design pattern. It hosts two major tools: i) composer and ii) artisan. The <code class="language-plaintext highlighter-rouge">Composer</code> includes all the dependencies and libraries. It allows a user to create a project with respect to the mentioned framework (for example, those used in Laravel installation). Third party libraries can be installed easily with help of composer. All the dependencies are noted in composer.json file which is placed in the source folder. <code class="language-plaintext highlighter-rouge">Artisan</code> includes a set of commands which assists in building a web application. These commands are incorporated from Symphony framework, resulting in add-on features in Laravel 5.1+.</p>

<h2 id="prerequisites">Prerequisites</h2>
<ul>
  <li>Assuming, you have PHP and <code class="language-plaintext highlighter-rouge">VSCode</code> installed in your system.</li>
</ul>

<h2 id="setting-up-laravel">Setting up Laravel</h2>
<h3 id="setting-up-composer">Setting up Composer</h3>
<ul>
  <li>Get and install composer from <a href="https://getcomposer.org/download/">https://getcomposer.org/download/</a> by following the instructions.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>php <span class="nt">-r</span> <span class="s2">"copy('https://getcomposer.org/installer', 'composer-setup.php');"</span>
php <span class="nt">-r</span> <span class="s2">"if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"</span>
php composer-setup.php
php <span class="nt">-r</span> <span class="s2">"unlink('composer-setup.php');"</span>
</code></pre></div></div>
<ul>
  <li>This installer script will simply check some <code class="language-plaintext highlighter-rouge">php.ini</code> settings, warn you if they are set incorrectly, and then download the latest <code class="language-plaintext highlighter-rouge">composer.phar</code> in the current directory. The 4 lines above will, in order:
    <ul>
      <li>Download the installer to the current directory</li>
      <li>Verify the installer SHA-384, which you can also cross-check here</li>
      <li>Run the installer</li>
      <li>Remove the installer</li>
    </ul>
  </li>
  <li>Most likely, you want to put the composer.phar into a directory on your <code class="language-plaintext highlighter-rouge">PATH</code>, so you can simply call <code class="language-plaintext highlighter-rouge">composer</code> from any directory (Global install), using for example:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">mkdir /Users/ashis/_Applications</code></li>
      <li><code class="language-plaintext highlighter-rouge">mv composer.phar _Applications</code></li>
      <li><code class="language-plaintext highlighter-rouge">ln -s /Users/ashis/_Applications/composer.phar /Users/ashis/_Applications/composer</code></li>
      <li><code class="language-plaintext highlighter-rouge">vi ~/.zshrc</code>
        <ul>
          <li><code class="language-plaintext highlighter-rouge">export PATH="/Users/ashis/_Applications/:$PATH"</code></li>
          <li><code class="language-plaintext highlighter-rouge">source ~/.zshrc</code></li>
        </ul>
      </li>
      <li>Test if <code class="language-plaintext highlighter-rouge">composer</code> command works from the command line.</li>
    </ul>
  </li>
</ul>

<h3 id="setting-up-nodejs-and-npm">Setting up Node.js and NPM</h3>
<ul>
  <li><code class="language-plaintext highlighter-rouge">Node.js</code> has installer for all OS at this site <a href="https://nodejs.org/en">https://nodejs.org/en</a>. It also installs <code class="language-plaintext highlighter-rouge">npm</code>, a package manager for javascript.
    <ul>
      <li>Follow the step by running the installer and make a note on the install path. In my case it was installed at:</li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>This package has installed:
	•	Node.js v18.17.1 to /usr/local/bin/node
	•	npm v9.6.7 to /usr/local/bin/npm
</code></pre></div></div>
<ul>
  <li>Check the installation of node.js and npm by typing the following:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro ~ % node <span class="nt">-v</span>
v18.17.1
ashis@Ashiss-MacBook-Pro ~ % npm <span class="nt">-v</span>
9.6.7
</code></pre></div></div>
<ul>
  <li>Upgrade <code class="language-plaintext highlighter-rouge">npm</code> with <code class="language-plaintext highlighter-rouge">sudo npm install -g npm@10.0.0</code></li>
  <li>Also run <code class="language-plaintext highlighter-rouge">npm install</code></li>
</ul>

<h3 id="now-install-and-configure-laravel">Now, install and configure Laravel</h3>
<ul>
  <li>Install Laravel with <code class="language-plaintext highlighter-rouge">composer</code>:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro ~ % composer global require laravel/installer
</code></pre></div></div>
<ul>
  <li>Add the laravel executable in <code class="language-plaintext highlighter-rouge">PATH</code>:
    <ul>
      <li>in MacOS: <code class="language-plaintext highlighter-rouge">export PATH="$HOME/.composer/vendor/bin/:$PATH"</code></li>
      <li>in Ubuntu: <code class="language-plaintext highlighter-rouge">export PATH="$HOME/.config/composer/vendor/bin/:$PATH"</code></li>
    </ul>
  </li>
  <li>Check <code class="language-plaintext highlighter-rouge">laravel</code> installation with</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro ~ % laravel   
Laravel Installer 5.1.0

Usage:
  <span class="nb">command</span> <span class="o">[</span>options] <span class="o">[</span>arguments]

Options:
  <span class="nt">-h</span>, <span class="nt">--help</span>            Display <span class="nb">help </span><span class="k">for </span>the given command. When no <span class="nb">command </span>is given display <span class="nb">help </span><span class="k">for </span>the list <span class="nb">command</span>
  <span class="nt">-q</span>, <span class="nt">--quiet</span>           Do not output any message
  <span class="nt">-V</span>, <span class="nt">--version</span>         Display this application version
      <span class="nt">--ansi</span>|--no-ansi  Force <span class="o">(</span>or disable <span class="nt">--no-ansi</span><span class="o">)</span> ANSI output
  <span class="nt">-n</span>, <span class="nt">--no-interaction</span>  Do not ask any interactive question
  <span class="nt">-v</span>|vv|vvv, <span class="nt">--verbose</span>  Increase the verbosity of messages: 1 <span class="k">for </span>normal output, 2 <span class="k">for </span>more verbose output and 3 <span class="k">for </span>debug

Available commands:
  completion  Dump the shell completion script
  <span class="nb">help        </span>Display <span class="nb">help </span><span class="k">for </span>a <span class="nb">command
  </span>list        List commands
  new         Create a new Laravel application
</code></pre></div></div>

<h2 id="create-new-laravel-project">Create new laravel project</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">laravel new mlcompetition</code>
    <ul>
      <li>It may ask for 3 options: i) No starter kit, ii) Laravel breeze, iii) Laravel jetstream. Details can be found <a href="https://laravel.com/docs/10.x/starter-kits">here</a>. Please use either of <code class="language-plaintext highlighter-rouge">breeze</code> or <code class="language-plaintext highlighter-rouge">jetstream</code> template to integrate the <code class="language-plaintext highlighter-rouge">authentication/login/register</code> template/options.</li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌ Would you like to <span class="nb">install </span>a starter kit? ────────────────────┐
 │ Laravel Breeze                                               │
 └──────────────────────────────────────────────────────────────┘

 ┌ Which Breeze stack would you like to <span class="nb">install</span>? ───────────────┐
 │ Blade                                                        │
 └──────────────────────────────────────────────────────────────┘

 ┌ Would you like dark mode support? ───────────────────────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

 ┌ Which testing framework <span class="k">do </span>you prefer? ──────────────────────┐
 │ PHPUnit                                                      │
 └──────────────────────────────────────────────────────────────┘

 ┌ Would you like to initialize a Git repository? ──────────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

┌ Which database will your application use? ───────────────────┐
 │ MySQL                                                        │
 └──────────────────────────────────────────────────────────────┘
</code></pre></div></div>
<ul>
  <li>Open the project folder with <code class="language-plaintext highlighter-rouge">VSCode</code>.
    <ul>
      <li><code class="language-plaintext highlighter-rouge">./composer.json</code> : contains the project’s assets.</li>
      <li><code class="language-plaintext highlighter-rouge">./resources/views/welcome.blade.php</code> is the default welcome page. <code class="language-plaintext highlighter-rouge">blade</code> is a rendering template.</li>
      <li><code class="language-plaintext highlighter-rouge">./resources/views/dashboard.blade.php</code> is a view file that gets loaded when a user successfully logs in.</li>
    </ul>
  </li>
  <li>Type <code class="language-plaintext highlighter-rouge">php artisan</code> to see all different options/commands. Get familiar with all the available commands.</li>
  <li>Serve the project into built-in web server: <code class="language-plaintext highlighter-rouge">php artisan serve</code></li>
</ul>

<h3 id="connecting-a-mysql-database-with-the-laravel-project">Connecting a MySQL Database with the Laravel Project</h3>
<ul>
  <li><strong>Setting the Connection configurations</strong>: Make sure you edit the 2 following files:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">.env</code> file: Check the <code class="language-plaintext highlighter-rouge">DB_</code> entries.</li>
      <li><code class="language-plaintext highlighter-rouge">config/database.php</code> file: check the <code class="language-plaintext highlighter-rouge">mysql</code> connection entries.</li>
    </ul>
  </li>
  <li><strong>Create a view</strong>:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">resources/views/dbconn.blade.php</code></li>
    </ul>
  </li>
</ul>

<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?php</span>
<span class="k">if</span><span class="p">(</span><span class="no">DB</span><span class="o">::</span><span class="nf">connection</span><span class="p">()</span><span class="o">-&gt;</span><span class="nf">getPdo</span><span class="p">()){</span>
	<span class="k">echo</span> <span class="s2">"Successful connection to the database named "</span><span class="mf">.</span><span class="no">DB</span><span class="o">::</span><span class="nf">connection</span><span class="p">()</span><span class="o">-&gt;</span><span class="nf">getDatabaseName</span><span class="p">();</span>
<span class="p">}</span><span class="k">else</span><span class="p">{</span>
	<span class="k">echo</span> <span class="s2">"Unsuccessful connection to the database named "</span><span class="mf">.</span><span class="no">DB</span><span class="o">::</span><span class="nf">connection</span><span class="p">()</span><span class="o">-&gt;</span><span class="nf">getDatabaseName</span><span class="p">();</span>
<span class="p">}</span>
<span class="cp">?&gt;</span>
</code></pre></div></div>
<ul>
  <li>Then, add a route in the <code class="language-plaintext highlighter-rouge">routes/web.php</code> file:</li>
</ul>

<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Route</span><span class="o">::</span><span class="nf">get</span><span class="p">(</span><span class="s1">'/dbconn'</span><span class="p">,</span> <span class="k">function</span><span class="p">(){</span>
    <span class="k">return</span> <span class="nf">view</span><span class="p">(</span><span class="s1">'dbconn'</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>
<ul>
  <li>Now, go check if <code class="language-plaintext highlighter-rouge">localhost:8000/dbconn</code> is successful or not.
    <h3 id="front-end">Front-end</h3>
  </li>
  <li>In the project directory run: <code class="language-plaintext highlighter-rouge">npm run build</code>. Here are the explanations for this command:
    <ul>
      <li><code class="language-plaintext highlighter-rouge">npm</code>: One could say that it is a command native to the system, for calling <code class="language-plaintext highlighter-rouge">Node Package Manager</code> program.</li>
      <li><code class="language-plaintext highlighter-rouge">run</code>: It is a command native to <code class="language-plaintext highlighter-rouge">npm</code>. Keep in mind this is an alias to the original command <code class="language-plaintext highlighter-rouge">run-script</code>.</li>
      <li><code class="language-plaintext highlighter-rouge">dev</code>/<code class="language-plaintext highlighter-rouge">build</code> and <code class="language-plaintext highlighter-rouge">prod</code>: They’re user defined.
        <ul>
          <li><code class="language-plaintext highlighter-rouge">dev</code>/<code class="language-plaintext highlighter-rouge">build</code>: Used for running the specific commands for serving the project, to any server, to live development. In the case of a web page, you’ll see your web page in the browser, and any change you make to the HTML code, for example, will be reflected immediately in the page you see in your browser.</li>
          <li><code class="language-plaintext highlighter-rouge">prod</code>: Compiles all the necessary files for production. Final product. In the case of a web page, for example, the HTML, CSS, and JS files you’ll handle to the client. The result of running this command, it is expected to be one single folder with all the afore mentioned content.</li>
        </ul>
      </li>
      <li>It creates the following files in <code class="language-plaintext highlighter-rouge">./public</code> directory:</li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro mlcompetition % tree public 
public
├── build
│   ├── assets
│   │   ├── app-6e0eadfb.js
│   │   └── app-e3a33e56.css
│   └── manifest.json
├── favicon.ico
├── index.php
└── robots.txt

2 directories, 6 files
</code></pre></div></div>

<ul>
  <li>You will not be directly editing any of these files, instead you may edit <code class="language-plaintext highlighter-rouge">./resources/css/app.css</code> and <code class="language-plaintext highlighter-rouge">./resources/js/app.js</code> files.</li>
</ul>

<h3 id="databases-with-migrations">Databases with Migrations</h3>
<ul>
  <li>Migrations are like version control for your database, allowing your team to define and share the application’s database schema definition. If you have ever had to tell a teammate to manually add a column to their local database schema after pulling in your changes from source control, you’ve faced the problem that Laravel’s database migrations solve.</li>
  <li>The Laravel Schema facade provides database agnostic support for creating and manipulating tables across all of Laravel’s supported database systems. Typically, migrations will use this facade to create and modify database tables and columns</li>
  <li>Before you do anything, edit the following entries in <code class="language-plaintext highlighter-rouge">.env</code> file at the project root directory:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">DB_CONNECTION</span><span class="o">=</span>mysql
<span class="nv">DB_HOST</span><span class="o">=</span>127.0.0.1
<span class="nv">DB_PORT</span><span class="o">=</span>3306
<span class="nv">DB_DATABASE</span><span class="o">=</span>xxxx
<span class="nv">DB_USERNAME</span><span class="o">=</span>xxxx
<span class="nv">DB_PASSWORD</span><span class="o">=</span>xxxx
</code></pre></div></div>
<ul>
  <li>Also, go to <code class="language-plaintext highlighter-rouge">./config/database.php</code> and update the following as needed:</li>
</ul>

<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s1">'mysql'</span> <span class="o">=&gt;</span> <span class="p">[</span>
            <span class="s1">'driver'</span> <span class="o">=&gt;</span> <span class="s1">'mysql'</span><span class="p">,</span>
            <span class="s1">'url'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DATABASE_URL'</span><span class="p">),</span>
            <span class="s1">'host'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_HOST'</span><span class="p">,</span> <span class="s1">'127.0.0.1'</span><span class="p">),</span>
            <span class="s1">'port'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_PORT'</span><span class="p">,</span> <span class="s1">'3306'</span><span class="p">),</span>
            <span class="s1">'database'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_DATABASE'</span><span class="p">,</span> <span class="s1">'xxxxx'</span><span class="p">),</span>
            <span class="s1">'username'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_USERNAME'</span><span class="p">,</span> <span class="s1">'xxxxx'</span><span class="p">),</span>
            <span class="s1">'password'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_PASSWORD'</span><span class="p">,</span> <span class="s1">'xxxxx'</span><span class="p">),</span>
            <span class="s1">'unix_socket'</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'DB_SOCKET'</span><span class="p">,</span> <span class="s1">''</span><span class="p">),</span>
            <span class="s1">'charset'</span> <span class="o">=&gt;</span> <span class="s1">'utf8mb4'</span><span class="p">,</span>
            <span class="s1">'collation'</span> <span class="o">=&gt;</span> <span class="s1">'utf8mb4_unicode_ci'</span><span class="p">,</span>
            <span class="s1">'prefix'</span> <span class="o">=&gt;</span> <span class="s1">''</span><span class="p">,</span>
            <span class="s1">'prefix_indexes'</span> <span class="o">=&gt;</span> <span class="kc">true</span><span class="p">,</span>
            <span class="s1">'strict'</span> <span class="o">=&gt;</span> <span class="kc">true</span><span class="p">,</span>
            <span class="s1">'engine'</span> <span class="o">=&gt;</span> <span class="kc">null</span><span class="p">,</span>
            <span class="s1">'options'</span> <span class="o">=&gt;</span> <span class="nb">extension_loaded</span><span class="p">(</span><span class="s1">'pdo_mysql'</span><span class="p">)</span> <span class="o">?</span> <span class="nb">array_filter</span><span class="p">([</span>
                <span class="no">PDO</span><span class="o">::</span><span class="no">MYSQL_ATTR_SSL_CA</span> <span class="o">=&gt;</span> <span class="nf">env</span><span class="p">(</span><span class="s1">'MYSQL_ATTR_SSL_CA'</span><span class="p">),</span>
            <span class="p">])</span> <span class="o">:</span> <span class="p">[],</span>
        <span class="p">],</span>
</code></pre></div></div>
<ul>
  <li><strong>Migrate</strong>
    <ul>
      <li>Do it first time: <code class="language-plaintext highlighter-rouge">php artisan migrate</code>
        <ul>
          <li>This will create few tables in the chosen database:
            <ul>
              <li><code class="language-plaintext highlighter-rouge">users</code> – all user info will be recorded here.</li>
              <li><code class="language-plaintext highlighter-rouge">password_reset_tokens</code> – will store tokens if someone forgets their password</li>
              <li><code class="language-plaintext highlighter-rouge">password_access_tokens</code>,</li>
              <li><code class="language-plaintext highlighter-rouge">failed_jobs</code>,</li>
              <li><code class="language-plaintext highlighter-rouge">migrations</code>.</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>Right after migration, go hit the <code class="language-plaintext highlighter-rouge">Register</code> button in the website (e.g., <code class="language-plaintext highlighter-rouge">http://127.0.0.1:8000/</code>).
        <ul>
          <li>Provide information to register an account. The site will then log you into the account.</li>
          <li>Once logged in, the route shown would be: <code class="language-plaintext highlighter-rouge">http://127.0.0.1:8000/dashboard</code></li>
          <li>You can check that <code class="language-plaintext highlighter-rouge">dashboard</code> view when routed would be inaccessible if logged out.</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro lara2site % php artisan migrate

   INFO  Preparing database.  

  Creating migration table ..................................................................................................... 16ms DONE

   INFO  Running migrations.  

  2014_10_12_000000_create_users_table ......................................................................................... 20ms DONE
  2014_10_12_100000_create_password_reset_tokens_table ......................................................................... 14ms DONE
  2019_08_19_000000_create_failed_jobs_table ................................................................................... 12ms DONE
  2019_12_14_000001_create_personal_access_tokens_table ........................................................................ 16ms DONE
</code></pre></div></div>
<h3 id="working-on-the-views">Working on the views</h3>
<ul>
  <li>Edit <code class="language-plaintext highlighter-rouge">resources/views/layouts/app.blade.php</code> to change the design.</li>
  <li>Add figures for the site in <code class="language-plaintext highlighter-rouge">public/</code>. Let’s create <code class="language-plaintext highlighter-rouge">figs/</code> folder inside it which will contain all figures for the site. You may use the files in <code class="language-plaintext highlighter-rouge">figs/</code> considering <code class="language-plaintext highlighter-rouge">public/</code> as the site root directory.
    <ul>
      <li>The public site never has access outside the <code class="language-plaintext highlighter-rouge">public/</code> directory.</li>
    </ul>
  </li>
  <li><strong>Generating migrations</strong>
    <ul>
      <li>You may use the <code class="language-plaintext highlighter-rouge">make:migration</code> Artisan command to generate a database migration. The new migration will be placed in your <code class="language-plaintext highlighter-rouge">database/migrations</code> directory. Each migration filename contains a timestamp that allows Laravel to determine the order of the migrations: <code class="language-plaintext highlighter-rouge">php artisan make:migration create_flights_table</code>.</li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ashis@Ashiss-MacBook-Pro mlcompetition % php artisan make:migration create_flights_table

   INFO  Migration <span class="o">[</span>database/migrations/2023_09_13_180750_create_flights_table.php] created successfully.
</code></pre></div></div>
<ul>
  <li>Content of that file would be something like below:</li>
</ul>

<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?php</span>

<span class="kn">use</span> <span class="nc">Illuminate\Database\Migrations\Migration</span><span class="p">;</span>
<span class="kn">use</span> <span class="nc">Illuminate\Database\Schema\Blueprint</span><span class="p">;</span>
<span class="kn">use</span> <span class="nc">Illuminate\Support\Facades\Schema</span><span class="p">;</span>

<span class="k">return</span> <span class="k">new</span> <span class="kd">class</span> <span class="kd">extends</span> <span class="nc">Migration</span>
<span class="p">{</span>
    <span class="cd">/**
     * The database connection that should be used by the migration.
     *
     * @var string
     */</span>
    <span class="k">protected</span> <span class="nv">$connection</span> <span class="o">=</span> <span class="s1">'mysql'</span><span class="p">;</span>

    <span class="cd">/**
     * Run the migrations.
     */</span>
    <span class="k">public</span> <span class="k">function</span> <span class="n">up</span><span class="p">():</span> <span class="kt">void</span>
    <span class="p">{</span>
        <span class="nc">Schema</span><span class="o">::</span><span class="nf">create</span><span class="p">(</span><span class="s1">'flights'</span><span class="p">,</span> <span class="k">function</span> <span class="p">(</span><span class="kt">Blueprint</span> <span class="nv">$table</span><span class="p">)</span> <span class="p">{</span>
            <span class="nv">$table</span><span class="o">-&gt;</span><span class="nf">id</span><span class="p">();</span>
            <span class="nv">$table</span><span class="o">-&gt;</span><span class="nf">string</span><span class="p">(</span><span class="s1">'name'</span><span class="p">);</span>
            <span class="nv">$table</span><span class="o">-&gt;</span><span class="nf">string</span><span class="p">(</span><span class="s1">'airline'</span><span class="p">);</span>
            <span class="nv">$table</span><span class="o">-&gt;</span><span class="nf">timestamps</span><span class="p">();</span>
        <span class="p">});</span>
    <span class="p">}</span>

    <span class="cd">/**
     * Reverse the migrations.
     */</span>
    <span class="k">public</span> <span class="k">function</span> <span class="n">down</span><span class="p">():</span> <span class="kt">void</span>
    <span class="p">{</span>
        <span class="nc">Schema</span><span class="o">::</span><span class="nf">dropIfExists</span><span class="p">(</span><span class="s1">'flights'</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>
</code></pre></div></div>
<ul>
  <li>Laravel will use the name of the migration to attempt to guess the name of the table and whether or not the migration will be creating a new table. If Laravel is able to determine the table name from the migration name, Laravel will pre-fill the generated migration file with the specified table. Otherwise, you may simply specify the table in the migration file manually.</li>
  <li><strong>Squashing migrations</strong>
    <ul>
      <li>As you build your application, you may accumulate more and more migrations over time. This can lead to your database/migrations directory becoming bloated with potentially hundreds of migrations. If you would like, you may <code class="language-plaintext highlighter-rouge">squash</code> your migrations into a single <code class="language-plaintext highlighter-rouge">SQL</code> file. To get started, execute the <code class="language-plaintext highlighter-rouge">schema:dump</code> command:</li>
    </ul>
  </li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>php artisan schema:dump
 
<span class="c"># Dump the current database schema and prune all existing migrations...</span>
php artisan schema:dump <span class="nt">--prune</span>
</code></pre></div></div>
<ul>
  <li>When you execute this command, Laravel will write a “schema” file to your application’s database/schema directory. The schema file’s name will correspond to the database connection. Now, when you attempt to migrate your database and no other migrations have been executed, Laravel will first execute the SQL statements in the schema file of the database connection you are using. After executing the schema file’s SQL statements, Laravel will execute any remaining migrations that were not part of the schema dump.</li>
  <li>Migration squashing is only available for the MySQL, PostgreSQL, and SQLite databases and utilizes the database’s command-line client. Schema dumps may not be restored to in-memory SQLite databases.</li>
  <li><strong>Migration Structure</strong>
    <ul>
      <li>A migration class contains two methods: <code class="language-plaintext highlighter-rouge">up</code> and <code class="language-plaintext highlighter-rouge">down</code>.
        <ul>
          <li>The <code class="language-plaintext highlighter-rouge">up</code> method is used to add new tables, columns, or indexes to your database,</li>
          <li>The <code class="language-plaintext highlighter-rouge">down</code> method should reverse the operations performed by the <code class="language-plaintext highlighter-rouge">up</code> method.</li>
        </ul>
      </li>
      <li>Within both of these methods, you may use the Laravel schema builder to expressively create and modify tables.</li>
    </ul>
  </li>
  <li><strong>Setting The Migration Connection</strong>
    <ul>
      <li>If your migration will be interacting with a database connection other than your application’s default database connection, you should set the $connection property of your migration in the migration files: <code class="language-plaintext highlighter-rouge">protected $connection = 'mysql';</code></li>
    </ul>
  </li>
  <li><strong>Running Migrations</strong>
    <ul>
      <li>To run all of your outstanding migrations, execute the migrate Artisan command: <code class="language-plaintext highlighter-rouge">php artisan migrate</code></li>
      <li>If you would like to see which migrations have run thus far, you may use the <code class="language-plaintext highlighter-rouge">migrate:status</code> Artisan command: <code class="language-plaintext highlighter-rouge">php artisan migrate:status</code></li>
      <li>If you would like to see the SQL statements that will be executed by the migrations without actually running them, you may provide the <code class="language-plaintext highlighter-rouge">--pretend</code> flag to the migrate command: <code class="language-plaintext highlighter-rouge">php artisan migrate --pretend</code></li>
    </ul>
  </li>
  <li><strong>Rolling back migrations</strong>
    <ul>
      <li>To roll back the latest migration operation, you may use the rollback Artisan command. This command rolls back the last “batch” of migrations, which may include multiple migration files: <code class="language-plaintext highlighter-rouge">php artisan migrate:rollback</code></li>
      <li>If you would like to see the SQL statements that will be executed by the migrations without actually running them, you may provide the <code class="language-plaintext highlighter-rouge">--pretend</code> flag to the migrate:rollback command: <code class="language-plaintext highlighter-rouge">php artisan migrate:rollback --pretend</code></li>
      <li>The <code class="language-plaintext highlighter-rouge">migrate:reset</code> command will roll back all of your application’s migrations: <code class="language-plaintext highlighter-rouge">php artisan migrate:reset</code></li>
    </ul>
  </li>
  <li><strong>Rollback and Migrate using a single command</strong>
    <ul>
      <li>The <code class="language-plaintext highlighter-rouge">migrate:refresh</code> command will roll back all of your migrations and then execute the <code class="language-plaintext highlighter-rouge">migrate</code> command. This command effectively re-creates your entire database:</li>
      <li><code class="language-plaintext highlighter-rouge">php artisan migrate:refresh</code></li>
    </ul>
  </li>
  <li><strong>Drop all tables and Migrate</strong>
    <ul>
      <li>The <code class="language-plaintext highlighter-rouge">migrate:fresh</code> command will drop all tables from the database and then execute the migrate command: <code class="language-plaintext highlighter-rouge">php artisan migrate:fresh</code>
        <ul>
          <li>The <code class="language-plaintext highlighter-rouge">migrate:fresh</code> command will drop all database tables regardless of their prefix. This command should be used with caution when developing on a database that is shared with other applications.
            <h2 id="references-as-of-962023">References (as of 9/6/2023)</h2>
          </li>
        </ul>
      </li>
    </ul>
  </li>
  <li></li>
</ul>]]></content><author><name>Ashis Kumer Biswas</name></author><category term="laravel" /><summary type="html"><![CDATA[Laravel is an open-source PHP web framework that follows the model-view-controller (MVC) design pattern. It hosts two major tools: i) composer and ii) artisan. The Composer includes all the dependencies and libraries. It allows a user to create a project with respect to the mentioned framework (for example, those used in Laravel installation). Third party libraries can be installed easily with help of composer. All the dependencies are noted in composer.json file which is placed in the source folder. Artisan includes a set of commands which assists in building a web application. These commands are incorporated from Symphony framework, resulting in add-on features in Laravel 5.1+.]]></summary></entry></feed>