<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aquib Baig</title>
    <description>The latest articles on DEV Community by Aquib Baig (@aquibbaig).</description>
    <link>https://dev.to/aquibbaig</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F144763%2Fe225545c-396b-4003-b44a-3707c8fbd295.jpeg</url>
      <title>DEV Community: Aquib Baig</title>
      <link>https://dev.to/aquibbaig</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aquibbaig"/>
    <language>en</language>
    <item>
      <title>The current state of hackathons in India</title>
      <dc:creator>Aquib Baig</dc:creator>
      <pubDate>Thu, 25 Jun 2020 13:41:54 +0000</pubDate>
      <link>https://dev.to/aquibbaig/the-current-state-of-hackathons-in-india-52nl</link>
      <guid>https://dev.to/aquibbaig/the-current-state-of-hackathons-in-india-52nl</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;There have been a lot of technical hackathons over the past few years claiming to generate ideas to solve problems of the modern world and making it a better place. I would not like to present my views on the state of hackathons world wide because I certainly have not experienced those but in my career I have experienced a handful of them in India. I would like to bring them to light and majorly discuss why I am not ready to not attend one ever again. We will discuss major facts and figures in terms of an &lt;code&gt;expectation vs reality&lt;/code&gt; graph in order to visualize the details minutely.&lt;/p&gt;

&lt;h3&gt;
  
  
  A means to churn ideas?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Expectations&lt;/code&gt;&lt;br&gt;
Starting off with a rather controversial title, I would want to suggest that this post wont be a rant but a detailed explanation of my experience over the years. Hackathons are a major platform for a group of students to work on a product that targets at solving a modern problem. Solving a issue would essentially prove a team's worth of problem solving and even win them the prize money.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Reality&lt;/code&gt;&lt;br&gt;
The hackathon is just a means to find a way for organizers to get the best solution and use them in their use case. I went in a hackathon organized by the government where an idea of online bus service was sold to a company who patented the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  A waste of work?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Expectations&lt;/code&gt;&lt;br&gt;
When you are selected for a big hackathon, and by "big" I mean those which are by the government, state, national or world wide, you normally would expect your solution(if selected) to be an end-product which would make a difference in the real world.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Reality&lt;/code&gt;&lt;br&gt;
I wonder how many teams will be able to drive their products to reality in terms of production and marketing after the competition. Mostly, the teams are happy after a prize money and an entry in their resume.&lt;/p&gt;

&lt;h3&gt;
  
  
  Time constraints are a hoax
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Expectations&lt;/code&gt;&lt;br&gt;
We go to the competition hoping it's fair at least in terms of time limit. A 24 hour hackathon would essentially expect a team to solve something within 24 hours only.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Reality&lt;/code&gt;&lt;br&gt;
Most hackathons expose their themes and problem statements before the competition where the teams come prepared with their products, an unfair means of competition. Also, most use modules already available on the internet.&lt;/p&gt;

