<?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 Himanshu Nag on Medium]]></title>
        <description><![CDATA[Stories by Himanshu Nag on Medium]]></description>
        <link>https://medium.com/@himanshunag?source=rss-b0c167dd3b76------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tpGzedeHYkfX8A3jDf-wgw.jpeg</url>
            <title>Stories by Himanshu Nag on Medium</title>
            <link>https://medium.com/@himanshunag?source=rss-b0c167dd3b76------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:52:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@himanshunag/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[Design Principles for XR]]></title>
            <link>https://medium.com/@himanshunag/design-principles-for-xr-28e2aa31ea62?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/28e2aa31ea62</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[ar]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[metaverse]]></category>
            <category><![CDATA[vr]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 06:13:36 GMT</pubDate>
            <atom:updated>2022-09-02T06:13:36.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73L9bmcytEe6s6-hdBsNuQ.png" /><figcaption>Image credit: Softengi</figcaption></figure><p>Future tech brings futuristic experience, but an uncomfortable user</p><p>experience will ruin the immersive-ness of <strong>Extended Reality</strong> and hinder</p><p>the motive of the application. To bring the best of <strong>Extended Reality</strong>,</p><p>design requires some principles and guidelines. These principles and</p><p>guidelines help in creating a safe and comfortable experience for the</p><p>end-user. During the past 5 years working on <strong><em>AR, VR and MR</em></strong></p><p>experiences, I have learned a lot from feedback that I have received</p><p>from clients and summed up a few important principles that will</p><p>provide a better user experience for your <strong>XR</strong> application.</p><h3>Environment Interaction</h3><p>Keeping virtual objects in your virtual environment makes your</p><p>application aesthetically pleasing, which brings more options to</p><p>explore, but objects without interaction will waste the efforts involved</p><p>in design and development. Featured <strong>VR games</strong> always make sure to</p><p>provide interaction with virtual objects although it’s not part of the</p><p>level design. For example, a drill machine in the virtual world will not</p><p>help the user to move ahead in the game, but he can pick it up and</p><p>drop it anywhere in the ground. It helps the user to feel the same</p><p>physics in the virtual world as he was experiencing in the real world.</p><p>The immersive experience can only be achieved when the user feels the</p><p>same in both the worlds.</p><h3>UI Visibility</h3><p><strong>UI</strong> provides important information and interactions, and good design</p><p>can help the user to feel safe in a virtual environment. Make sure you</p><p>tag the objects with their priority during the game design phase. If the</p><p>object or information plays an important role, make sure you bring the</p><p>focus of the user towards information or object. Most <strong>VR</strong> games blurs</p><p>the background and outline the object or information, this helps in</p><p>showing the importance of the object or information.</p><p>On-Screen Ul should be minimal for user to focus on the environment</p><p>rather than UI. Sometimes <strong>VR, AR and MR</strong> games and applications require a button click to open menu and Ul panels, which helps in</p><p>providing Ul free screen in the virtual world.</p><h3>Design Flow</h3><p><strong>VR</strong> games should always be restricted to a certain time limit as</p><p>suggested by health experts. Keeping a good design flow will help the</p><p>user to stay focused on the motive of the application. On the other</p><p>hand, a bad design will hinder the path of the level design and waste</p><p>the time of the user which will end up in a bad experience. Level design</p><p>should always guide the user about the flow and reward, and</p><p>environment should be restricted to a certain space. Keeping design</p><p>minimal helps in creating more focused and user-friendly experiences</p><h3>Knowledge about Interaction</h3><p>Dynamic <strong>XR experience </strong>gains more appreciation on comparing with a</p><p>static XR experience. Building a dynamic experience requires</p><p>developers and designers to integrate interactions. A guided experience</p><p>will help the user to explore more as he is aware of his tools. Briefing</p><p>about interaction is a standard procedure in general applications, but in</p><p><strong>XR space</strong>, the user needs to experience the interaction. It is always</p><p>suggested to provide practical guidance about the interaction rather</p><p>then briefing. For example, picking up an object can be briefed in a few</p><p>lines on a Ul panel, but user might ignore the fact. Asking the user to</p><p>pick up the object with guidance on how to do it will help the user to</p><p>understand better.</p><h3>Virtual Environment Color Scheme</h3><p>In the real world, colors are always calm and soothing to the eyes, and</p><p>the same pattern should be followed while creating a virtual</p><p>environment. There is always an exception to this principle with with</p><p>virtual space.</p><h3>Conclusion</h3><p><strong>XR experiences</strong> is a future solution and defining standard principles on</p><p>designs at an early stage will cut down innovation. Following these</p><p>design principles and guides will definitely help you to create a safe and</p><p>comfortable environment but if it restricts your unique ideas, then you</p><p>can always ignore them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28e2aa31ea62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SearchBar in Swift iOS (Source Code)]]></title>
            <link>https://medium.com/@himanshunag/searchbar-in-swift-ios-14e66d8ce29d?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/14e66d8ce29d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[searchbar]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 08:52:29 GMT</pubDate>
            <atom:updated>2022-08-17T09:01:54.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*KPmZM5WeEeSynN4kvVADdQ.jpeg" /><figcaption>SearchBar Example</figcaption></figure><p><strong>Search bar</strong> helps in making our lives lots easier by providing the relevant information we desire using keywords. Search bar is a component used in web, iOS, android, and many more technologies.</p><blockquote>A search bar is a specialised view for receiving search-related information from the user.</blockquote><p>In Swift, we use <a href="https://developer.apple.com/documentation/uikit/uisearchbardelegate"><strong>UISearchBarDelegate</strong></a> to pull information from <a href="https://developer.apple.com/documentation/uikit/uisearchtextfield"><strong>UISearchTextField</strong></a><strong> </strong>and generate <a href="https://developer.apple.com/documentation/uikit/uisearchtoken"><strong>UISearchTokens</strong></a>. Search Bar can have different appearance using the proxy <strong><em>UISearchBar appearance</em></strong>.</p><h3>Let’s Create a Simple SearchBar in Swift</h3><ol><li>Open an empty <strong>Xcode</strong> project. Select <strong><em>storyboard</em></strong> as <strong>interface</strong> and <strong>Swift</strong> as <strong><em>language</em></strong>.</li><li>Open the component library and add <strong>Searchbar</strong> component in the default <strong>View Controller</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGokOaP3-NNxKy4TJxanbQ.png" /><figcaption>fig. 1.1</figcaption></figure><p>3. Now, add constraints on top, right and left as 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5usJu9lVcYgim7fw3da7A.png" /><figcaption>fig. 1.2</figcaption></figure><p>4. Open the component library again and add <strong>Table View</strong> in the <strong>Main View Controller</strong>. We will filtering the <strong>Table View</strong> data using <strong>Search Bar</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKJavrOu80eaxArRHsYXQg.png" /><figcaption>fig. 1.3</figcaption></figure><p>5. Add 0 constraints to all four corner of the <strong>Table View</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qa1um9OzCAuRc6WMndIu6w.png" /><figcaption>fig. 1.4</figcaption></figure><p>6. Now, click on <strong>view option</strong> below <strong>component library</strong> and select <strong>Assistant</strong>. This option will divide the screen in two halves, one with <strong>Main View</strong> and other with the <strong>ViewController</strong> Script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FX7zBJ4Zhywi3IyKXNGqQQ.png" /><figcaption>fig. 1.5</figcaption></figure><p>7. Now, Drag and drop <strong>TableView</strong> that you added in <strong>step 4</strong> in the <strong>ViewController</strong> Script and name it <strong>tableView</strong>. Perform the same with <strong>Search Bar</strong> and name it <strong>searchBar</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExmvGDdL3jvbiuAC8mOhuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*p9SIlc-EH83s3gVGbnFBdg.png" /><figcaption>fig. 1.6</figcaption></figure><p>8. Select <strong>Table View</strong> and add <strong>1</strong> cell in the properties in the Right side bar. Then select <strong>Table View Cell </strong>and add ‘<strong>cell</strong>’ as <strong>identifier</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UeibtRPaaP45FBm_eVDCvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xst9a2C98wVd4Eilws6maw.png" /><figcaption>fig. 1.7</figcaption></figure><p>9. You are almost done, Open <strong>View Controlle</strong>r script and add the code given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xs15SYn3vzCRgFAVuVk2Yw.png" /><figcaption>fig. 1.8</figcaption></figure><p>10. Hit the build button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*DZt1dXgKHDAoYZxG-0Mpvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*1Qi2DmZpvJUvU9y_t6A75Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*TM5X1RSaq4QoCKpkKG8H5A.png" /><figcaption>fig. 1.9</figcaption></figure><h3>Conclusion</h3><p><strong>Search Bar</strong> is very useful if you are displaying a lot of data, it eases the complicated scroll and find. Most app use to categories their data to simplify the search but uses a search bar to find relevant information from the entire database.</p><h3>What’s next</h3><p><strong>Search bar delegate</strong> is all you need, in the above example, we used in an offline <strong>Table View</strong>. To make it more complex, try searching data from online database using <strong>API</strong> and list them in <strong>Collection View</strong>.</p><h3><strong>Source Code</strong></h3><p>Source code is available on <a href="https://github.com/himanshu-nag/SearchBar_Swift_Tutorial"><strong><em>Github</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14e66d8ce29d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CollectionView in Swift for iOS devices]]></title>
            <link>https://medium.com/@himanshunag/collectionview-in-swift-for-ios-devices-a59d6b834170?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/a59d6b834170</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Tue, 16 Aug 2022 20:34:20 GMT</pubDate>
            <atom:updated>2022-08-16T20:34:20.426Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*eSba1hu-Xv9GLV7GBHfHYg.png" /><figcaption>Example of CollectionView</figcaption></figure><p>You often see multiple click or view tiles in different sizes while using an app. In <strong><em>Swift, </em></strong>they are achieved using <a href="https://developer.apple.com/documentation/uikit/uicollectionview"><strong>CollectionView</strong></a><strong>.</strong></p><blockquote><strong>CollectionView is a view in <em>Swift</em>, which hold the data source in cells in a customisable layout.</strong></blockquote><p><strong>CollectionView</strong> can consist multiple views and objects in customisable layout.</p><p><strong>CollectionView</strong> consist of supplementary views and cells.</p><p><strong>CollectionView</strong> consist of a subclass <a href="https://developer.apple.com/documentation/uikit/uicollectionviewlayout"><strong><em>UICollectionViewLyout</em></strong></a> class which defines the organisation and location of cells and supplementary views.</p><h3><strong>Let’s create a CollectionView</strong></h3><ol><li>Open an empty project in <strong>Xcode</strong>, and use storyboard for defining UI.</li><li>Now, click on <strong>Main</strong> storyboard to view your storyboard where we’ll be adding our <strong>CollectionView</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*cEmTKocxskZHV-KvEqFsYQ.png" /><figcaption>fig.1.1</figcaption></figure><p>3. Now, click on the <strong>+</strong> icon on the top right corner to open Library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*SUhJJU1KGKv-HRydsZSjnQ.png" /><figcaption>fig. 1.2</figcaption></figure><p>4. Search “Collection View” in the search bar and drag and drop the <strong>CollectionView</strong> from the Library to the <strong>Main View Controller</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*QXlTLyLlTPUvbpbnghpo0Q.png" /><figcaption>fig. 1.3</figcaption></figure><p>5. Select the CollectionView which you just dropped on the Main Controller View and click on the <strong>add constraints </strong>on<strong> </strong>right bottom and add 0 to all the four corners of the constraints. Then click <strong>Add 4 Constraints</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*ybgQ6YMqBIjlx_m5Xy6m8w.png" /><figcaption>fig. 1.4</figcaption></figure><p>6. Once you have added the <strong>CollectionView</strong> in the <strong>Main View Controller</strong>, now it’s time to attach <strong>CocoaTouch</strong> class script. To create new class, press and hold <strong>cmd</strong> + <strong>N</strong>. From the tab, select <strong>Cocoa Touch</strong> class and select <strong>UICollectionViewCell </strong>from the dropdown in the next tab and hit next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*JQOkqVtN_HrJ7B5VyY4tDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*jzl0OW8gfW_dXmFTQCy7Tw.png" /><figcaption>fig. 1.5</figcaption></figure><p>7. Now, select <strong>Collection View</strong> form the side and do a right click and drag and drop to the <strong>Main View Controller</strong> head, from the pop up, select <strong>dataSource</strong>.</p><p>Do the same once again and select <strong>delegate</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*j8j90l-Kdk3Dla6S4CujLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*DecnE9Lkw6S8wp1-g-RIJQ.png" /><figcaption>fig. 1.6</figcaption></figure><p>8. Select Collection View Cell from the sidebar and on the right side bar, select the <strong>Identity Inspector</strong>. The click the dropdown to select class, and select <strong>CollectionViewCell class </strong>which<strong> </strong>we created in the 6th step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*WWiqRrD-anl2uR1hbcNRxQ.png" /><figcaption>fig. 1.7</figcaption></figure><p>9. Now, select <strong>Attribute inspector</strong> and type “Cell” in the <strong>Identifier</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*hrUeeU9mQDjLo-pBwO2bqQ.png" /><figcaption>fig. 1.8</figcaption></figure><p>10. <strong><em>NOTE: In this example we’ll be adding data using a label which will be an integer of the cell count.</em></strong></p><p>To achieve this, perform the <strong>3rd step</strong> and add <strong>Label</strong> in the centre of the <strong>CollectionView Cell</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*oSIkAe8_OPGAjwkibdTa3A.png" /><figcaption>fig. 1.9</figcaption></figure><p>11. Now, click on <strong>Add editor on the right </strong>just below <strong>+</strong> icon and select <strong>CollectionViewCell</strong> script from left sidebar. Drag Label and drop it <strong>CollectionViewCell</strong> script and name it ‘label’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9scTZRVIrlrDs9y0fp21-A.png" /><figcaption>fig. 1.10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ihmaklXzUDXx9j2XFDU4Vg.png" /><figcaption>fig. 1.11</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*SqhrWnAYV4cYvT17kq96bw.png" /><figcaption>fig. 1.12</figcaption></figure><p>12. Do the 11th same with ViewController script and CollectionView.</p><p>13. Now, open ViewController Script and the given code.</p><pre><strong>import</strong> UIKit</pre><pre><strong>class</strong> ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> collectionView: UICollectionView!</pre><pre><strong>func</strong> collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {</pre><pre>// Access</pre><pre><strong>let</strong> cell = collectionView.dequeueReusableCell(withReuseIdentifier: &quot;Cell&quot;, for: indexPath) <strong>as</strong>! CollectionViewCell</pre><pre>// Do any custom modifications you your cell, referencing the outlets you defined in the Custom cell file.</pre><pre>cell.label.text = &quot;item \(indexPath.item)&quot;</pre><pre><strong>return</strong> cell</pre><pre>}</pre><pre><strong>func</strong> collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {</pre><pre>// Set the number of items in your collection view.</pre><pre><strong>return</strong> 200</pre><pre>}</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>collectionView.delegate = <strong>self</strong></pre><pre>collectionView.dataSource = <strong>self</strong></pre><pre>}</pre><pre>}</pre><p>14. Now hit build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*UUqllkg5K5OLjW23arJwww.png" /><figcaption>fig. 1.14</figcaption></figure><h3><strong>Conclusion</strong></h3><p><strong>Collection View</strong> is a great way to make your application more aesthetic, it bring more features in one single view. It is great component which goes with retail, ed-tech, entertainment apps.</p><h3>What’s next</h3><p><strong>Collection View</strong> can be integrated in other views or can itself be a view using <strong>Collection View Controller</strong>. To bring more complexity, some apps have multiple other view like <strong>tableview</strong>, frame view integrated inside c<strong>ollection view controller</strong>. Try integrating more than table view inside <strong>Collection View Controller</strong> to understand the complex <strong>cell- to-view</strong> integration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a59d6b834170" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hover to Expand Search Bar in Html/CSS]]></title>
            <link>https://medium.com/@himanshunag/hover-to-expand-search-bar-in-html-css-d8a55e7762ca?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8a55e7762ca</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Wed, 18 May 2022 12:15:49 GMT</pubDate>
            <atom:updated>2022-05-18T12:39:21.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*0pmDZeXQ24t1bI0KNtes9A.gif" /><figcaption>Hover to Expand Search Bar in Html/CSS</figcaption></figure><p>Search bar are getting fancy day by day. Here is one minimalistic design that I learned to develop suing Html &amp; CSS. I would like to give credits for my learning on this topic to <a href="https://medium.com/u/5dadcb222f5b">Muj</a> &amp; @frontendcharm.</p><blockquote><strong>You can use the code given below or use </strong><a href="https://jsfiddle.net/s6rcyb0u/1/"><strong>JSFiddle Code-Playground</strong></a></blockquote><h3><strong>HTML Script</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*APC7RYDCNV1Zp3bIMQa-Wg.png" /></figure><h3>CSS Script</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ymUpmCrFmgduiXLb4fNIsA.png" /></figure><p>Developing Html/CSS is something I’m new-to. I will posting more Html/CSS content soon, till then share your views &amp; quarries in the comment, and make sure to give this post a clap.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8a55e7762ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No more If-else…]]></title>
            <link>https://medium.com/@himanshunag/no-more-if-else-65d462d144b4?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/65d462d144b4</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dictionary]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Wed, 18 May 2022 10:41:05 GMT</pubDate>
            <atom:updated>2022-05-18T10:41:05.389Z</atom:updated>
            <content:encoded><![CDATA[<p>For a fact, every data structure is an optimised if-else, but when you write it as a code block, it looks silly and not professional.</p><p>Reason behind this thought is un-organised &amp; in-efficient statements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvERA3RdlqwgR8yv8UfvWg.png" /></figure><p>If someone wants to use your feature, he will read each and every statement to know about workflow, but and organised work can save some time and more importantly it looks beautiful, and beautiful code can impress anyone.</p><p>Well, one work-arounds for if-else which can help you.</p><h3>Dictionary</h3><blockquote><strong>The </strong><strong>Dictionary&lt;TKey, TValue&gt; is a generic collection that stores key-value pairs in no particular order.</strong></blockquote><p>Dictionary lets you organise your data by binding a map with data and key.</p><p>Dictionary has average time complexity of O(1).</p><p>Dictionary can be implemented using the keyword <strong>Dictionary&lt;key, value&gt;</strong>, the <strong>Dictionary&lt;key, value&gt;</strong> object passes the type of keys and values it can store.</p><p>Dictionary lets you maintain hash-map.</p><p>Above code can be structured with dictionary in the following way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVaGI54WjgW9iOYJW2B1pw.png" /></figure><p>Dictionaries are very helpful. You can even get a boolean for existence of key or value. While developing games, dictionaries are used for keeping weapons data, inventory data, NPC data etc.</p><blockquote>Hash-set can also be as an alternate to Dictionary which is far more efficient.</blockquote><p>Dictionary hierarchy can be explained below (image courtesy: <strong><em>tutorialsteacher</em></strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*jOkIMyv8LN_DaFmirEIqeg.png" /></figure><p>To know more about Dictionary, you can visit <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-6.0"><strong><em>Microsoft Document</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65d462d144b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginners guide to Amazon Alexa Skill Set]]></title>
            <link>https://medium.com/@himanshunag/beginners-guide-to-amazon-alexa-skill-set-7dca2aacad0c?source=rss-b0c167dd3b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dca2aacad0c</guid>
            <category><![CDATA[alexa]]></category>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[develop]]></category>
            <dc:creator><![CDATA[Himanshu Nag]]></dc:creator>
            <pubDate>Thu, 15 Mar 2018 20:15:53 GMT</pubDate>
            <atom:updated>2018-03-15T20:29:03.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*j9P-CNC3byKiVsggOTXFFg.jpeg" /></figure><p>Alexa ,“your friendly AI assistant” does dozens of jobs for you improving your day-to-day life and making it more efficient. You must have came across a lot of Alexa applications where your mind contemplate about whats going on behind the scene. Well developing an amazon Alexa application does not require you be a computer wizard at very basic, though there are highly complicated applications which we will pass. We are talking about something like “Alexa tell me a fact” skill. Basic function this skill performs is you ask Alexa to tells you a fact and Alexa does, Simple. Remember this is just a basic skill set but there are dozens of API to work with, you just need some coding skills, practice and passion.</p><p>So we’ll start with what actually happens behind the curtains.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*2TLva2e_cMp0iB4GXezhWw.png" /></figure><p>This is how it works. You ask Alexa to do something where Alexa Voice Service takes it the Alexa Skill Kit which contains Intents and Utterance sand invokes AWS Lambda where your functions are been called and the AWS Lambda executes the function and send back the output which is your response.</p><p>So we start with making developers account in <a href="https://developer.amazon.com/alexa">Amazon Alexa console</a> and <a href="https://aws.amazon.com/">Amazon AWS</a>. Amazon AWS will ask you to setup payment service, which you have to do but they give some 75 GB of free Lambda storage so you don’t have to pay anything.</p><p>Next Step</p><p>Go to Alexa developers console, click on Apps and services and then Alexa Skill Kit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXz1TXMWHQAazoFaEKss6A.png" /></figure><p>After that click on a blue colored button which says “Start Skill”, and then click on create skill.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-eYB9gocOXv22sVpDSaQuw.png" /></figure><p>Give a name to your skill and hit next, then choose Custom and press select.</p><p>Now, you will be seeing something this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1dAl3SRawvLzwIBWV4knA.png" /></figure><p>Not exactly like this, so don’t worry. If not then see if some where it says Build on new console, if you find it then click on it and proceed to next step.</p><p>Now you will Click on Invocation and give your skill a invocation name. Read the requirements at the very bottom. Invocation name will the name through which user will invoke your skill, for example “Alexa, ask (Invocation name) to (Utterance)”.</p><p>Next Step</p><p>On the left side panel you can see “Intents” which will have an option to “Add”. It consist of 3 mandatory intents, those are Amazon.CancelIntent, Amazon.HelpIntent and Amazon.StopIntent. Now you need to click on that ADD button and add your intent. Remember the name you give to your intent, exact name will be called from your AWS Lambda function in the later steps.</p><p>After naming it, click on Create custom intent button.</p><p>Now you might be seeing something like the above image. Now you have Utterance which is what user will say to activate your AWS Lambda function. For example “give me a face” or “tell me a fact”, Write at least 3 Utterance. Now click on “save model” and then click on “Build model”.</p><p>Next Step</p><p>Now, on a different tab, login to your AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*03GwBL0NLzZp6aZADycTRw.png" /></figure><p>You will see something like the above image. Search and select Lambda. You will find an orange colored button which says “Create function”, click and proceed. Now first select N. Virginia from top right corner as your location because currently alexa supports this region only. now next step, name your function in the syntax, Example “myFactGame”.</p><p>By default Runtime will be on Nodejs 6.10, if not scroll through the list and select it. Now it will ask you to select role, Select “create a custom role” which take take to a new tab where you need to select “Lambda basic execution” in IAM role and “on_click_lambda_basic_execution_(some numbers)” and at the very bottom click “allow”. back to AWS function page with existing role selected as “Lambda basic execution”. Now click create function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*lsaBpovq4p1ozGaFX74cIA.png" /></figure><p>Now you will see something like this. Select Alexa skill kit from Add triggers. Don’t worry about the amazon SNS, what instead you will be seeing is just amazon CloudWatch. Now what you need to do is click on Alexa skill kit which you just added from trigger. Go back to your Alexa skill kit tab. Now this step has an easy way but i din’t figure out so you have to go this way, Check your URL “https://developer.amazon.com/alexa/console/ask/build/custom/( COPY THIS PART )/development/en_US/dashboard”.</p><p>Copy that part and go back to your AWS tab. at the bottom you will alexa skill id, paste it and save it.</p><p>Next Step</p><p>Now comes the coding part. Click on your lambda function which looks like the below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*2fuhd_daVsw2F-fe_FNwcw.png" /></figure><p>and inline code editor will appear.</p><p>Now, i have created a gist on github from where you can copy the code. Click on this <a href="https://gist.github.com/himanshu-nag/49c0ed1fd91e53b28213375021900d95">link</a>.</p><p>Few things to follow.</p><ol><li>const APP_ID = ‘’; //Here paste your skill id which we copied from alexa page URL and paste it inside ‘’. Example const APP_ID = ‘amzn1.ask.skill.31c2xa1cf-2d9d-43a3-b414-f551a871432c4’.</li><li>const SKILL_NAME = ‘’;//Name your skill. For example const SKILL_NAME = ‘fact game’;</li><li>const data = [ ‘Sri Lanka has a sole Test win against the Aussies till date.’, ‘Sanath Jayasuriya has more ODI wickets than Shane Warne.’, ];//This includes facts about cricket. You can put whatever you want inside ‘’ and you can also add more by simply adding- ‘YOUR FACTS GOES HERE’,</li><li>const handlers = { ‘LaunchRequest’: function () { this.emit(‘YOUR INTENT NAME WHICH YOU MADE IN ALEXA SKILL TAB IN THE PREVIOUS STEP, REMEBER TO COPY EXACTLY HOW IT IS’);},</li><li>‘YOUR INTENT NAME WHICH YOU JUST ADDED IN 4th POINT’: function () { const factArr = data;</li></ol><p>Now you are ready to go. Click on save at the right top corner of the webpage and just above that you will see your ARN. Copy your ARN and select your alexa skill tab. Select Endpoint from the left side panel and select AWS Lambda and paste your ARN in the default region. Click on “Save endpoint”.</p><p>Next Step</p><p>Click on “test” which is above left side panel and type your Utterance and test. If all works fine then go ahead and click LAUNCH and if not then then check your code in AWS lambda.</p><p>Fill all the fields and submit your icon with 108x108 and 512x512 resolution.</p><p>Now click on save and submit it for the certification.</p><p>Your app is done and will be under review for maximum of 7 days. Do check your mail with which login alexa console, if they find any error, they will respond you.</p><p>Alexa is new, so they are giving developers perks for each application you make. Do claim them when they offer. You can even put a price to your app and earn money.</p><p>Keep coding and you will learn a lot of stuff about different API which you can use. Thanks to Amazon alexa developers who made it so simple that any one can make simple skills.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dca2aacad0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>