<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nikhil Bhanushali on Medium]]></title>
        <description><![CDATA[Stories by Nikhil Bhanushali on Medium]]></description>
        <link>https://medium.com/@nikhilbhanushali21?source=rss-85802f883cb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hYtO9XVk-TruRBgO</url>
            <title>Stories by Nikhil Bhanushali on Medium</title>
            <link>https://medium.com/@nikhilbhanushali21?source=rss-85802f883cb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:27:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nikhilbhanushali21/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is Your Syslog Too big? Auto-rotate and automatically delete system log files.]]></title>
            <link>https://medium.com/@nikhilbhanushali21/is-your-syslog-too-big-auto-rotate-and-automatically-delete-log-files-157b748f93d?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/157b748f93d</guid>
            <category><![CDATA[linux-server]]></category>
            <category><![CDATA[rotation]]></category>
            <category><![CDATA[system-logs]]></category>
            <category><![CDATA[server-automation]]></category>
            <category><![CDATA[deletion]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 17:24:32 GMT</pubDate>
            <atom:updated>2023-07-29T17:33:41.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Server-automation-rotation-and-deletion-of-system-log-files" src="https://cdn-images-1.medium.com/max/1024/1*Qr1ylQA7v39LErV9_vVBEA.jpeg" /><figcaption>Server automation, rotation and deletion of system log files.</figcaption></figure><p>This blog is a successor to the <a href="https://medium.com/@nikhilbhanushali21/does-your-aws-linux-instance-die-on-you-5f6c8560dfe5">https://medium.com/@nikhilbhanushali21/does-your-aws-linux-instance-die-on-you-5f6c8560dfe5</a>.</p><p>The actual problem was the storage volume running out of available space. I did several checks, and the other services were running fine. Like the backend running via pm2, apache2 service for the frontend, etc. Only the mongod service was not running. When I tried to start the mongo service, it wouldn&#39;t start. After I found out the used space was equal to the actual volume size, I increased the volume size from the AWS console, but it would not reflect, as there was no space at all for even a minor change to take place. Although there is a way shown by the AWS documentation to manually run a script for the volume size change to be reflected. I even raised a support ticket for this issue, but the documentation help me self resolve the situation. I also have to free up 500mb by deleting unused log files to carry on with the modifications required.</p><h3>Extend a Linux file system after resizing a volume</h3><p>Link: <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html</a></p><p>Finally after this I decided to investigate the actual reason that made the system run out space! I check the /var/logs directory and system log (syslog) was the culprit.</p><p>The /var/log directory was using 7.9GB of space of of the total space of 15GB. This directory stores log files generated by different system processes. Logs can accumulate over time and occupy a significant amount of space.</p><blockquote>Furthermore, The largest file within the /var/log directory that I found was syslog.1, with a size of approximately 4.7GB and the other one was syslog which is the file that had a size of approximately 2.3GB and was the current syslog file. <strong><em>This file is the system log file for most Linux based operating systems.</em></strong></blockquote><p>To take car of such blunder, directly from the root cause, I configured the server for automatic log rotation and deletion to prevent large size of log files, now it will be rotated daily (daily), and a maximum of 7 rotated files will be there which will also be compressed to save space.</p><p>Most Linux system already have this configuration by default, but I believe the server that I was using might be running a older version of the operating system and might have not been updated as well!</p><h4>Here is how you can manually setup auto-rotation and auto-deletion of the system log file:</h4><p>The log rotation configuration files in the /etc/logrotate.d/ directory typically have no file extensions. They are simple text files without any specific file extensions.</p><p>The main rsyslog configuration file (/etc/rsyslog.conf) includes other configuration files using the $IncludeConfig directive. This directive specifies a directory or a pattern of files to include in the configuration.</p><p>When rsyslog starts, it reads the main configuration file and processes the $IncludeConfig directive. It searches for all files matching the specified pattern (/etc/logrotate.d/*.conf) and includes them in the configuration. This includes the /etc/logrotate.d/syslog file, which contains the rotation settings specific to the syslog file.</p><p>By including the /etc/logrotate.d/syslog file, rsyslog applies the rotation settings defined in that file to the syslog log file during log rotation operations. This allows for separate management of rotation settings for the syslog file while keeping the main configuration file clean and modular.</p><p><strong>Create a log rotation configuration specifically for the syslog file:</strong></p><p>Here’s an example of how you can create a log rotation configuration for syslog:</p><ol><li>Open the log rotation configuration file for rsyslog using a text editor. In this case, we’ll use nano:</li></ol><pre>sudo nano /etc/logrotate.d/rsyslog</pre><p>2. Add the following lines to the file:</p><pre>/var/log/syslog<br>{<br>    rotate 7<br>    daily<br>    missingok<br>    notifempty<br>    delaycompress<br>    compress<br>    postrotate<br>        service rsyslog restart &gt; /dev/null<br>    endscript<br>}</pre><p>This configuration specifies that the syslog file will be rotated daily (daily), keeping up to 7 rotated files (rotate 7). The delaycompress option compresses the rotated files on the next rotation, allowing the current file to be immediately accessible. The postrotate section restarts the rsyslog service after the rotation to ensure that new logs are written to the correct file.</p><p>3. Save the file and exit the text editor.</p><p>After creating this log rotation configuration, the syslog file will be rotated daily, and up to 7 rotated files will be kept. The rotated files will be compressed to save space, and the rsyslog service will be restarted after rotation.</p><p>Or just modify your rsyslog like below:</p><pre>/var/log/syslog<br>{<br>        rotate 7<br>        daily<br>        missingok<br>        notifempty<br>        delaycompress<br>        compress<br>        postrotate<br>                /usr/lib/rsyslog/rsyslog-rotate<br>        endscript<br>}<br><br>/var/log/mail.info<br>/var/log/mail.warn<br>/var/log/mail.err<br>/var/log/mail.log<br>/var/log/daemon.log<br>/var/log/kern.log<br>/var/log/auth.log<br>/var/log/user.log<br>/var/log/lpr.log<br>/var/log/cron.log<br>/var/log/debug<br>/var/log/messages<br>{<br>        rotate 4<br>        weekly<br>        missingok<br>        notifempty<br>        compress<br>        delaycompress<br>        sharedscripts<br>        postrotate<br>                /usr/lib/rsyslog/rsyslog-rotate<br>        endscript<br>}</pre><p>Each file in this directory represents a separate log rotation configuration for a specific service or log file.</p><p>Here are some examples of the log rotation configurations present in the directory:</p><ul><li>alternatives: Log rotation configuration for alternative log files.</li><li>apache2: Log rotation configuration for Apache HTTP Server logs.</li><li>apport: Log rotation configuration for Apport crash reports.</li><li>apt: Log rotation configuration for APT package manager logs.</li><li>bootlog: Log rotation configuration for boot logs.</li><li>btmp: Log rotation configuration for failed login attempts (related to btmp file).</li><li>certbot: Log rotation configuration for Certbot logs (related to Let&#39;s Encrypt certificates).</li><li>chrony: Log rotation configuration for Chrony NTP daemon logs.</li><li>dpkg: Log rotation configuration for dpkg package manager logs.</li><li>nginx: Log rotation configuration for Nginx web server logs.</li><li>rsyslog: Log rotation configuration for rsyslog logs.</li><li>syslog: Log rotation configuration for the syslog file.</li><li>ubuntu-advantage-tools: Log rotation configuration for Ubuntu Advantage tools logs.</li><li>ufw: Log rotation configuration for Uncomplicated Firewall (UFW) logs.</li><li>unattended-upgrades: Log rotation configuration for unattended upgrades logs.</li><li>wtmp: Log rotation configuration for login records (related to wtmp file).</li></ul><p>Each of these configuration files specifies the rotation settings and post-rotation actions for the corresponding log file or service.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=157b748f93d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SSL expiration will not be a issue for you anymore! Auto-update SSL’s with Let’s Encrypt.]]></title>
            <link>https://medium.com/@nikhilbhanushali21/ssl-expiration-will-not-be-a-issue-for-you-anymore-auto-update-ssls-with-let-s-encrypt-4cec0bec2df?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cec0bec2df</guid>
            <category><![CDATA[cerbot]]></category>
            <category><![CDATA[reminder]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[lets-encrypt]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 11:44:56 GMT</pubDate>
            <atom:updated>2023-07-29T11:44:56.708Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>SSL expiration will not be a issue for you anymore! Auto-update SSLs with Let’s Encrypt.</strong></h3><figure><img alt="lets-encrypt-free-ssl-certificate-auto-renew-via-cerbot" src="https://cdn-images-1.medium.com/max/1024/1*ydWQHP1yjo1ZqSuC4W0EbA.jpeg" /></figure><p>If you provide an email address to Let’s Encrypt when you create your account, they automatically send you expiry notices when your certificate is coming up for renewal. First notice at 20 days before your certificate expires, and the second and final notice at 7 days before it expires.</p><p>Best practice is to rely on the ACME client to automatically renew your certificates, and only use these expiry notices as a warning to check on your automation.</p><p>Certbot is an easy-to-use client that fetches a certificate from Let’s Encrypt</p><p>Link: <a href="https://eff-certbot.readthedocs.io/en/stable/using.html#plugins">https://eff-certbot.readthedocs.io/en/stable/using.html#plugins</a></p><p>How you use Certbot depends on the configuration of your web server. The best way to get started is to use our <a href="https://certbot.eff.org/">interactive guide</a>. It generates instructions based on your configuration settings.</p><p><strong>Test automatic renewal</strong><br>The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running this command:</p><pre>sudo certbot renew --dry-run</pre><p>The command to renew certbot is installed in one of the following locations:</p><p>/etc/crontab/</p><p>/etc/cron.*/*</p><p>systemctl list-timers</p><p>Source: <a href="https://letsencrypt.org/">https://letsencrypt.org/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cec0bec2df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does your AWS Linux Instance Die on you?]]></title>
            <link>https://medium.com/@nikhilbhanushali21/does-your-aws-linux-instance-die-on-you-5f6c8560dfe5?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f6c8560dfe5</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 11:09:43 GMT</pubDate>
            <atom:updated>2023-07-30T09:28:53.817Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AWS-Linux-instance-stopped-working" src="https://cdn-images-1.medium.com/max/853/1*Md3OXkj8EupDcFBiYK0pyA.jpeg" /></figure><p>This happened with me once, mongodb stopped working. Even though the website hosted on this Linux instance was working, the authentication or any functionality related to database was not working. It was surprising for me and little tedious to find the actual reason for this, as the backend API service and the frontend was functional.</p><p>It is possible for system services to fail to start or function properly if the storage on your Ubuntu system is full. When the storage is full, it can impact the system’s ability to write or access necessary files and resources, leading to various issues with system services.</p><p>Here are some common scenarios that can occur when the storage is full:</p><p><strong>Insufficient disk space for log files</strong>: System services often generate log files for tracking their activities and reporting errors. When the storage is full, these log files may fail to be written or updated, making it difficult to diagnose issues or track system behavior.</p><p>Here is how you can check disk space.</p><pre>df -h</pre><p><strong>Inability to create temporary files</strong>: Many system services rely on temporary files for various operations. When the storage is full, these services may be unable to create or access the required temporary files, causing them to fail or malfunction.</p><p><strong>Database issues</strong>: If your system services use databases (e.g., MySQL, PostgreSQL), they may encounter problems when trying to write data or perform database operations due to lack of available storage space.</p><p><strong>File system errors</strong>: A full storage can lead to file system errors and corruption, which can affect the overall stability and functionality of the system services.</p><p>To ensure smooth operation of system services, it is important to regularly monitor and manage the available storage space on your Ubuntu system. Performing regular disk space cleanup, removing unnecessary files, and optimising your storage usage can help prevent such issues from occurring.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f6c8560dfe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What to do with unused Domain certificates?]]></title>
            <link>https://medium.com/@nikhilbhanushali21/what-to-do-with-unused-domain-certificates-c9f465d14469?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f465d14469</guid>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Wed, 24 May 2023 20:11:08 GMT</pubDate>
            <atom:updated>2023-05-24T20:11:08.054Z</atom:updated>
            <content:encoded><![CDATA[<p>I got wildcard certificates for my project from lets-encrypt using a Certbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*ctc24YPE9n1PETTJxu6EHw@2x.jpeg" /></figure><p>Now some of them are maybe expired and may not be configured correctly so, What do I do?</p><p>I wanted them out of my computer.</p><blockquote><strong>How to revoke a certificate?</strong></blockquote><p>Revoking a certificate and removing a certificate are not the same thing. They serve different purposes and are used in different scenarios.</p><p><strong>Revoking a certificate:</strong></p><p>Revoking a certificate is the process of invalidating a previously issued certificate before its expiration date. This is typically done when there is a security concern, such as a compromised private key or a certificate that should no longer be trusted. Revocation involves contacting the certificate authority (CA) and notifying them to add the certificate to their Certificate Revocation List (CRL) or Online Certificate Status Protocol (OCSP) responder.</p><p><strong>Removing a certificate:</strong></p><p>Removing a certificate refers to deleting the certificate and its associated files from your server. This is typically done when you no longer need the certificate or when you want to clean up your server’s configuration.</p><p>In general, you would revoke a certificate when there is a security concern, such as a compromised private key. Revocation allows relying parties to be aware that the certificate is no longer trustworthy. On the other hand, you would remove a certificate when it’s no longer needed or when you want to manage your server’s resources more efficiently.</p><p>It’s worth noting that revoking a certificate does not automatically remove it from your server. Revoking only informs relying parties that the certificate should not be trusted. If you no longer need the certificate, you can then proceed to remove it from your server.</p><p>In summary, revoking a certificate is focused on the trustworthiness of the certificate, while removing a certificate is focused on managing server resources and configurations.</p><blockquote>Lets do it!</blockquote><p>To remove a wildcard certificate obtained through Certbot, you can follow these steps:</p><ul><li>Open a terminal or command prompt on the server where Certbot is installed.</li><li>Run the following command to delete the certificate:</li></ul><pre>certbot delete  – cert-name example.com</pre><ul><li>Replace example.com with the domain name for which the wildcard certificate was issued. This command will remove the certificate and its associated files.</li></ul><p>If you don’t remember the exact certificate name, you can list the certificates managed by Certbot by running:</p><pre>certbot certificates</pre><p>This will display a list of the certificates along with their names and expiration dates. Identify the wildcard certificate you want to remove and note its corresponding name.</p><ul><li>Certbot will prompt you to confirm the deletion. Type ‘y’ or ‘yes’ to proceed.</li><li>Certbot will remove the specified certificate and its associated files.</li><li>After removing the certificate, it’s recommended to reload or restart the web server to ensure it no longer uses the deleted certificate. The specific command to reload or restart the web server depends on the server software you’re using (e.g., Apache, Nginx).</li></ul><p>Please note that removing a certificate is a permanent action, and it cannot be undone.</p><p>Certbot will attempt to contact the certificate authority (CA) that issued the certificate and submit a revocation request. If the revocation is successful, Certbot will display a message indicating the revocation status.</p><p>Note: Revoking a certificate is an irreversible action. Once revoked, the certificate cannot be used again, even if you have a backup copy.</p><p>Thats about how I found solution to my problem.</p><p>I had look online at <a href="https://www.google.com/">https://www.google.com</a> and <a href="https://www.openai.com/">https://www.openai.com/</a></p><p>I how this is helpful for someone in similar situation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f465d14469" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First App in flutter]]></title>
            <link>https://medium.com/@nikhilbhanushali21/my-first-app-in-flutter-f9103092e22?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9103092e22</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Fri, 07 Apr 2023 12:53:13 GMT</pubDate>
            <atom:updated>2023-04-07T12:53:13.721Z</atom:updated>
            <content:encoded><![CDATA[<p>I was working in a team for a backend project, and the front end was suppose to be a flutter application. That is when I decided, I should explore and learn building a flutter app, below is my journey of how I build my first flutter application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nfnsx9lxmv9GX8z9I2cvAw.jpeg" /></figure><h3>Perquisites:</h3><p><a href="https://visualstudio.microsoft.com/downloads/">Visual Studio</a> and Desktop Development with C++ plugin</p><p>Code Editor: <a href="https://code.visualstudio.com/">Vs code</a> and vs code <a href="https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter">flutter extension</a>.</p><p><a href="https://docs.flutter.dev/get-started/install">flutter SDK</a>: We can get it from <a href="https://flutter.dev/">flutter official website</a>.</p><p><a href="https://www.7-zip.org/">7Zip</a></p><p><strong>Installing Flutter</strong></p><p>I downloaded the flutter SDK from here: <a href="https://docs.flutter.dev/get-started/install/windows">https://docs.flutter.dev/get-started/install/windows</a> I am using a windows machine for this project. I am using visual studio code as my code editor.</p><p>After downloading the SDK, I extracted the zip file. I am using a flutter 3.7.10 stable version. I like using 7zip for all my compressed files and folder. 7Zip also has a very nice file manager which I really like, it allows me to browse the compressed file and look at the contents inside the compressed file without extracting the file.</p><p>Then I went ahead and added the flutter/bin path to my user environment variables. Then a ran a check from the command prompt:</p><pre>where flutter dart</pre><p>Which should give the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*SiMOyd-6wqCNlLU4ctRHZQ.png" /></figure><p>Once you see this you can skip reading the below paragraph and move on.</p><p>If you did not get a successful output can continue reading the article, to find the mistake that I did while installing flutter.</p><p>Just letting you know beforehand, if you are reading and following along and building your first flutter application.</p><p><strong>My failed attempts while installing flutter.</strong></p><p>For some reason I was not getting the above successful output, then I found out ,if you already have a command prompt open you might have to close it and reopen the command prompt to check if flutter is installed correctly. I had trouble doing the same while I was using windows PowerShell, I closed PowerShell window, opened a new window and then ran the command again and it still didn&#39;t work for me, I restarted my system several times but I had no luck. I even added the path in the system variable but still no luck. As a last resort I change the location of the extracted folder, I moved it from the download folder to the C drive, and it did not work yet again.</p><p>Finally When I opened a command prompt and not the windows PowerShell. It surprisingly worked. Then I moved on to the next steps.</p><p><strong>Flutter app won’t start</strong></p><p>When I started the debug for the first time, it did not run, even though there wasn&#39;t any syntactical error or compilation error. I did not knew what I was doing wrong. I had to google it like every beginner flutter developer would do. To get to the bottom of it I used:</p><pre>flutter doctor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLKpZiIu6lgKH74UsHKIEw.png" /></figure><p>With that finding I downloaded visual studio code and installed the required “Desktop Development with C++”</p><figure><img alt="Desktop Development with C++ visual studio" src="https://cdn-images-1.medium.com/max/1024/1*q_jkPYlxb3Huu1g0RNA7dQ.png" /></figure><p>Once installed we can run the “flutter doctor” command again to recheck,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*K1pLRTetqFixbn-B5oP2nw.png" /></figure><p>After I installed Desktop Development with C++, I was able to start the app in the debug environment.</p><p><strong>TD: LR</strong></p><p><strong>First Flutter Project</strong></p><p>Steps that worked out for me:</p><ol><li><strong>Open vs code and create a new project with a shortcut:</strong></li></ol><p>CTRL + Shift + P (it will bring up the command palate on VS code)</p><p>then select, from the command palate, you can search this in the command palate</p><p>&gt;Flutter: New Project</p><p>Then you can give the desired project name.</p><p>You will see that vs code has created a project directory for us and opened the project directory for us.</p><p>2. <strong>Hello world in flutter</strong></p><p>In the main.dart file, I removed the boiler plate code, you can also comment it if you want to use it later. Here is my main.dart file:</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() =&gt; runApp(MyApp());<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Welcome to Flutter&#39;,<br>      home: Scaffold(<br>        appBar: AppBar(<br>          title: Text(&#39;Welcome to Flutter&#39;),<br>        ),<br>        body: Center(<br>          child: Text(&#39;Hello World&#39;),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>3. Run The code</p><p>CTRL + Shift + D and then click the Start Debugging (F5) button.</p><p>It may take some time to compile. If everything goes well you should see:</p><figure><img alt="my first flutter app" src="https://cdn-images-1.medium.com/max/1024/1*1aPXqsOLBV0je8fEei0mcw.png" /></figure><p>That&#39;s all for today, I am writing this blog just to share my journey and help anybody who is in a similar situation and just starting with flutter app development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9103092e22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things you need to know before deploying NodeJs Application]]></title>
            <link>https://medium.com/@nikhilbhanushali21/things-you-need-to-know-before-deploying-nodejs-application-d17265df1ee?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d17265df1ee</guid>
            <category><![CDATA[pm2]]></category>
            <category><![CDATA[know-before]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[nodejs-development]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 07:41:33 GMT</pubDate>
            <atom:updated>2023-04-05T07:44:35.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="nodejs-deployment-keep-running-pm2-install-app-server" src="https://cdn-images-1.medium.com/max/989/1*tFIT0DcyYuuuPTeEscIetA.png" /></figure><p>You need a terminal that is running all the time.</p><p>You might have experienced that closing the terminal, shuts off the NodeJs application.</p><p>If you are using a Linux server, you probably have ssh’d into you server and started your node application as we do it on our local environment</p><pre>node &lt;application entry file name&gt;</pre><p>When you close this ssh connection, the command prompt or the terminal window, the node process will die.</p><p>If you need your node process up and running even after you kill the terminal, you need to daemonize the node process,</p><p>One way of doing this is by using pm2. pm2 will prevent the process that was being killed previously as soon as you clos the ssh session.</p><p>pm2 runs the nodejs application in the background and does not let it die on you when you disconnect your ssh connection.</p><h4>First install pm2:</h4><pre>npm install pm2@latest -g</pre><p><strong>Then start and daemonize</strong> your application by using this command line:</p><pre>pm2 start &lt;file_name&gt;</pre><p>for example: pm2 start app.js</p><p>This will start the app with pm2 and it will keep running in the background.</p><p>- <strong>Start and add a process to the pm2 process list</strong>:</p><pre>$ pm2 start app.js --name app</pre><p>The name flag is optional, usally the default name of the process pm2 will use is the name of the entry file. if you need to name the app other than the entry file the name flag will help you tag the application.</p><p><strong>To show the process list:</strong></p><pre>$ pm2 ls</pre><p><strong>To stop and delete a process from the pm2 process list:</strong></p><pre>$ pm2 delete app</pre><p><strong>To stop, start and restart a process from the process list:</strong></p><pre>$ pm2 stop app<br>$ pm2 start app<br>$ pm2 restart app</pre><p>pm2 is a very handy tool to keep your NodeJs application running always.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d17265df1ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python code to Build a API with Flask]]></title>
            <link>https://medium.com/@nikhilbhanushali21/python-code-to-build-a-api-with-flask-8b50aaa2dcb7?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b50aaa2dcb7</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-for-beginners]]></category>
            <category><![CDATA[build]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Thu, 30 Mar 2023 13:32:39 GMT</pubDate>
            <atom:updated>2023-03-31T05:51:48.704Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="python programming language | language of the web | not Javascript" src="https://cdn-images-1.medium.com/max/1024/1*hVELdJE_i4Get7jv_vb5mA.jpeg" /></figure><p>One of my projects I used python programming language to extract data extractor from the pdf and send it as a JSON response, <a href="https://fastapi.tiangolo.com/">f</a>lask helped fire up a standalone server for the same.</p><p>At that time I realized just like <a href="https://expressjs.com/">expresjs</a> framework is being use so widely, python could quickly come into the same space where it will be used by the front-end developers to build various websites and web applications.</p><p>Python is very powerful and easy having tons of packages available to be taken advantage in the field of Artificial intelligence and Machine Learning.</p><p>Setting a a Flask server is quite simple.</p><p>Inside our project folder, First we will need to create our python file named api.py , open up a command prompt in this folder and install flask with the following command:</p><pre>pip install flask</pre><p>Our app.py will look like this:</p><pre>from flask import Flask<br><br>app = Flask(__name__)<br><br>if __name__ == &#39;__main__&#39;:<br> app.run()</pre><p>That&#39;s pretty much it.</p><p>To add a route:</p><pre>@app.route(&quot;/&quot;)<br>def hello():<br> return &quot;Flask API is running&quot;</pre><p>Navigate to <a href="http://127.0.0.1:5000/">http://127.0.0.1:5000</a> and you will see “Flask API is running”.</p><p>This is how you can use build a python API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b50aaa2dcb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don't miss a Single bill to pay]]></title>
            <link>https://medium.com/@nikhilbhanushali21/dont-miss-a-single-bill-to-pay-58862d487dfc?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/58862d487dfc</guid>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Thu, 30 Mar 2023 06:18:15 GMT</pubDate>
            <atom:updated>2023-03-30T06:25:00.070Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="hoe to pay bills on time" src="https://cdn-images-1.medium.com/max/1024/1*uPO502MBjXxh4WqTa9NYlQ.jpeg" /></figure><p>Take advantage of <a href="https://support.google.com/a/users/answer/9247501?hl=en">Google Calendar</a>.</p><p>I use to do things manually at the beginning, every month end I try to remember the bill that are due.</p><p>Slowly I found out that I was getting overcharged because I missed the due date. That is when I decided I won’t miss a deadline anymore.</p><p>I knew there must be a free tool out there, I used a few of them, but there was nothing better than Google Calendar.</p><p>It has a way trough which we can <a href="https://support.google.com/a/users/answer/178189?hl=en">create multiple calendars</a>, very few people might be knowing it.</p><p>So with this feature we can have one calendar for work, one for bills due other for the investments and so on.</p><figure><img alt="google calendar" src="https://cdn-images-1.medium.com/max/316/1*_rgb79qfHVy7HahGA3ijGw.png" /></figure><p>We can have a event that is throughout the day, a reminder 10 minutes before or one day before, we can have it send notification through a mail.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBtiQvhQF8IA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBtiQvhQF8IA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBtiQvhQF8IA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/13353acf2aa624e8858c680fd8b80b4b/href">https://medium.com/media/13353acf2aa624e8858c680fd8b80b4b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58862d487dfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript : Best first Choice Programming language]]></title>
            <link>https://medium.com/@nikhilbhanushali21/javascript-best-first-choice-programming-language-ad43fe260b22?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad43fe260b22</guid>
            <category><![CDATA[roadmaps]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[language]]></category>
            <category><![CDATA[course]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Wed, 29 Mar 2023 11:26:20 GMT</pubDate>
            <atom:updated>2023-03-29T11:58:18.974Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript : Best first Choice Programming language</h3><figure><img alt="javascript programming language" src="https://cdn-images-1.medium.com/max/640/1*iO0ayxzNfud4aGUtqZDQDw.png" /></figure><p>I started my programming journey with JavaScript as my first programming language.</p><p>At first I had no idea where to start from, from my education I had good hands on on HTML and CSS, but these were not enough for landing a decent job.</p><p>I got a second chance when I completed <a href="https://www.udemy.com/course/the-complete-web-development-bootcamp/?amp=&amp;LSNPUBID=wizKxmN8no4&amp;ranEAID=wizKxmN8no4&amp;ranSiteID=wizKxmN8no4-WCa3z0JTfIOMM3MgZKBYxw&amp;utm%5C_medium=udemyads&amp;utm%5C_source=aff-campaign&amp;utm_source=adwords&amp;utm_medium=udemyads&amp;utm_campaign=DSA_Catchall_la.EN_cc.INDIA&amp;utm_content=deal4584&amp;utm_term=_._ag_82569850245_._ad_533220805577_._kw__._de_c_._dm__._pl__._ti_dsa-406594358574_._li_9302184_._pd__._&amp;matchtype=&amp;gclid=Cj0KCQjww4-hBhCtARIsAC9gR3Zod5Z1jmJJT-KDT0jL10XJmj9RC9TGCzMlcTWJusa7VlSAHAvoUCgaApRSEALw_wcB">The Complete 2023 Web Development Bootcamp</a>, this course got me right into the development field form a non technical workplace.</p><figure><img alt="udemy javascript course | Learn Javascript | practice javascript projects | this is a way to learn JavaScript - programming language" src="https://cdn-images-1.medium.com/max/1024/1*TcBu2QtTAPjXuw4489pPsg.png" /></figure><p>With this said, I want to help who are in a similar situation trying to start working as a programmer. There is a ton of resource available on the internet both free and paid. Following the right path and start doing something is all that what matters.</p><p>Here is a great <a href="https://roadmap.sh/">Roadmap</a> to step in right away into the word of programming.</p><figure><img alt="javascript roadmap | This is a path to learn javascript programming." src="https://cdn-images-1.medium.com/max/1024/1*-0Be8-OVo9g-ZDc27RsRug.png" /></figure><p>They also have a YouTube channel:<a href="https://www.youtube.com/theroadmap"> the roadmap</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad43fe260b22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a full-stack application using Node.js,]]></title>
            <link>https://medium.com/@nikhilbhanushali21/build-a-random-food-generator-app-using-node-js-express-and-hbs-template-engine-c26f5e70ae30?source=rss-85802f883cb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c26f5e70ae30</guid>
            <category><![CDATA[random]]></category>
            <category><![CDATA[project-based-learning]]></category>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[full-stack]]></category>
            <dc:creator><![CDATA[Nikhil Bhanushali]]></dc:creator>
            <pubDate>Mon, 27 Mar 2023 08:19:46 GMT</pubDate>
            <atom:updated>2023-03-29T10:33:44.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a full-stack application using Node.js, Express and HBS template engine : random food selector</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFiDvMn-5WmQOM5cN1jDJA.jpeg" /><figcaption>Coder | Programming | Software</figcaption></figure><p>When we are learning to code we are always looking for project ideas to practice and build something.</p><p>Today we are going to build a node server using express framework to select a random food item from a predefined list of foods.</p><p>This tutorial will guide you to build a simple NodeJS project step by step.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsMb00lz-IfE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsMb00lz-IfE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsMb00lz-IfE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fdc93ea7aefa51cf1341993aae40e1fc/href">https://medium.com/media/fdc93ea7aefa51cf1341993aae40e1fc/href</a></iframe><blockquote>“Random is not really that random.”</blockquote><p><strong>Step 1</strong>: Depending on your system <strong>(</strong><a href="http://blog.teamtreehouse.com/install-node-js-npm-mac">Mac</a><strong>, </strong><a href="https://nodejs.org/en/download/">Windows</a><strong> or </strong><a href="https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04">Linux</a><strong>)</strong> <strong>Install Node.js </strong>from the <a href="https://nodejs.org/en/download/">Node.js download page</a>.</p><p>Once above step is done we can run <strong>node -v</strong> to test if node is installed correctly.</p><p><strong>Step 2</strong>: Open a terminal and write the following command:</p><pre>mkdir myapp <br>cd myapp</pre><p>This will create our project directory “myapp” and since we have to initialize our node project we will navigate inside the “myapp” directory with the “cd” command.</p><p>Next, initializes your project.</p><pre>npm init -y</pre><p>This will create a <em>package.json</em> file in your project directory with <em>index.js</em> as the entry file.</p><p>We will need to install our project dependencies by:</p><pre>npm install express hbs</pre><p>Inside our entry file we will create a express server with the following code:</p><pre>const express = require(‘express’);<br><br>const port = 3000;<br>const app = express();<br><br>app.listen(port, () =&gt; {<br>  console.log(`Random food selector application is running on port ${port}`)<br>});</pre><p><strong>Step 3</strong>: Create a sample data of food items.</p><p>From the terminal, execute<em> touch sample_data.json </em>in the<em> </em>root folder of the project, and paste the following:</p><pre>[<br>    {<br>        &quot;selected_food&quot;: &quot;Burger&quot;<br>    },<br>    {<br>        &quot;selected_food&quot;: &quot;Pizza&quot;<br>    },<br>    {<br>        &quot;selected_food&quot;: &quot;Tacos&quot;<br>    },<br>    {<br>        &quot;selected_food&quot;: &quot;Banana bread&quot;<br>    },<br>    {<br>        &quot;selected_food&quot;: &quot;Biscuit&quot;<br>    }<br>]</pre><p>We can now load this data by appending this line in the entry file:</p><pre>const data = require(&#39;./sample_data.json&#39;)</pre><p><strong>Step 4</strong>: Setup a route by adding:</p><pre>app.use(&#39;/food&#39;, (req, res) =&gt; {<br>  return res.json(data[0])<br>})</pre><p>The above code is going to output the first element of the JavaScript object array from our data file.</p><p>Below is the code to get a random item from the array of food items:</p><pre>  const { selected_food } = data[Math.floor(Math.random() * data.length)]</pre><p>With this done we have completed the back-end Api for our project, we have a working endpoint that will give us a random food item each time we make a request to it.</p><p>Let create a front-end now so we can consume the Api we just created and display the information in a user-friendly manner.</p><p><strong>Step 5</strong>: Using express to serve some front-end content.</p><p>We have already installed handlebars as the project dependency which is the view engine that will enable express to serve the front-end content.</p><p>Now, we need to configure our express by setting the views folder and setting the view engine as follows:</p><p>Insert this in the <em>index.js</em></p><pre>app.set(&#39;views&#39;, path.join(__dirname, &#39;views&#39;))<br>app.set(&#39;view engine&#39;, &#39;hbs&#39;)<br>app.use(express.static(&#39;public&#39;))</pre><p>We will need another express inbuilt dependency : ‘path’ to for working with file and directory paths.</p><pre>const path = require(&#39;path&#39;)</pre><p>Then, we need to create directories namely ‘public’ and ‘views’, inside views we will create a new file <em>index.hbs </em>and inside public we will create a new file <em>app.js</em></p><p>We will render it on the root route by</p><pre>app.use(&#39;/&#39;, (req, res) =&gt; {<br>  return res.render(&#39;index&#39;)<br>})</pre><p>Finally our entry file that is the <em>index.js</em> file will look like this:</p><pre>const express = require(‘express’);<br><br>const port = 3000;<br>const path = require(‘path’);<br>const data = require(‘./sample_data.json’);<br>const app = express();<br><br>app.set(‘views’, path.join(__dirname, ‘views’));<br>app.set(‘view engine’, ‘hbs’);<br>app.use(express.static(‘public’));<br><br>app.use(‘/food’, (req, res) =&gt; {<br>  const { selected_food } = data[Math.floor(Math.random() * data.length)];<br>  return res.json({ selected_food });<br>});<br><br>app.use(‘/’, (req, res) =&gt; {<br>  return res.render(‘index’);<br>});<br><br>app.listen(port, () =&gt; {<br>  console.log(`Random food selector application is running on port ${port}`);<br>  console.log(&quot;Data Loaded&quot;, data[0]); // to check if data is loaded<br>});</pre><p>Our index.hbs file will have following code:</p><pre>&lt;html lang=&quot;en&quot;&gt;<br><br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Random Food Selector&lt;/title&gt;<br><br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css&quot;&gt;<br><br>&lt;/head&gt;<br><br>&lt;body&gt;<br>    &lt;div id=&quot;container&quot;&gt;<br>        &lt;h1&gt;Random Food Selector&lt;/h1&gt;<br>        &lt;div class=&quot;result&quot;&gt;&lt;/div&gt;<br>        &lt;button class=&#39;btn btn-primary&#39; id=&quot;generate&quot;&gt;Get Food&lt;/button&gt;<br>    &lt;/div&gt;<br>    &lt;script src=&quot;./app.js&quot;&gt;&lt;/script&gt;<br>    &lt;script&gt;<br>        const resultDiv = document.querySelector(&quot;.result&quot;);<br>        const generateBtn = document.querySelector(&quot;#generate&quot;);<br>        generateBtn.addEventListener(&#39;click&#39;, () =&gt; {<br>            loadRandomFood(resultDiv);<br>        });<br>    &lt;/script&gt;<br>&lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>And app.js file will have below code:</p><pre>const loadRandomFood = (resultDiv) =&gt; {<br>    fetch(&quot;http://localhost:3000/special&quot;)<br>        .then(response =&gt; response.json())<br>        .then((result) =&gt; {<br>            resultDiv.classList.add(&#39;alert&#39;, &#39;alert-success&#39;)<br>            resultDiv.innerHTML = `&lt;h2&gt;${result.selected_food}&lt;/h2&gt;`;<br>        })<br>}</pre><p>Just for the reference the project directory should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*TANtyCND55IhbGdTvkT7fQ.png" /><figcaption>Nodejs Full-stack project</figcaption></figure><p>Step 6: Finally, run the node server with <strong>node index.js</strong></p><p>You can browse the app on <a href="http://localhost:300/">http://localhost:300</a>0/</p><p>You should see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*T7Hl0GcQMPcWmd61noVl5w.png" /><figcaption>Random Food Selector application</figcaption></figure><p>Congratulations, you now have a node express server running!</p><p>Here is a link to the completed code on <a href="https://github.com/nikhilbhanushali21/random-food-selector">GitHub</a></p><p>That’s it for today. If you liked this article and if it helped you in any way, feel free to follow me, more tutorials like this one will be coming soon. If you believe this article will be of big help to someone, feel free to share.</p><h4>Happy coding :)</h4><p>If you liked this, click the like button below so other people will see this here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c26f5e70ae30" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>