&lt;h3&gt;
  
  
  Judgement
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Expectations&lt;/code&gt;&lt;br&gt;
Anybody would expect the judges to be focused more on the product than the presentation! Not nitpicking about &lt;code&gt;machine learning&lt;/code&gt; in a project, and should be aware of the fact that very few complex models can be trained overnight and most teams will use pre-trained models on the internet using APIs which is pretty easy. The correlation between a solution and the problem is what judges should be looking for.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Reality&lt;/code&gt;&lt;br&gt;
In many of the hackathons I've been in, the teams try to make up their product with a good presentation at the end. And if you want to win in a hackathon, use machine learning just to beautify the project which doesn't add value either to the solution or the product.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I am not against any hackathons or competitions but to be honest, this is what I experienced. I would basically say that hackathons are mostly for the experience and community and a win or loss doesn't determine your worth. Thanks for the read.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A notifications system written in symfony, GSoC 2019</title>
      <dc:creator>Aquib Baig</dc:creator>
      <pubDate>Fri, 05 Jun 2020 15:12:09 +0000</pubDate>
      <link>https://dev.to/aquibbaig/a-notifications-system-written-in-symfony-gsoc-2019-45ab</link>
      <guid>https://dev.to/aquibbaig/a-notifications-system-written-in-symfony-gsoc-2019-45ab</guid>
      <description>&lt;p&gt;LibreCores.org lists free and open-source “IP Cores” on the website for the community to view and use. "LibreCore" is such an IP core that is created and distributed in the open-source spirit. LibreCores is a project under FOSSi Foundation that creates open source hardware for the community to use at their discretion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Currently the website extracts the project readme, license and calculates code quality(from issues, commits, trackers, etc. in the repository) and renders them on the project page, along with links to the project homepage and git repository. It also has a classification system for better discoverability of such projects. Also, there is an indexed search using Algolia.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Abstract
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A user browsing for “IP cores” on LibreCores may be willing to be informed
about events that happen in the website and the community may want to notify their
audience with relevant information. Notifications are powerful tools to inform users of project crashes, introduce them to new features &amp;amp; updates, and inform them about new messages. These are system generated
by the app. This can be accomplished via emails or text notifications to notify users about various events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Timeline
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In this project, I worked on developing a &lt;strong&gt;Notification system&lt;/strong&gt; for LibreCores. In the existing website, users could add their projects to LibreCores, add classifications and discover other projects efficiently. There was scope for developing user interactivity on the website in the form of system generated notifications,so I worked on an idea to deliver this. The plan was to build a system that will generate a notification message after an event has occurred. As a user, I can click on the bell icon on the navbar and view the list of notifications that I have received and if I’m not logged into the website currently, can receive notifications as an email too. So, my project was divided into the following phases:

&lt;ol&gt;
&lt;li&gt;Improvement of UI Libraries&lt;/li&gt;
&lt;li&gt;Design and implement a notification system for LibreCores&lt;/li&gt;
&lt;li&gt;Improvement of code infrastructure&lt;/li&gt;
&lt;li&gt;Write tests for the implementation&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The proposal for my project can be found &lt;a href="https://docs.google.com/document/d/1RHJmSgOreDmp-kyAUarVN0VT6rKqNjqVRzobd0bXR-U/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The entire Project tracking logs can be found &lt;a href="https://github.com/librecores/librecores-web/projects/5"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The links to all the issues that I have created/worked upon during my GSoC period is&lt;br&gt;
&lt;a href="https://github.com/librecores/librecores-web/issues?utf8=%E2%9C%93&amp;amp;q=is%3Aissue+author%3Aaquibbaig+"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The links to all the Pull Requests that I have created during my GSoC period are&lt;br&gt;
&lt;a href="https://github.com/librecores/librecores-web/pulls?utf8=%E2%9C%93&amp;amp;q=is%3Apr+author%3Aaquibbaig+"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The corresponding project can be found on &lt;a href="https://summerofcode.withgoogle.com/projects/#5913738987700224"&gt;GSoC 2019 website&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Coding Period
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Improvement of UI Libraries
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;During the community bonding period, we found out that the current Assetic bundle was going to be deprecated. So, we had to move on to modern frontend asset management tools such as webpack encore. Migrating legacy
code to webpack is a very painful task but in the end it's worth it. We had a handful of issues in the frontend such as &lt;a href="https://github.com/librecores/librecores-web/issues/260"&gt;cache busting&lt;/a&gt;, &lt;a href="https://github.com/librecores/librecores-web/issues/292"&gt;deprecated assetic bundle&lt;/a&gt; and by using webpack to handle all our frontend assets, we were able to solve all of them
at one go. Also, features such as hot reloading and file watchers came to be very useful.
The Pull Requests I made in this period are:

&lt;ol&gt;
&lt;li&gt;Migrate to webpack - &lt;a href="https://github.com/librecores/librecores-web/pull/353"&gt;#353&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Design and implement a notification system for LibreCores
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This turned out to be the most vital project goal in my GSoC timeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Design of the Notification System
&lt;/h3&gt;

