<?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 siwani agrawal on Medium]]></title>
        <description><![CDATA[Stories by siwani agrawal on Medium]]></description>
        <link>https://medium.com/@siwaniagrawal18?source=rss-52dba56a052b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*v1W6eBDXAJpYkalM</url>
            <title>Stories by siwani agrawal on Medium</title>
            <link>https://medium.com/@siwaniagrawal18?source=rss-52dba56a052b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:24:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@siwaniagrawal18/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[GSoC 2019 — Creating Awareness about CarbonFootprint with AOSSIE]]></title>
            <link>https://medium.com/@siwaniagrawal18/gsoc-2019-creating-awareness-about-carbonfootprint-with-aossie-433db24c6e14?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/433db24c6e14</guid>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[carbon-footprint]]></category>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[dialogflow]]></category>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 14:22:49 GMT</pubDate>
            <atom:updated>2019-09-18T16:54:29.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>GSoC 2019 — Creating Awareness about CarbonFootprint with AOSSIE</h3><blockquote><strong>My long journey :-</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*GmgSbg0Y99lao3q2SIN1Gw.png" /><figcaption><strong>GSoC Timeline</strong></figcaption></figure><p><strong>Organization: </strong><a href="https://aossie.gitlab.io/">AOSSIE</a><br><strong>Project: </strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/">CarbonAssitant-Function</a></p><p><strong>About the Project: </strong>CarbonAssistant-Function is a Google Assistant Action. The project aims to empower the <a href="https://gitlab.com/siwaniagrawal/CarbonFootprint-API">CarbonFootprint-API</a> by facilitating conversational access to its plethora of features. The aim is to raise awareness about the various ways in which carbon emissions are generated in our day-to-day lives and alert millions of people around the world in a more engaging and interactive way. This action project will enable people to keep a check on their carbon footprint by providing access to the emission-related information through voice on practically any device that may run Google Assistant and hence will further motivate them to control it.</p><blockquote><strong>Why CarbonAssistant-Function is Awesome:</strong></blockquote><ul><li><strong><em>User-friendly conversational support</em></strong> for categories: appliances, trains, flights, vehicles, electricity, fuels, land, food, agriculture, sectors, and poultry. We have added support for a <em>wizard-like</em> experience for the user to make this platform more convenient and user-friendly.</li><li><strong><em>Context management</em></strong> — Ability to continue the conversation based on the context of the previous conversation.</li><li><strong><em>Reverse lookup support</em></strong> — Comparative emission results provide the conditions under which the same emissions will be produced in a different context. These help the user to better internalize the emissions in terms of some other more relatable entity for emission</li><li><strong><em>Slot-filling support</em></strong> — This detects the missing information in the query and asks the user to provide it via prompt message.</li><li><strong><em>Daily-Updates</em></strong> — With daily updates users can receive daily notifications about a particular emission reduction category or method of their liking at the time they want.</li><li><strong><em>Menu support</em></strong> — A menu list is added to include a description for each category that CarbonAssistant-Function supports. The user can opt for any category through the menu and trigger the wizard system.</li><li><strong><em>Guidance Support </em></strong>— A support to educate the users about the various methods by which one can reduce the carbon emissions. When the user asks for the various ways in which one can reduce carbon emissions, a list of categories like, <strong><em>Food and Composting, NGO, Tree, Transportation, Air Travel, Clothes and Shopping, and Home Appliances </em></strong>will be displayed on a <a href="https://developers.google.com/actions/assistant/responses#basic_card">Basic-Card</a> for output-screen displays and a monologue will be sent as the response for google-home. User can also opt for daily updates here.</li><li>Suggestion-Chips, Descriptive Lists along with Images, and Basic-Cards with buttons. Yes! we provide all these cool features to our users.</li></ul><blockquote><strong>My Precious Merge requests:</strong></blockquote><ol><li><strong><em>Wizard-Support for all the categories, Land, Poultry, Electricity, Vehicles, Fuels, Flights, Trains, Sectors, Food, Appliances, and Agriculture respectively. This includes giving a wizard-like experience to the user along with rich-response lists, basic-cards, and suggestion chips. Yes! A wizard-linking of all the parameters, cool isn’t it?(There are some categories with almost 14–17 followup intents. This was the most complex task of my GSoC period):-</em></strong><a href="https://gitlab.com/aossie/CarbonFootprint-API/merge_requests/99"><br></a><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/50">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/50</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/63">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/63</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/56">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/56</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/64">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/64</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/62">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/62</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/60">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/60</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/59">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/59</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/52">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/52</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/51">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/51</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/65">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/65</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/53">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/53</a></li><li><strong><em>Menu feature for Reduce Emission’s Guidance support:</em></strong> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/50">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/50</a></li><li><strong><em>Support for daily updates and all the categories, NGO, Food, Air Travel, Transportation, Clothes and Shopping, Trees and Home Appliances added under reducing emission guidance support: </em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/68">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/68</a></li><li><strong><em>Unit-test script for the land category. It covers land intents, display screen responses, wizard system, Basic-Card, followup intents, and list: </em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/69">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/69</a></li><li><strong><em>Unit-test script for the Food category. It covers food intents, display screen responses, wizard system, Basic-Card, followup intents, and list: </em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/70">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/70</a></li><li><strong><em>Unit-test script for Flight category. It covers flight intents, display screen responses, wizard system, Basic-Card, followup intents, and suggestion chips: </em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/71">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/71</a></li><li><strong><em>Unit-test script for Trains category. It covers trains intents, display screen responses, wizard system, Basic-Card, followup intents, and suggestion chips:</em><br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/72">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/72</a></li><li><strong><em>Unit-test script for Help and Menu intents:</em><br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/73">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/73</a></li><li><strong><em>Unit-test script for Appliances category. It covers appliance intents, display screen responses, wizard system, Basic-Card, followup intents, suggestion chips, and list. Also added automated testing and support for environment variables:</em><br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/75">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/75</a></li><li><strong><em>Unit-test script for Poultry category. It covers poultry intents, display screen responses, wizard system, Basic-Card, followup intents, suggestion chips, and lists</em>:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/82">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/82</a></li><li><strong><em>Unit-test script for Fuels category. It covers fuels intents, display screen responses, wizard system, Basic-Card, followup intents, suggestion chips, and lists</em>:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/80">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/80</a></li><li><strong><em>Unit-test script for Vehicles category. It covers vehicles intents, display screen responses, wizard system, Basic-Card, followup intents, suggestion chips, and lists</em>:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/81">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/81</a></li><li><strong><em>Unit-test script for Electricity category. It covers electricity intents, display screen responses, wizard system, Basic-Card, followup intents, and suggestion chips</em>:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/78">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/78</a></li><li><strong><em>Unit-test script for the Sectors category. It covers sectors intents, display screen responses, wizard system, Basic-Card, followup intents, and list:</em><br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/77">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/77</a></li><li><strong>Support for Google Home Responses:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/79">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/79</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/74">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/74</a></li><li><strong><em>Support to include the comparative response for flights in the Reverse Lookup:<br></em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/76">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/76</a></li><li><strong><em>Script to update and maintain the Carbon-Assistant-Agent :<br></em></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/54">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/54</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/57">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/57</a></li><li><strong>Enhancing the emission-responses and error-responses:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/58">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/58</a> <a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/83">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/83</a></li><li><strong>Indentation of the files:<br></strong><a href="https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/66">https://gitlab.com/aossie/CarbonAssistant-Function/merge_requests/66</a></li></ol><p><strong>Few screenshots:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*MbXZydqcH5EFvn6HznsmuA.png" /><figcaption>Daily Updates</figcaption></figure><blockquote>Setting Daily Updates for Guidance Support</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBH53mPq4Wqhifk8M3-8Ig.png" /><figcaption>Notification for Daily Updates</figcaption></figure><blockquote>Daily Updates Notification</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*h8J1PE3gIyNPX8OCfoCdhw.png" /><figcaption>Google Home response of Guidance System</figcaption></figure><blockquote>Google Home Response for Guidance System</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*b1a3fu2b9W-rMK-hql7BAQ.png" /><figcaption>Wizard System for Vehicles</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*chVOX18PmvhfZdUCZLDmaw.png" /><figcaption>Rich-Response List</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*vY9gZYdhV5KU8F8Qa9mpSg.png" /><figcaption>Wizard-System for Vehicles</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*O4K4Y17bw69MOvl5dbI66g.png" /><figcaption>Basic-Card Emission Response with Button</figcaption></figure><blockquote>Wizard-System for Vehicles Category</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*36rN8uWMX-Lhh57S-JDDqQ.png" /><figcaption>Menu List for all the Categories</figcaption></figure><blockquote>List of all the categories</blockquote><p><strong>Takeaways:</strong></p><p>GSoC is much more than simply coding and meeting the deadlines. Every day getting to learn something new and dope, interacting with the community, learning to handle complex problems, time-management and much more. We get to showcase as well as improve our skillset. And yes! mentor’s feedback is one of the biggest takeaways…</p><p><strong>Availability:</strong></p><p>The changes and new supports will soon be published to Google Actions Store in the coming weeks after which it may be accessible to everyone. For those who’d like to try it now, can head over to the CarbonAssistant-Function repo and follow the deployment documentation to deploy on their own!</p><p><strong>Future Work:</strong></p><p>We can always add more cool features and make the Actions more user-friendly. More comparative responses can be added, these help the user to better internalize the emissions in terms of some other more relatable entity for emission. Along with that, the project will need to be maintained in order to conform to the latest Actions on Google standards.</p><p><strong>We Always Welcome New Contributions:</strong></p><p>Please feel free to file an issue if you encounter any. And contributions are welcome! **May the force be with you**</p><p><strong>A Short Video Describing the Open-Source Experience And Guideline for GSoC Application: </strong><a href="https://www.youtube.com/embed/PTdTZLm53vA"><em>https://www.youtube.com/embed/PTdTZLm53vA</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=433db24c6e14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Eureka Moment]]></title>
            <link>https://medium.com/@siwaniagrawal18/my-eureka-moment-ad9583a3be84?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad9583a3be84</guid>
            <category><![CDATA[never-give-up]]></category>
            <category><![CDATA[gsoc-2019]]></category>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Wed, 19 Jun 2019 16:23:13 GMT</pubDate>
            <atom:updated>2019-06-19T16:23:13.984Z</atom:updated>
            <content:encoded><![CDATA[<p>I am working in a google actions app where we provide the user their carbon-footprint due to various day to day activities. Currently, I am making intents for those activities and providing backend support for a wizard-like experience. Basically making the platform more user-friendly. Well, I find this interesting as I am working on a project whose whole purpose is to bring awareness among the people regarding the carbon emission and global warming. Maybe this was the reason why I’ve chosen this project for GSoC 2019. Every day was a challenge for me, taught me something new, something good and helped me evolve as a developer.</p><p>During the Phase -1 of the project, I had to create lists, make follow-ups, make cool suggestion chips, wizard support, menu support, and a lot more scary stuff. Everything I planned did sound cool and easy in my mind but to implement it and execute the whole thing was a real nightmare, a nightmare in both a good and bad way. We have daily deadlines to meet and the trello app never fails to remind me about it (notifies me in the Gmail, google assistant and trello notification and trust me when you know you are about to fail to meet the deadline this whole trello notification is too annoying). I was working on creating the wizard-support for emissions due to electricity-consumption related queries. We decided to provide the user with GHG emissions in a country due to electricity-consumption in electrical power plants per calendar year. And I was lagging my deadline by a week! because I was stuck! I had no idea how to call the followup intents with suggestion chips or how to decide the sequence and flowchart of the intents and suggest different parameters.</p><p>I was leaving for home, waiting in the refreshment room and cursing the slow internet connectivity, I decided to continue with my “Siwani vs followup-intents” war. I googled, tried and deleted 500 lines of code, created more than 30 intents and finally had my blissfull Eureka moment. Yes, my Eureka moment that too on a waiting room of railway-station! I realized I can’t inter-connect all my intents, I need to have a separate flow for all the possible user choices and trigger the intents and change the life-span accordingly. Finally it worked! after approximately 25200 seconds my google action printed the response card with the GHG emission result. In that very moment, I felt content, happier than I was on seeing my name in the selected students’ list of GSoC 2019. It definitely boosted my confidence and I realized where there is a will there is a way actually not exactly a way but a ray of hope. And where there is Rey there is always a way because the force is always with her. May the force be strong!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad9583a3be84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning React.js with me]]></title>
            <link>https://medium.com/series/learning-react-js-with-me-45bd35f3d4e6?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/45bd35f3d4e6</guid>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 04:08:29 GMT</pubDate>
            <atom:updated>2019-02-20T20:54:21.394Z</atom:updated>
            <content:encoded><![CDATA[<h3>Handling data in React</h3><p>There are two types of data to React: props and state. Don’t worry if you find it a bit confusing. It’ll become easier once you start working with them.</p><p>The key difference is that the state is private and can be changed from within the component itself. Props are external, and not controlled by the component itself. It’s passed down from components higher up the hierarchy, who also control the data.</p><p><strong>A component can change its internal state directly. It can not change its props directly.</strong></p><p>Let’s take a closer look at props first.</p><h3>Props</h3><p>Our Hello component is very static, and it renders out the same message regardless. A big part of React is reusability, meaning the ability to write a component once, and then reuse it in different use cases — for example, to display different messages.</p><p>To achieve this type of reusability, we’ll add props.</p><pre>ReactDOM.render(<br>    &lt;Hello <strong>message=&quot;my friend&quot;</strong> /&gt;, <br>    document.getElementById(&quot;root&quot;)<br>);</pre><p>This prop is called message and has the value “my friend”. We can access this prop inside the Hello component by referencing this.props.message, like this:</p><pre>class Hello extends React.Component {<br>    render() {<br>        return &lt;h1&gt;Hello {<strong>this.props.message</strong>}!&lt;/h1&gt;;<br>    }<br>}</pre><p>As a result, this is rendered on the screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0-2Ct0K3SARZLSwIzgdJw.png" /></figure><p>The reason we’re writing {this.props.message} with curly braces is because we need to tell the JSX that we want to add a JavaScript expression. This is called <strong>escaping</strong><em>.</em></p><p>So now we have a reusable component which can render whatever message we want on the page. YAYYYYY!</p><p>However, what if we want the component to be able to change its own data? Then we have to use state instead!</p><h3>State</h3><p>The other way of storing data in React is in the component’s state. And unlike props — which can’t be changed directly by the component — the state can.</p><p>So if you want the data in your app to change — for example, based on user interactions — it must be stored in a component’s state somewhere in the app.</p><h4>Initializing state</h4><p>To initialize the state, simply set this.state<strong> </strong>in the constructor() method of the class. Our state is an object which in our case only has one key called message.</p><pre>class Hello extends React.Component {<br>    <br>    constructor(){<br>        super();<br>        this.state = {<br>            message: &quot;my friend (from state)!&quot;<br>        };<br>    }<br>    <br>    render() {<br>        return &lt;h1&gt;Hello {this.state.message}!&lt;/h1&gt;;<br>    }<br>}</pre><p>Before we set the state, we have to call super() in the constructor. This is because this is uninitialized before super() has been called.</p><h4>Changing the state</h4><p>To modify the state, simply call <strong>this.setState(),</strong> passing in the new state object as the argument. We’ll do this inside a method which we’ll call updateMessage.</p><pre>class Hello extends React.Component {<br>    <br>    constructor(){<br>        super();<br>        this.state = {<br>            message: &quot;my friend (from state)!&quot;<br>        };<br><strong>        this.updateMessage = this.updateMessage.bind(this);<br></strong>   }</pre><pre><strong>updateMessage() {<br>        this.setState({<br>            message: &quot;my friend (from changed state)!&quot;<br>        });<br>    }</strong></pre><pre>render() {<br>        return &lt;h1&gt;Hello {this.state.message}!&lt;/h1&gt;;<br>    }<br>}</pre><blockquote>Note: To make this work, we also had to bind the <em>this</em> keyword to the <em>updateMessage</em> method. Otherwise we couldn’t have accessed <em>this</em> in the method.</blockquote><p>The next step is to create a button to click on, so that we can trigger the updateMessage() method.</p><p>So let’s add a button to the render() method:</p><pre>render() {<br>  return (<br>     &lt;div&gt;<br>       &lt;h1&gt;Hello {this.state.message}!&lt;/h1&gt;<br>       &lt;button <strong>onClick={this.updateMessage}</strong>&gt;Click me!&lt;/button&gt;<br>     &lt;/div&gt;   <br>  )<br>}</pre><p>Here, we’re hooking an event listener onto the button, listening for the <strong>onClick</strong> event. When this is triggered, we call the <strong>updateMessage</strong> method.</p><p>Here’s the entire component:</p><pre>class Hello extends React.Component {<br>    <br>    constructor(){<br>        super();<br>        this.state = {<br>            message: &quot;my friend (from state)!&quot;<br>        };<br>        this.updateMessage = this.updateMessage.bind(this);<br>    }</pre><pre>updateMessage() {<br>        this.setState({<br>            message: &quot;my friend (from changed state)!&quot;<br>        });<br>    }</pre><pre>render() {<br>         return (<br>           &lt;div&gt;<br>             &lt;h1&gt;Hello {this.state.message}!&lt;/h1&gt;<br>             &lt;button <strong>onClick={this.updateMessage}</strong>&gt;Click me!&lt;/button&gt;<br>           &lt;/div&gt;   <br>        )<br>    }<br>}</pre><p>The <strong>updateMessage</strong> method then calls <strong>this.setState()</strong> which changes the this.state.message value. And when we click the button, here’s how that will play out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1_y0QiLHFcrwKo56C7VWg.png" /></figure><p>Congrats! You now have a very basic understanding of the most important concepts in React.</p><p>JSX is a syntactic extension of JavaScript, you can actually write JavaScript directly within JSX. To do this, you simply include the code you want to be treated as JavaScript within curly braces: { &#39;this is treated as JavaScript code&#39; }. Keep this in mind, since it&#39;s used in several future challenges. However, because JSX is not valid JavaScript, JSX code must be compiled into JavaScript. The transpiler Babel is a popular tool for this process.</p><p>ReactDOM.render(JSX, document.getElementById(&#39;root&#39;)). This function call is what places your JSX into React&#39;s own lightweight representation of the DOM. React then uses snapshots of its own DOM to optimize updating only specific parts of the actual DOM.</p><p>One important thing to know about nested JSX is that it must return a single element. This one parent element would wrap all of the other levels of nested elements. For instance, several JSX elements written as siblings with no parent wrapper element will not transpile.</p><p>Here’s an example:</p><p><strong>Valid JSX:</strong></p><blockquote><em>&lt;div&gt;<br> &lt;p&gt;Paragraph One&lt;/p&gt;<br> &lt;p&gt;Paragraph Two&lt;/p&gt;<br> &lt;p&gt;Paragraph Three&lt;/p&gt;<br>&lt;/div&gt;</em></blockquote><p><strong>Invalid JSX:</strong></p><blockquote><em>&lt;p&gt;Paragraph One&lt;/p&gt;<br>&lt;p&gt;Paragraph Two&lt;/p&gt;<br>&lt;p&gt;Paragraph Three&lt;/p&gt;</em></blockquote><p>JSX differs from HTML in a key way with the use of classNamevs. classfor defining HTML classes. The class name is in camelCase in JSX unlike HTML.</p><p>Another important way in which JSX differs from HTML is in the idea of the self-closing tag. In HTML, almost all tags have both an opening and closing tag: &lt;div&gt;&lt;/div&gt;; the closing tag always has a forward slash before the tag name that you are closing. However, there are special instances in HTML called “self-closing tags”, or tags that don’t require both an opening and closing tag before another tag can start.</p><p>For example the line-break tag can be written as &lt;br&gt;or as &lt;br /&gt;, but should never be written as &lt;br&gt;&lt;/br&gt;, since it doesn&#39;t contain any content.</p><p>In JSX, the rules are a little different. Any JSX element can be written with a self-closing tag, and every element must be closed. The line-break tag, for example, must always be written as &lt;br /&gt;in order to be valid JSX that can be transpiled. A &lt;div&gt;, on the other hand, can be written as &lt;div /&gt;or &lt;div&gt;&lt;/div&gt;.</p><h3>React: Create a Stateless Functional Component</h3><p>Components are the core of React. Everything in React is a component and here you will learn how to create one.</p><p>There are two ways to create a React component. The first way is to use a JavaScript function. Defining a component in this way creates a <em>stateless functional component</em>. For now, think of a stateless component as one that can receive data and render it, but does not manage or track changes to that data.</p><p>To create a component with a function, you simply write a JavaScript function that returns either JSX or null. One important thing to note is that React requires your function name to begin with a capital letter. Here&#39;s an example of a stateless functional component that assigns an HTML class in JSX:</p><p><strong><em>// After being transpiled, the &lt;div&gt; will have a CSS class of ‘customClass’<br>const DemoComponent = function() {<br> return (<br> &lt;div className=’customClass’ /&gt;<br> );<br>};</em></strong></p><p>Because a JSX component represents HTML, you could put several components together to create a more complex HTML page. This is one of the key advantages of the component architecture React provides. It allows you to compose your UI from many separate, isolated components. This makes it easier to build and maintain complex user interfaces.</p><h3>React: Create a React Component</h3><p>The other way to define a React component is with the ES6 classsyntax. In the following example, Kittenextends React.Component:</p><p><strong><em>class Kitten extends React.Component {<br> constructor(props) {<br> super(props);<br> }</em></strong></p><p><strong><em>render() {<br> return (<br> &lt;h1&gt;Hi&lt;/h1&gt;<br> );<br> }<br>}</em></strong></p><p>This creates an ES6 class Kittenwhich extends the React.Componentclass. So the Kittenclass now has access to many useful React features.</p><p>Also notice the Kittenclass has a constructordefined within it that calls super(). It uses super()to call the constructor of the parent class, in this case React.Component. The constructor is a special method used during the initialization of objects that are created with the classkeyword. It is best practice to call a component&#39;s constructorwith super, and pass propsto both.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45bd35f3d4e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first experience with hackathons:-]]></title>
            <link>https://medium.com/zairza/my-first-experience-with-hackathons-e70f14b08289?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e70f14b08289</guid>
            <category><![CDATA[hackathons]]></category>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 11:23:35 GMT</pubDate>
            <atom:updated>2018-08-28T11:23:35.907Z</atom:updated>
            <content:encoded><![CDATA[<p>At the start of the session, I decided to attend a hackathon because it is something I have been wanting to do for a long time. The chance to meet and work with a bunch of talented people was really exciting. We learn how to pitch a great new tech idea,and how to team build that concept in a short period of time. These ideas often turn into marketable products, and a number of successful products and companies have started at hackathons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iq0X9uQkmPsPHCGeNobD5w.jpeg" /></figure><p>For my first hackathon ever, I decided to attend GenHax, organized by Invincix, in Bhubaneswar. There were 3 of us that created team House Stark. Including team House Stark there were 9 teams, who made it to the final round.</p><h4>And it begins…</h4><p>The teams arrived in the building of Invincix and were welcomed by the volunteers and representatives. It was the friendly and colorful environment there which attracted our attention. Each team had to choose one of the three given problem statements:-</p><ul><li>Waste management</li><li>Medical emergency</li><li>Culture and heritage</li></ul><p>It started with a brainstorming session, our team decided to work on waste management and played many roles throughout the next 24 hours.</p><h4>Our vision…</h4><p>The vision of House Stark was to create a simple web app which will facilitate the user to post or share the location and pictures of the garbage or waste materials. The user then gets the liberty to decide whether he wants to recycle the waste by himself or he wants to sell it to the buyer. Buyers are the local industries or individuals who will be using this waste as raw material.</p><p>By this, we aimed to minimize the amount of waste being dumped in the dump-yards every month and we tried to provide a portal which will facilitate the waste management more efficiently.</p><h4>Strategy…</h4><p>We had one person focus on Node-js and MongoDB completely and the both of us working with UI. I had developed many websites before but most of the responsibilities dealt with the front-end of the site. I was working with HTML, CSS and Bootstrap. I had to create the login, sign-up, timeline and score pages. My teammates gave me a high-level overview of the technologies I would be working with. This gave me an understanding of how I can accomplish my task for House Stark.</p><h4>Trouble arises…</h4><p>It was about 2:00 AM when we realized we have spent too much time on little details and not enough time on a minimum viable demo. We had attempted to add too many features. It started to get too late and none of us had started to merge our code together. It was 5:30 AM in the morning when we had merged all our codes together. Finally, there was a sign of relief in our faces.</p><h4>The final hour…</h4><p>We presented a working demo along with a power point presentation. The results were announced and team House Stark was lifting the winning cup. The sleepless night, liters of coffee and the hard work paid off. It was a fantastic experience for the participants and the observers.</p><blockquote>Hackathons help us in building a better portfolio, boosting confidence, gaining teamwork experience, ideation pitching and improving our communication skills.</blockquote><h4>Some tips…</h4><ul><li>Don’t be scared to register as an individual and then join a team. Most hackathons have a team formation room for people to join teams after checking in.</li><li>Always opt for healthy snacks. Hackathons take a lot of energy, both mentally and physically, so the best thing we can do for our body is to fuel it properly.</li><li>Ask for help, ask for help and yes, ask for help. Hackathons give us access to individuals with years of experience across many different fields and areas. Be sure to take advantage of it.</li><li>Hackathons are fantastic opportunity to learn new skills, sharpen existing ones and meet people in the industry.</li><li>Talk with other teams. Hackathons are so much more than a competition.</li><li>Even if you are not in the job seeking mode, it’s important to build a good networking with the sponsors.</li><li>Always value the experience, don’t panic if the project doesn’t work out.</li></ul><p>It is a must have experience. Looking forward to my next hackathon experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e70f14b08289" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zairza/my-first-experience-with-hackathons-e70f14b08289">My first experience with hackathons:-</a> was originally published in <a href="https://medium.com/zairza">Zairza</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first experience with hackathons:-]]></title>
            <link>https://medium.com/zairza/my-first-experience-with-hackathons-983fa4606ba0?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/983fa4606ba0</guid>
            <category><![CDATA[hackathons]]></category>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Mon, 27 Aug 2018 19:44:03 GMT</pubDate>
            <atom:updated>2018-08-27T19:44:03.949Z</atom:updated>
            <content:encoded><![CDATA[<p>At the start of the session, I decided to attend a hackathon because it is something I have been wanting to do for a long time. The chance to meet and work with a bunch of talented people was really exciting. We learn how to pitch a great new tech idea,and how to team build that concept in a short period of time. These ideas often turn into marketable products, and a number of successful products and companies have started at hackathons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iq0X9uQkmPsPHCGeNobD5w.jpeg" /></figure><p>For my first hackathon ever, I decided to attend GenHax, organized by Invincix, in Bhubaneswar. There were 3 of us that created team House Stark. Including team House Stark there were 9 teams, who made it to the final round.</p><h4>And it begins…</h4><p>The teams arrived in the building of Invincix and were welcomed by the volunteers and representatives. It was the friendly and colorful environment there which attracted our attention. Each team had to choose one of the three given problem statements:-</p><ul><li>Waste management</li><li>Medical emergency</li><li>Culture and heritage</li></ul><p>It started with a brainstorming session, our team decided to work on waste management and played many roles throughout the next 24 hours.</p><h4>Our vision…</h4><p>The vision of House Stark was to create a simple web app which will facilitate the user to post or share the location and pictures of the garbage or waste materials. The user then gets the liberty to decide whether he wants to recycle the waste by himself or he wants to sell it to the buyer. Buyers are the local industries or individuals who will be using this waste as raw material.</p><p>By this, we aimed to minimize the amount of waste being dumped in the dump-yards every month and we tried to provide a portal which will facilitate the waste management more efficiently.</p><h4>Strategy…</h4><p>We had one person focus on Node-js and MongoDB completely and the both of us working with UI. I had developed many websites before but most of the responsibilities dealt with the front-end of the site. I was working with HTML, CSS and Bootstrap. I had to create the login, sign-up, timeline and score pages. My teammates gave me a high-level overview of the technologies I would be working with. This gave me an understanding of how I can accomplish my task for House Stark.</p><h4>Trouble arises…</h4><p>It was about 2:00 AM when we realized we have spent too much time on little details and not enough time on a minimum viable demo. We had attempted to add too many features. It started to get too late and none of us had started to merge our code together. It was 5:30 AM in the morning when we had merged all our codes together. Finally, there was a sign of relief in our faces.</p><h4>The final hour…</h4><p>We presented a working demo along with a power point presentation. The results were announced and team House Stark was lifting the winning cup. The sleepless night, liters of coffee and the hard work paid off. It was a fantastic experience for the participants and the observers.</p><blockquote>Hackathons help us in building a better portfolio, boosting confidence, gaining teamwork experience, ideation pitching and improving our communication skills.</blockquote><h4>Some tips…</h4><ul><li>Don’t be scared to register as an individual and then join a team. Most hackathons have a team formation room for people to join teams after checking in.</li><li>Always opt for healthy snacks. Hackathons take a lot of energy, both mentally and physically, so the best thing we can do for our body is to fuel it properly.</li><li>Ask for help, ask for help and yes, ask for help. Hackathons give us access to individuals with years of experience across many different fields and areas. Be sure to take advantage of it.</li><li>Hackathons are fantastic opportunity to learn new skills, sharpen existing ones and meet people in the industry.</li><li>Talk with other teams. Hackathons are so much more than a competition.</li><li>Even if you are not in the job seeking mode, it’s important to build a good networking with the sponsors.</li><li>Always value the experience, don’t panic if the project doesn’t work out.</li></ul><p>It is a must have experience. Looking forward to my next hackathon experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=983fa4606ba0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zairza/my-first-experience-with-hackathons-983fa4606ba0">My first experience with hackathons:-</a> was originally published in <a href="https://medium.com/zairza">Zairza</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to basic routing with Express and Node.js :-]]></title>
            <link>https://medium.com/@siwaniagrawal18/guide-to-basic-routing-dbf21510d1a4?source=rss-52dba56a052b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbf21510d1a4</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[siwani agrawal]]></dc:creator>
            <pubDate>Thu, 23 Aug 2018 18:55:35 GMT</pubDate>
            <atom:updated>2018-08-24T16:57:40.325Z</atom:updated>
            <content:encoded><![CDATA[<p>Node is an open-source platform, cross-platform, runtime environment that allows developers to create all kinds of server-side tools and applications in JavaScript.</p><p>Express is the most popular Node web framework. It provides mechanism to:-</p><ul><li>Write handlers for requests.</li><li>Integrate with “view” rendering engines in order to generate responses.</li><li>Set common web application settings like the port to use for connecting.</li><li>Add additional request processing middleware at any point within the request handling pipeline.</li></ul><p>Routing refers to determining how an application responds to a client request to a particular endpoint, which is a specific HTTP request method (GET, POST, and so on).</p><p>The structure of a route definition is:-</p><p>app. METHOD(PATH, HANDLER)</p><p>Where:-</p><ul><li>App is an instance of express.</li><li>METHOD is an HTTP request method, in lowercase.</li><li>PATH is a path on the server</li><li>HANDLER is the function executed when the route is matched.</li></ul><p>The following examples will illustrate defining simple routes.</p><ol><li>Respond with Hello World on the home page.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SoCdwJHO59mMAoE-xTgFg.jpeg" /></figure><p>2. Respond to Post request on the root route (/), the application’s home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5CGVksfqm2Jr8kaeX4zKsg.jpeg" /></figure><p>3. Reapond to a DELETE request to /user route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5s3uliIx0U37kj8zhHjTxQ.jpeg" /></figure><p>4. Respond to a PUT request to the /user route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-473p7FgahyMDaa9qCXeQ.jpeg" /></figure><p>For more details on routing, visit the page:- <a href="http://expressjs.com/en/guide/routing.html">http://expressjs.com/en/guide/routing.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbf21510d1a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>