<?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 Ashish Shubham on Medium]]></title>
        <description><![CDATA[Stories by Ashish Shubham on Medium]]></description>
        <link>https://medium.com/@ashishshubham?source=rss-97823bbe4e20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oRcsQGYns-5smXNCBb5K-Q.jpeg</url>
            <title>Stories by Ashish Shubham on Medium</title>
            <link>https://medium.com/@ashishshubham?source=rss-97823bbe4e20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 19:03:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashishshubham/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[Users should never know it’s embedded]]></title>
            <link>https://medium.com/thoughtspotdev/users-should-never-know-its-embedded-5fb7af29a116?source=rss-97823bbe4e20------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fb7af29a116</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ashish Shubham]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 12:12:46 GMT</pubDate>
            <atom:updated>2025-03-25T05:16:17.049Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*pAvk_tkvHMZDXYenysHRBA.png" /></figure><blockquote>“To build or not to build, that is the question”</blockquote><p>Every developer faces this modern-day Hamlet moment at some point. Do you spend weeks or months crafting custom capabilities from scratch, wrestling with systems, scaling, security, databases, and UX challenges — or do you embed an existing, battle-tested solution?</p><p>When done right, embedding is pure magic: it brings powerful functionality like analytics, payments, or interactive media directly into your app without friction or distraction. Your users experience smooth, effortless interactions, completely unaware of the sophisticated technology quietly powering their experience behind the scenes.</p><h4>Embedding: The invisible art</h4><p>Your users (all users?) prefer a cohesive experience. Any third party integration must feel native to maintain trust and usability. When it comes to embedding on the web, who are the inspirations ?</p><p><strong>YouTube (Video Content)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puFDcdZ0cpnZkmurlvKwBw.png" /></figure><p>The OG web embed. You can take any video and with a few lines of code drop it into your webapp, site or medium article. This is a plain Iframe, with some attributes and it cannot get simpler than that.</p><p>Can your users make out it’s Youtube? <strong>Hell yeah!</strong> but who cares ?</p><p><strong>Google Maps</strong></p><p><strong>TLDR;</strong> Almost no one wants to build maps!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C_GaDcXSTgMFDFbV162PHg.png" /></figure><p>Things start to get a bit serious here. Google Maps has a complete programatic API to make them your own. Custom markers, camera angles, events for interactivity etc. Nevertheless they are ubiquitous: Airbnb, Yelp, Uber (used to) and many more integrate Google maps to provide their users the seamless mapping experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*YbtntYcyzoUAnQgxrlntAw.png" /></figure><p>Google Maps, also provides a robust styling framework to skin maps to suite your app’s design language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*wxhWMTsnOF_iu7RcqvB6GQ.png" /></figure><p><strong>Stripe (Payments)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jN1BhHbMUh9uw7rw.png" /></figure><p>You want to build the next biggest SaaS idea, how do you go about that ?</p><ul><li>Write code using <a href="https://cursor.com/"><em>Cursor</em></a> in 3 hours.</li><li>Deploy to scale using <a href="https://vercel.com/"><em>Vercel</em></a>.</li><li>Get millions of users in the next 24 hours.</li></ul><p>What’s missing here … How do you make money ? Well, lets just ask people to subscribe and give us their credit card. Not that easy, enter compliance! <a href="https://stripe.com/"><em>Stripe</em></a><em> </em>provides<em> </em>prebuilt checkout/payment experience for your app. Stripe has SDKs for the most popular platforms, which helps tune the integration to suite your needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*n8n82w_0QlGkYuBdio0YXg.png" /></figure><p>It blends seamlessly into your app’s workflow with customizable design symbols.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QlY_SMBZTvoHGQCC.png" /></figure><p><strong>TLDR;</strong> You do not want to build a payment system (unless you are a stripe or paypal).</p><p><strong>ThoughtSpot (Data &amp; AI Analytics)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DvuhdaG0SbG-aPoj" /></figure><p>Now that you have millions of (paying) users. You want to provide some success metrics, to convince these users to keep subscribed. If your customers are businesses themselves, they might need sophisticated reports on multiple business KPIs.</p><p>Simple, lets connect a charting library to our database. Well, wait.. what about data governance/security ? Interactive reporting with filtering, drill downs, cohort analysis ? Can I leverage AI to present my users optimization opportunities based on their data ?</p><p>Enter <a href="https://www.thoughtspot.com/product/embedded"><em>ThoughtSpot</em></a>, robust AI analytics for your app. Use ThoughtSpot’s React Components to embed the AI agent or interactive dashboards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*pE2dUHmtgWwPvrrTc7_Tig.png" /></figure><p>At ThoughtSpot we have gone to lengths to make our analytics components blend into your app. You can <a href="https://developers.thoughtspot.com/docs/style-customization">customize</a> styles, colors, fonts, strings, icons and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QhAcQh8EII5V1u6vwlbT_g.png" /></figure><pre>// Style customization for ThoughtSpot<br>const styleConfig = {<br>  style: {<br>    customCSSUrl: &quot;https://cdn.jsdelivr.net/gh/acme/&quot;<br>      + &quot;custom-css/css-variables.css&quot;,<br>    <br>    customCSS: {<br>      // ThoughtSpot variables declared inline <br>      // https://developers.thoughtspot.com/docs/css-variables-reference<br>      variables: {<br>        &quot;--ts-var-button--secondary-background&quot;: &quot;#F0EBFF&quot;,<br>        &quot;--ts-var-button--secondary--hover-background&quot;: &quot;#E3D9FC&quot;,<br>        &quot;--ts-var-root-background&quot;: &quot;#F7F5FF&quot;,<br>      },<br>    },<br>  },<br>  <br>  // Override the icon sprite used in ThoughtSpot <br>  // https://developers.thoughtspot.com/docs/customize-icons<br>  iconSpriteUrl: &quot;https://cdn.jsdelivr.net/gh/acme/custom-css&quot; <br>    + &quot;/icon-override1.svg&quot;,<br>  <br>  // Override the default text strings used in ThoughtSpot <br>  // (Reference: https://developers.thoughtspot.com/docs/customize-text)<br>  content: {<br>    strings: {<br>      &quot;Liveboard&quot;: &quot;Dashboard&quot;,<br>      &quot;Edit&quot;: &quot;Modify&quot;,<br>      &quot;Show underlying data&quot;: &quot;Show source data&quot;,<br>      &quot;SpotIQ&quot;: &quot;Insights&quot;,<br>      &quot;Monitor&quot;: &quot;Alerts&quot;,<br>      &quot;Worksheets&quot;: &quot;Data model&quot;<br>    },<br>  },<br>};</pre><p>ThoughtSpot has also built a comprehensive events and actions framework to customize the user experience to fit your workflows.</p><pre>liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [{<br>  columnName: &quot;state&quot;,<br>  operator: RuntimeFilterOp.EQ,<br>  values: [&quot;michigan&quot;]<br>});</pre><p>ThoughtSpot enables Data governance and security seamlessly via <a href="https://developers.thoughtspot.com/docs/abac-user-parameters">JWT based ABAC</a>. It integrates seamlessly with any authentication or authorization scheme with a flexible <a href="https://developers.thoughtspot.com/docs/trusted-auth">SSO token</a> based approach.</p><p><strong>TLDR; </strong>Building good reporting is hard, do not try at office.</p><p>Delivering a seamless user experience isn’t just a luxury — it’s a necessity. By embedding analytics solutions like ThoughtSpot, you empower your application with robust, customizable insights without the burdens of building from scratch. This approach not only accelerates development but also ensures that your users enjoy a cohesive, uninterrupted experience. Just as we’ve come to expect flawless integrations in our daily apps, your users deserve the same invisible excellence. Embrace embedding, and let your application’s user experience shine — effortlessly and imperceptibly.</p><p>Build with <a href="https://thoughtspot.com/trial">ThoughtSpot for free </a>today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fb7af29a116" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thoughtspotdev/users-should-never-know-its-embedded-5fb7af29a116">Users should never know it’s embedded</a> was originally published in <a href="https://medium.com/thoughtspotdev">thoughtspotdev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analytics in your React App with TS Everywhere]]></title>
            <link>https://ashishshubham.medium.com/analytics-in-your-react-app-with-ts-everywhere-2fabdccc187b?source=rss-97823bbe4e20------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fabdccc187b</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[looker]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Ashish Shubham]]></dc:creator>
            <pubDate>Wed, 21 Apr 2021 03:23:29 GMT</pubDate>
            <atom:updated>2021-05-04T15:59:48.735Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KG_SU0FoJoWkDKWfZQzXUA.png" /></figure><h3>Build interactive analytics in your React App with ThoughtSpot Everywhere</h3><p><a href="https://thoughtspot.com/">ThoughtSpot</a> has revolutionized access to analytics for business users through search and AI. In addition to being a general purpose analytics tool that allows unprecedented access to business users, product builders can now use ThoughtSpot to deliver search-based analytics to customers.</p><p>Today, we are launching a brand new SDK that allows you to embed ThoughtSpot into your own web app in literally minutes. To show you how it works, I’ll walk you through an app built using <em>React + Typescript, </em>but you can use whatever framework works best for you!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2F70ek2&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2F70ek2&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2F70ek2%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/87d2809766475f5018e8856a7e0c5f3d/href">https://medium.com/media/87d2809766475f5018e8856a7e0c5f3d/href</a></iframe><h3>Create React App</h3><p>Start by creating a simple React app using<a href="https://create-react-app.dev/"> create-react-app</a> or a <em>React + Typescript</em><a href="https://codesandbox.io/"><em> </em>code sandbox</a> like I did above.</p><pre>$ npx create-react-app my-app</pre><h3>Install ThoughtSpot Visual Embed SDK</h3><p>The new ThoughtSpot visual embed SDK allows you to control the embedded search or visualization component.</p><pre>$ npm i @thoughtspot/visual-embed-sdk</pre><h3>Initialize Embed SDK</h3><p>Embed SDK needs to point to a ThoughtSpot instance. For this example, I am using a public ThoughtSpot demo instance for a sample retail banking dataset. This sample data is also available to you when you enter the Developer Portal. If you’re interested in experimenting with your own data, you’ll need to sign up for a <a href="https://www.thoughtspot.com/trial">free trial</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb72320a867205b7a12e673d127d0922/href">https://medium.com/media/fb72320a867205b7a12e673d127d0922/href</a></iframe><p>You’ll also notice I am using <em>AuthType.None</em> since the public demo instance is open and does not require authorization. For other TSE authentication capabilities, read the <a href="https://try-everywhere.thoughtspot.cloud/v2/#/everywhere/documentation/en/?pageid=integration-guidelines&amp;subsection=_define_an_authentication_method">Developer Guide</a>.</p><h3>Create a Search Component</h3><p>Now it’s time to create a simple wrapper to house the ThoughtSpot search component. The SDK will initialize and embed ThoughtSpot into the component you provide.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f59e00de6065405e259fb66646b4c7a/href">https://medium.com/media/1f59e00de6065405e259fb66646b4c7a/href</a></iframe><p>For a complete list of options, look at the<a href="https://docs.thoughtspot.com/visual-embed-sdk/release/typedoc/interfaces/searchviewconfig.html"> API reference</a> for search.</p><p>And just like that, you now have ThoughtSpotembedded into your application.</p><h3>Listening to Events</h3><p>ThoughtSpot Everywhere emits events which your application can use to create an experience for your users.</p><p>Below is a simple use case for how you can show a <em>spinner</em> to your user while ThoughtSpot components are loading:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d06f796398047560815ef805ba5ef39b/href">https://medium.com/media/d06f796398047560815ef805ba5ef39b/href</a></iframe><p>You can check out the complete list of events emitted by the ThoughtSpot Everywhere embed objects <a href="https://docs.thoughtspot.com/visual-embed-sdk/release/typedoc/enums/embedevent.html">here</a>.</p><h3>Custom Actions</h3><p>One of the coolest features of ThoughtSpotEverywhere is the ability to push insights from ThoughtSpot into your app. One way to achieve this is via custom actions. When a user clicks on an action created by you, a callback is called into your app with the analysis data.</p><p>This allows users to send data to third party tools and make their insights actionable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7af1f914659933edb457ee01fb574ba0/href">https://medium.com/media/7af1f914659933edb457ee01fb574ba0/href</a></iframe><h4>Thats all, folks!</h4><p>All the above code is available at this<a href="https://codesandbox.io/s/hello-thoughtspot-everywhere-owi3m?file=/src/Search.tsx"> CodeSandbox</a>. And also on<a href="https://github.com/ashubham/tse-howto-blog"> github</a>. The SDK is framework agnostic, so please bring your own framework.</p><p>ThoughtSpot has also released a swanky new <a href="https://try-everywhere.thoughtspot.cloud/v2/#/everywhere?medium=promoted&amp;utm_medium=promoted&amp;source=blog&amp;utm_source=blog&amp;campaign=may-4-ts-everywhere&amp;utm_campaign=may-4-tse-ashish">developer playground</a>, where you can play with everything ThoughtSpot Everywhere has to offer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fabdccc187b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infinite Scroll using Generators!]]></title>
            <link>https://javascript.plainenglish.io/infinite-scroll-using-generators-bbacbf6cafd9?source=rss-97823bbe4e20------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbacbf6cafd9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[infinite-scroll]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[asynchronous]]></category>
            <dc:creator><![CDATA[Ashish Shubham]]></dc:creator>
            <pubDate>Sun, 25 Nov 2018 12:16:03 GMT</pubDate>
            <atom:updated>2025-12-12T18:05:26.867Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*szy0MViNsW1jUtbJEjqV-Q.png" /></figure><h4>Put ES6 generators to some real use.</h4><p><em>Disclaimer: No JS libraries or frameworks were created or used while writing this article.</em></p><p>ES6 generators are awesome! .. says who ? Tech blogs, medium articles, developer videos, ChatGPT well anyone who wants to be cool.</p><p><em>What are generators ? </em>Quoting <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator">MDN</a>: “Generators are functions which can be exited and later re-entered. Their context (variable bindings) will be saved across re-entrances.” There are a number of <a href="https://codeburst.io/understanding-generators-in-es6-javascript-with-examples-6728834016d5">articles</a> written on this, I choose not to reinvent the wheel, and encourage you to read up about <em>generators </em>if you do not already know their physics.</p><p><a href="https://koajs.com/"><em>Koa</em></a>, <a href="https://github.com/redux-saga/redux-saga"><em>redux-saga</em></a><em> </em>and a bunch of other libraries started using generators as first class citizens initially. With the aim of making Async code, read like synchronous code.</p><p>Things changed when async await came around. <em>Koa </em>moved to using them, they are a far more simpler construct to address the readability concerns traditional methods like Promises and callbacks have.</p><blockquote>async await is a much simpler construct to make async code look sync.</blockquote><p>But then what about generators ? They come in handy when we need to <em>streamify </em>a large input source. So, Infinite scroll.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*wC2pbWbaIpv-CKhUzEpo9A.gif" /><figcaption>How the final Infinite Scroll will look like</figcaption></figure><blockquote>Infinite scrolling is a web-design technique that <strong>loads content continuously</strong> as the user scrolls down the page, eliminating the need for pagination.</blockquote><p>An effective implementation of Infinite scroll involves:</p><ol><li>Detect when the scroll thumb reaches the bottom of the container.</li><li>Maintain the state of offset and fetch the next set of items.</li><li>Synchronization of API calls over the network, the response will come out of order often.</li></ol><p>We will see how generators make this a breeze. Note: this article assumes basic understanding of how generators work in Javascript.</p><p>First, we will setup a source for us. We will just create a mock web-service which returns numbers given an offset and batchSize.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70fcb986bc8cd365cb75f3d1bb4f6798/href">https://medium.com/media/70fcb986bc8cd365cb75f3d1bb4f6798/href</a></iframe><p>This simply returns a promise which resolves after a random delay with an array of numbers or content. We will <em>streamify </em>this service method, by wrapping it inside a generator.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fbdac59e2b433d48d4a8dfe61a28633/href">https://medium.com/media/1fbdac59e2b433d48d4a8dfe61a28633/href</a></iframe><p>This method just keeps on yielding the next set of results. Notice that the maintenance of offset state is encapsulated within the generator method.</p><p>Now, to get the events when the scroll reaches the bottom. We will create a generic <em>event </em>stream, which listens on an UI event and emits whenever the supplied condition is satisfied.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5bcf67f0a49807cfbc693df45a4fa4fd/href">https://medium.com/media/5bcf67f0a49807cfbc693df45a4fa4fd/href</a></iframe><p>Here, we setup an <em>eventListener</em> on el for the name event. Whenever the event is fired we check the supplied condition and when satisfied we call the <em>resolve </em>method. The <em>resolve </em>method is nothing but a saved resolution callback from a <em>Promise. </em>We use the <em>Promise </em>property here that they can only be resolved once, thus multiple calling of resolve() method is a no-op, until a new promise is created.</p><p>Alright, if you are still with me you know how generators work! Now let me introduce the magic which will glue everything together and make shit work:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c900e7e3cbba695a4ed9655ac4ff92f7/href">https://medium.com/media/c900e7e3cbba695a4ed9655ac4ff92f7/href</a></iframe><p>The init method creates the <em>eventIterator</em> on the container with the condition of the scoll thumb reaching the bottom. And in a loop:</p><ol><li>Gets the next set of items, waits until they are received.</li><li>Appends the items to the container</li><li>Wait for the next emission of the conditional event stream.</li></ol><p>Done! Simple &amp; Elegant. Pure native javascript.</p><p>You can see the full source, with the working <a href="http://jsfiddle.net/ashubham/yqhnab10/9/">Fiddle</a>.</p><p>And, if you love writing Simple &amp; Elegant Javascript or Typescript, come join us at <a href="https://www.thoughtspot.com/careers-listing">ThoughtSpot</a>, we are hiring!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbacbf6cafd9" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/infinite-scroll-using-generators-bbacbf6cafd9">Infinite Scroll using Generators!</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge your search bar with Visual Tokens]]></title>
            <link>https://codeburst.io/supercharge-your-search-with-tokenization-32321a87f309?source=rss-97823bbe4e20------2</link>
            <guid isPermaLink="false">https://medium.com/p/32321a87f309</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ashish Shubham]]></dc:creator>
            <pubDate>Mon, 15 Jan 2018 07:50:05 GMT</pubDate>
            <atom:updated>2018-01-26T14:51:19.073Z</atom:updated>
            <content:encoded><![CDATA[<p>A UX problem with search is quick feedback. A user does not know what results she is going to see until she hits <em>Return. </em>But what if we had something like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*zdB1be1m0idaNGT6cGPdLA.gif" /><figcaption>Tokenization while searching</figcaption></figure><ul><li>The UI interactions. (Caret position and all those ‘fun’ things)</li><li>Maintain a big FSM representing tokeninzation metadata.</li></ul><p>Lets talk about the second one first, Most of the current libraries assume that the token information is synchronously available. Now the problem with that is you cannot have the full state machine regarding tokens of a search on the client, depending on the limits of your system it could be too big. Here we need to provide an asynchronous method of fetching the tokenization state from the Server. Which needs to be synchronized and optimized, for eg. this might be an interaction timeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*Ax-rMERmWuPsJMaWS4C_0A.png" /><figcaption>Client-Server request reponse</figcaption></figure><p><em>Reactive Streams </em>to the rescue! <a href="https://github.com/ReactiveX/rxjs">RxJS</a> is a wonderful library by Microsoft, the above scenario could be easily handled using <em>switchMap </em>from the RxJS. Here is an excerpt from the library <a href="https://github.com/ashubham/tokenizer.js">tokenizer.js</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c19d6c822fc982d4c577bdec79ab6bfe/href">https://medium.com/media/c19d6c822fc982d4c577bdec79ab6bfe/href</a></iframe><p>Here we create an <em>Observable </em>from the input stream of change events (which is different for IE) feed it to switch map which calls the async callback and then <em>subscribe</em> to it to re tokenize the display. So, basically switchMap handles for us cancellation of a previous request, and thus always waiting on the response for the latest state of the tokenized input.</p><p>Now, let us come to the first part of our puzzle. How to handle the UI interactions which a user could do, maintain the caret position amid incoming server responses about tokenized state and how to handle the browser quirks ? While development of <a href="https://github.com/ashubham/tokenizer.js">tokenizer.js</a> I stumbled upon <a href="https://github.com/timdown/rangy">rangy,</a> which is a great library to handle cross browser range/caret quirks although I needed to fine tune stuff to get the best performance. Also, here is some excerpt which provides an insight into how could one manage different browsers using ES6 modules, again from the source code of <a href="https://github.com/ashubham/tokenizer.js">tokenizer.js</a> :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd163e3cff190421e2a60bfaa9c5b52/href">https://medium.com/media/8fd163e3cff190421e2a60bfaa9c5b52/href</a></iframe><p>Here the browser specific utility methods/properties (if required) are exported at load time, thus preventing conditions to check the browser type for each interaction. There were other micro optimizations which needed to be handled to have a smooth search experience, including but not limited to:</p><ul><li>Keypresses in between tokens. (BckSpc/Delete in particular)</li><li>Enter/Esc/Tab behaviour</li><li>Handling Space at token endings.</li><li>Removal of tokens using (x) button.</li><li>Copy/Paste of text from other sources.</li><li>Handle IME languages like Japanese/Chinese etc.</li></ul><p>These were just some learnings we had while developing tokenizer.js for use in the search bar at <a href="http://www.thoughtspot.com/">ThoughtSpot</a>. Please feel free to checkout the full source code on <a href="https://github.com/ashubham/tokenizer.js">github</a>. And you can use it in your projects right away via <a href="https://www.npmjs.com/package/tokenizer.js">npm</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32321a87f309" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/supercharge-your-search-with-tokenization-32321a87f309">Supercharge your search bar with Visual Tokens</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maintaining context in chatbots]]></title>
            <link>https://medium.com/chat-bots/maintaining-context-in-chatbots-2016b6a5b7c6?source=rss-97823bbe4e20------2</link>
            <guid isPermaLink="false">https://medium.com/p/2016b6a5b7c6</guid>
            <category><![CDATA[conversational-ui]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[content-design]]></category>
            <category><![CDATA[context]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ashish Shubham]]></dc:creator>
            <pubDate>Sun, 19 Mar 2017 08:37:44 GMT</pubDate>
            <atom:updated>2017-08-17T15:18:01.669Z</atom:updated>
            <content:encoded><![CDATA[<h3>Maintaining Context in Chatbots</h3><h4>Spot and <a href="https://www.npmjs.com/package/bot-context">Bot-context</a> are simple yet powerful ways to manage conversation context in your shiny smart chatbot.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8RD8lCnkkhqf2rUZOC1vg.jpeg" /></figure><p>One of the harder problems that chatbot developers face is how to maintain the <a href="https://chatbotsmagazine.com/contextual-chat-bots-with-tensorflow-4391749d0077"><strong>context of conversation</strong></a>. While all the popular frameworks provide an opinionated take on how to maintain this context, none of them seem to be either simple or complete.</p><p>At ThoughtSpot we built <em>Spot</em>, a bot to get insights into your data. We used a reactive approach to maintain the conversation context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*Zyb6OLub93tF3KdgF0VdYA.png" /><figcaption>Context matching against stack</figcaption></figure><p>This can be summarised as:</p><ul><li>Whenever the bot send a message, set(push) <br><em>&lt;a matcher method m(), a context callback&gt;</em> on the stack.</li><li>On receiving a message, match the message using the matcher methods in FIFO order. Call the matched context callback.</li></ul><p>The elegance of this approach is that the pushed <em>callback</em> captures the state of variables as a part of its closure context. When the callback is called, this state is retained and we can time travel back to the state when the context was actually set.</p><p>Let me illustrate with an example:</p><blockquote><strong>User</strong>: &quot;List my dashboards&quot;.<br># Initialize an empty context for the user.</blockquote><blockquote># Push &lt;/(sales pipeline|marketing|engineering release tracker)/, <br># getChartsInDashboard&gt;<br><strong>Bot</strong>: Avaliable Dashbooards are:<br>1. Sales Pipeline<br>2. Marketing<br>3. Engineering Release tracker</blockquote><blockquote><strong>User</strong>: &quot;Marketing&quot;<br># Match &quot;marketing&quot; against the stack, we see it matches. <br># And call getChartsInDashboard<em> </em>with <em>{dashboardName}</em></blockquote><blockquote># Push &lt;/([1–3])/, getChartInDashboard&gt;<br><strong>Bot</strong>: So these are the <em>Charts in {dashboardName=marketing}, </em>select the one you want to see.:<br>1. Monthly Qualified Leads(MQLs) Weekly.<br>2. Paid Traffic by source<br>3. Top 10 Webpages, L7</blockquote><blockquote><strong>User</strong>: &quot;sales pipeline&quot;<br># Now, since <strong><em>sales pipeline</em></strong><em> </em>does not match the digit matcher we specified, it <br># goes to the previous item in the stack where it finds a match. Thus calling <br><em># </em><strong>getChartsInDashboard</strong><em> again.</em></blockquote><blockquote><strong>Bot:</strong> Alright, here are the <em>Charts in {dashboardName=sales pipeline}, </em>select the one you want to see.:<br>1. Total Open Pipeline trend.<br>2. Open Pipelie by Close Q by Stage<br>3. S1s created monthly</blockquote><blockquote># Win!</blockquote><p>This was a simple example where we used <em>context stack</em> to match the user intent. Things become more interesting when we are able to use the closure variables in the called callback.</p><p><a href="https://www.npmjs.com/package/bot-context">Bot-context</a> is a simple yet powerful way to manage conversation context in your shiny smart chatbot. Its open source, you are just an npm installaway from using it.</p><p>Let us see the complete example using <em>bot-context</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c25844218820cd88f880d12a637924f3/href">https://medium.com/media/c25844218820cd88f880d12a637924f3/href</a></iframe><p>That’s it! The above code is all you need to handle all permutations and combinations of the answers the user may give. Please visit the <a href="https://github.com/ashubham/bot-context">github</a> of the bot-context project for more details and discussion.</p><p><a href="https://chatbotsmagazine.com/contextual-chat-bots-with-tensorflow-4391749d0077">Contextual Chatbots with Tensorflow</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*mToBIVQSczojw0mSn2h5Sw.gif" /><figcaption>👏👏Clap below to recommend this article to other coders and bot enthusiasts👏👏</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F58521e%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F58521e%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c90883b0516ddbe5c59960c12a04bc64/href">https://medium.com/media/c90883b0516ddbe5c59960c12a04bc64/href</a></iframe><figure><a href="https://docs.google.com/forms/d/e/1FAIpQLSfJDqeR7zbRBfQvx6mouQAhjK4lrCy3z9Z6Ppxln7f1xi12dg/viewform?c=0&amp;w=1"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*rRjUc6JW61AP1UWsa-yItQ.png" /></a></figure><figure><a href="https://chatbotsmagazine.com/be-featured-in-front-of-thousands-of-people-interested-in-bots-e7040c4080df#.hswzhzpp9"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*OGAA3ICxv3ds-RK2Sq4oxA.png" /></a></figure><figure><a href="https://chatbotsmagazine.com/want-to-receive-the-best-chatbot-related-content-in-your-medium-feed-20a9c11f11b6#.1t1yhwcyz"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*1XecGp_cGZ1wGLAldRHLWQ.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2016b6a5b7c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chat-bots/maintaining-context-in-chatbots-2016b6a5b7c6">Maintaining context in chatbots</a> was originally published in <a href="https://medium.com/chat-bots">Chatbots Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>