&lt;p&gt;My mentor Philipp Wagner and I had thought of a design beforehand for the notification system but in course of implementation there was&lt;br&gt;
   a major problem to synchronise notifications. We won't want UI lag that would be caused in processing the notification itself. It would cause a significant performance drop when the personalized messages need to be built on the spot when a user triggers the notification. An alternative is to generate the message when a user visits the page. However, this would decrease the performance slightly for many users and each notification, and it would be difficult to send the notification to any other destination, like email or with web notifications.&lt;/p&gt;

&lt;p&gt;Therefore, the best option is to process the messages in a background process where the heavy lifting of generating the messages do not affect the performance of users. We came up with an architechture enhancement where every notification is processed in the background.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--014xj0C2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/1467123/59163316-43c43c80-8af7-11e9-9cca-d53e5e747f10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--014xj0C2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/1467123/59163316-43c43c80-8af7-11e9-9cca-d53e5e747f10.png" alt="Notification Architecture"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;We used &lt;strong&gt;RabbitMQ&lt;/strong&gt; for our use case publish subscribe AMQP based message queue to which we would send notifications to a queue and we created consumers which would pick them up directly from the queue and execute them parallely. It is a message broker that helps to manage the real-time message exchange on web server.&lt;/p&gt;

&lt;p&gt;In this phase, I made the following PR's:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;[GSoC 2019] RabbitMQ architecture for notification system - &lt;a href="https://github.com/librecores/librecores-web/pull/382"&gt;#382&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[GSoC 2019]Notification System: Mgilet/notification-bundle - &lt;a href="https://github.com/librecores/librecores-web/pull/383"&gt;#383&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Notification Consumers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Rendering notifications to the UI using WebNotification consumer
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;WebNotificationConsumer&lt;/strong&gt; will fetch notifications from the queue and process it to render them on the navbar of a specific user on the LibreCores site. The notifications that we intended to share&lt;br&gt;
   through this are repocrawler failures for your projects, if your project was added to LibreCores, etc. Apart from notification dropdown which contains unseen notifications, also created a &lt;strong&gt;Notification inbox&lt;/strong&gt; which will contain all of the notifications for a specific user, both seen and unseen.&lt;/p&gt;

&lt;p&gt;The PR's I made during this phase are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;[GSoC 2019] Configure Web Notification Consumer - &lt;a href="https://github.com/librecores/librecores-web/pull/384"&gt;#384&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Rendering web notifications to the UI and Notification Inbox - &lt;a href="https://github.com/librecores/librecores-web/pull/385"&gt;#385&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vRYT0PKR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63615515-2e918100-c603-11e9-87f2-a77e84c9efdc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vRYT0PKR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63615515-2e918100-c603-11e9-87f2-a77e84c9efdc.jpg" alt="Notification List"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TuGiNpqm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63606385-94730e00-c5ed-11e9-8376-e1cf50fb652d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TuGiNpqm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63606385-94730e00-c5ed-11e9-8376-e1cf50fb652d.jpg" alt="Notification Inbox"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Command to create notifications
&lt;/h3&gt;

&lt;p&gt;Since notifications are completely dependent on user interactions with the website, they are difficult to debug in development. So, created a Symfony console command to create notifications from cli.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;php bin/console librecores:send-notification &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; &amp;lt;type&amp;gt; &amp;lt;recipient&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Pull Request corresponding to this are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Command to create Notification - &lt;a href="https://github.com/librecores/librecores-web/pull/389"&gt;#389&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Notification settings
&lt;/h3&gt;

&lt;p&gt;A user can always allow/disallow if he wants to recieve notifications from LibreCores. The option to configure notification settings lies in the user profile.&lt;/p&gt;

&lt;p&gt;The Pull Request corresponding to this are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;[GSoC 2019] allow users to configure notification settings - &lt;a href="https://github.com/librecores/librecores-web/pull/391"&gt;#391&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kCrIk57p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63613997-9f369e80-c5ff-11e9-910f-0e54f621bda2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kCrIk57p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/26324376/63613997-9f369e80-c5ff-11e9-910f-0e54f621bda2.jpg" alt="Notification Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;### Sending notifications as emails via Email Consumer&lt;br&gt;
   Important community information like details about events and new provisions can be sent directly&lt;br&gt;
   over the email to the users. &lt;strong&gt;EmailNotification Consumer&lt;/strong&gt; processes notifications and sends them to&lt;br&gt;
   associated users.&lt;/p&gt;

&lt;p&gt;The PR's I made during this phase are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implement Email Notification Consumer - &lt;a href="https://github.com/librecores/librecores-web/pull/395"&gt;#395&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Writing tests for the implementation
&lt;/h2&gt;

&lt;p&gt;The goal of unit testing is to segregate each part of the program and test that the individual parts are working correctly. It isolates the smallest piece of testable software from the remainder of the code and determines whether it behaves exactly as you expect. I wrote tests for the consumers during this period and &lt;br&gt;
   the PR's I made during this phase are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;tests for web notification consumer - &lt;a href="https://github.com/librecores/librecores-web/pull/404"&gt;#404&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Additional Contributions
&lt;/h2&gt;

&lt;p&gt;Apart from the main deliverables above, I also contributed on a few other issues, such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Annotations for routing configuration - &lt;a href="https://github.com/librecores/librecores-web/pull/301"&gt;#301&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Custom ranking configuration for projects in algolia - &lt;a href="https://github.com/librecores/librecores-web/pull/302"&gt;#302&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create a notification service - &lt;a href="https://github.com/librecores/librecores-web/pull/401"&gt;#401&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;UI fixes - &lt;a href="https://github.com/librecores/librecores-web/pull/304"&gt;#304&lt;/a&gt; &lt;a href="https://github.com/librecores/librecores-web/pull/403"&gt;#403&lt;/a&gt; &lt;a href="https://github.com/librecores/librecores-web/pull/414"&gt;#414&lt;/a&gt; &lt;a href="https://github.com/librecores/librecores-web/pull/418"&gt;#418&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What tasks were accomplished during this time&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tasks&lt;/th&gt;
&lt;th&gt;Planned&lt;/th&gt;
&lt;th&gt;Completed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Migrate to webpack&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RabbitMQ architecture for notification system&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Implement Web Notification Consumer&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rendering notifications to the UI&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Implement Email Notification Consumer&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test out the notification system&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User Feedback Mechanism&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Include user feedbacks in search UI and projects page&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  My GSoC experience
&lt;/h2&gt;

&lt;p&gt;Overall, GSoC was a really wonderful experience for me. I came to know about a lot of things in Open source development such as: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Importance of small actionable pull requests&lt;/li&gt;
&lt;li&gt;Agile workflow&lt;/li&gt;
&lt;li&gt;Managing large codebases&lt;/li&gt;
&lt;li&gt;Relational database relationships&lt;/li&gt;
&lt;li&gt;Message queue systems like RabbitMQ&lt;/li&gt;
&lt;li&gt;Object Oriented Concepts and clean code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I would specially like to thank my mentor &lt;a href="https://www.philipp-wagner.com/"&gt;Philipp Wagner&lt;/a&gt; for being extremely patient and helpful towards my mistakes and contributions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future scope
&lt;/h2&gt;

&lt;p&gt;This is what I did in my GSoC period but there is plenty of scope for future work. We need to store user generated feedbacks for projects listed in LibreCores and integrate the data to the search UI. &lt;/p&gt;

&lt;p&gt;Thank You!!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Javascript under the hood</title>
      <dc:creator>Aquib Baig</dc:creator>
      <pubDate>Fri, 05 Jun 2020 14:58:52 +0000</pubDate>
      <link>https://dev.to/aquibbaig/javascript-under-the-hood-4de1</link>
      <guid>https://dev.to/aquibbaig/javascript-under-the-hood-4de1</guid>
      <description>&lt;p&gt;We tend to think javascript as an on-the-go language for the browsers but deep down it has some dark secrets that need to be unveiled. We will have a thorough understanding of how javascript works and what is happening in the background of the browser when you are writing some piece of javascript code, synchronous or asynchronous. &lt;/p&gt;

&lt;h3&gt;
  
  
  The Core Of JS
&lt;/h3&gt;

&lt;p&gt;On the core, as we all know javascript is a single-threaded language which means that it can do a single task at a time. It is also synchronous, which means that your code will execute line by line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("abcd")
console.log("bcdf")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;prints out &lt;strong&gt;abcd&lt;/strong&gt; first and &lt;strong&gt;bcdf&lt;/strong&gt; after that. This broadly means that if you have a bunch of statements which take some significant amount of time, such as fetching from backend, while loops, etc. then your code execution is stopped at that phase until the processing occurs and after that only we move to next bunch of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Hello")
let i = 0
while(i &amp;lt; 1000) {
    i++;
    console.log(i)
}
console.log("What's up?")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you execute this piece of code, you will see that first &lt;strong&gt;Hello&lt;/strong&gt; pops up on the screen, after that, we see numbers from &lt;strong&gt;1 to 999&lt;/strong&gt; for about a few seconds and finally, we see &lt;strong&gt;What's up&lt;/strong&gt; on the console.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is this a problem?
&lt;/h3&gt;

&lt;p&gt;The problem occurs when we run the code in browsers. While our javascript runtime(v8 as we know it) is busy executing the piece of code, our friendly-neighborhood browser is frozen. Even buttons and links won't work in this case. Ah, that's a big problem! This happens because the DOM is already painted and is not looking for anything to trigger it's re-rendering/ repainting. So, how do we solve that?&lt;/p&gt;

&lt;h3&gt;
  
  
  Asyncronous Processing with JS
&lt;/h3&gt;

&lt;p&gt;To find a way out of this problem, we use asynchronous processing, which doesn't sequentially execute the code, essentially chopping off the pieces of code which would take a significant amount of time and execting other parts of the code. One simple way is to do a &lt;strong&gt;setTimeout()&lt;/strong&gt; .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Hello!")
let i=0
setTimeout(() =&amp;gt; {
    while(i&amp;lt;1000) {
        i++
        console.log(i)
    }
}, 2000)
console.log("What's up")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run this code, we see that at first &lt;strong&gt;Hello!&lt;/strong&gt; pops up on the screen and then &lt;strong&gt;What's up&lt;/strong&gt;!!! That's crazy, isn't it? It seems that our &lt;strong&gt;setTimeout()&lt;/strong&gt; function has magically been removed for other less time-consuming code to run. So, after a few seconds(2 seconds), setTimeout magically appears to run out of nowhere and prints &lt;strong&gt;1 to 999&lt;/strong&gt;. That is exactly how we wanted our program to behave. Isn't it? The piece of code which takes more time should not block other parts of the program. Aye, therefore we call Javascript as non-blocking. Cool!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Other ways to do asynchronous processing include using Promises or async/await, those are not in the scope of this article, maybe for the next one!&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What happens to the runtime in asyncronous processing?
&lt;/h3&gt;

&lt;p&gt;Javascript runtime has no idea about various requests that we make in our browser, such as xhrHttpRequests, setTimeout, etc. v8 just contains the following data structures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;call stack to keep track of where your current position in code is, or which part of the code is running&lt;/li&gt;
&lt;li&gt;heap for memory management
So, when we make ajax requests and call setTimeouts what is the entity that handles such things? The answer to that is &lt;strong&gt;Browsers!!&lt;/strong&gt;. Browsers come with certain elements such as XML parsers, rendering engine, xhrHttpRequests,  setTimeouts, etc. as a part of collective API's called as web API's. So when you write these functions in your code, the web API's present inside the browser handles that.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Synchronous processing
&lt;/h3&gt;

&lt;p&gt;Let's look at the above two examples to understand how things work on the inside:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Hello") ...... (1)
let i = 0
while(i &amp;lt; 1000) { ...... (2)
    i++;
    console.log(i)
}
console.log("What's up?") ..... (3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Here first &lt;strong&gt;(1)&lt;/strong&gt; comes up in the v8's call stack and finshes execution and is popped up. Then, 
&lt;strong&gt;(2)&lt;/strong&gt; comes to the call stack and after a few seconds of processing, it gets popped off. After that, &lt;strong&gt;(3)&lt;/strong&gt; gets into the call stack and gets executed and popped off. This is synchronous.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Asynchronous processing
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Hello!") ...... (1)
let i=0
setTimeout(() =&amp;gt; {      ....... (2)
    while(i&amp;lt;1000) {
        i++
        console.log(i)
    }
}, 2000)
console.log("What's up")   ........ (3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In this asynchronous example, at first &lt;strong&gt;(1)&lt;/strong&gt; is pushed into the stack, gets executed immediately and popped up. Now, when &lt;strong&gt;(2)&lt;/strong&gt; gets inserted to the stack, v8 knows that it doesn't have the web API's to handle this operation, so it pops out &lt;strong&gt;(2)&lt;/strong&gt; from the call stack and starts a timer for the function in a separate area. This timer will start separately and isolated till 2 seconds/2000 milliseconds as inferred from setTimeout function. In the meanwhile in v8's stack &lt;strong&gt;(3)&lt;/strong&gt; gets pushed into, executed immediately and popped off the stack. &lt;/li&gt;
&lt;li&gt;After 2 seconds have passed, the timer moves &lt;strong&gt;(2)&lt;/strong&gt; to a temporary queue to prevent these kinds of functions from interacting directly with the call stack which will create mismanagement with the execution flow. Here comes into effect a really important component called as the &lt;em&gt;event loop&lt;/em&gt; which checks if the call stack is empty(which is true in this case as &lt;strong&gt;(3)&lt;/strong&gt; has been executed and our call stack is empty) and if the call stack is empty, it pushes the first element in the queue to the call stack for execution. Wow! Read that again. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2100%2F1%2AiHhUyO4DliDwa6x_cO5E3A.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2100%2F1%2AiHhUyO4DliDwa6x_cO5E3A.gif" alt="Event loop"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;credits:miro.medium.com&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use case
&lt;/h3&gt;

&lt;p&gt;This is done to prevent all the asynchronous code to be executed after the synchronous to prevent blocking. And it is a very practical approach dealing with writing real-world in-browser javascript.&lt;br&gt;
Another thing is if we use &lt;code&gt;setTimeout(() =&amp;gt; {function()}, 0)&lt;/code&gt; in the above example in &lt;strong&gt;(2)&lt;/strong&gt;, it doesn't execute suddenly after 0 seconds as it should, but it executes after all the synchronous code has finished executing. How? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember, the event loop...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First &lt;strong&gt;(1)&lt;/strong&gt; will be pushed into the stack and executed. When &lt;strong&gt;(2)&lt;/strong&gt; will come up, it will be removed from the stack because web API's will handle it and a timer will be set up and immediately it will push this function into the temporary queue(Because here time interval is 0 seconds, not 2000 milliseconds as in the last example). In the meanwhile, as &lt;strong&gt;(2)&lt;/strong&gt; is popped off, &lt;strong&gt;(3)&lt;/strong&gt; has entered in the call stack. So, the event loop will know that &lt;strong&gt;(3)&lt;/strong&gt; is in the stack and stack is not empty, so it won't push &lt;strong&gt;(2)&lt;/strong&gt; from the queue to the stack just yet. After &lt;strong&gt;(3)&lt;/strong&gt; has been executed successfully, then only it will be pushed. So, the output will be the same in each case.&lt;/p&gt;

&lt;p&gt;Thanks for the read!!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
