<?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 Immagi on Medium]]></title>
        <description><![CDATA[Stories by Immagi on Medium]]></description>
        <link>https://medium.com/@immagi?source=rss-5b3159f2d54d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xD2mCk0DBjyV6PRLUqZ82A.jpeg</url>
            <title>Stories by Immagi on Medium</title>
            <link>https://medium.com/@immagi?source=rss-5b3159f2d54d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:12:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@immagi/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[Activation functions in machine learning]]></title>
            <link>https://ai.plainenglish.io/activation-functions-in-machine-learning-99d469b14746?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/99d469b14746</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[activation-functions]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 21:08:08 GMT</pubDate>
            <atom:updated>2023-06-11T13:36:19.570Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why do you need an activation function in inference, ML or ANN</h4><p>Despite of the huge amount of blogs, on-line courses, video and technical articles describing the various types of activation functions you can use to predict something (inference), you may found (like me) difficult at first to understand what activation functions are and why you absolutely need them in practice when you approach machine learning, statistical inference and artificial neural network. And the most fascinating part of all of this is that they are in our brain. In this article, i will try and hope to explain simply and shortly what activation functions are.</p><h4>Linear relation between data</h4><p>Inference means to predict something (Y or dipendend value) from 1 or more data or features (X,…Xn or indipendent values). The simpliest and most basic problem can be expressed as the following math expression:</p><p>Y = w*x</p><p>where “Y” is what you want to predict, “x” is the indipendent variable and “w” is what you have to learn. This type of problem could be represented as a linear relation between “x” and “Y”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*u-rL4ZZxq8JY1TuCHZho4A.png" /><figcaption>Linear relation between “x” and “Y”</figcaption></figure><p>“w” is 2 … easy to predict …</p><h4>Non-linear relation between data</h4><p>A “perfect” linear relation between “x” and “Y” cannot represent a real problem (otherwise it would not be a problem and you would not have to predict anything…). The image below show instead a type of relation we could observe in a real problem of “YES/NOT” (binary relation).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*6BD21-xSV8fg4_V77lSHiw.png" /><figcaption>“Binary” relation between “x” and “Y”</figcaption></figure><p>Try to solve this problem with a “linear inference” (orange line) will fail as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*dFfLuU-1ZIgeukuVeFejwA.png" /><figcaption>“Linear inference” will fail (orange line)</figcaption></figure><h4>The sigmoid activation function</h4><p>What happen if we apply a Sigmoid activation function to our “x” ? (green line)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*mDXG5KF6IePSZuDQxeoNPA.png" /><figcaption>The Sigmoid activation function (green line)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99d469b14746" width="1" height="1" alt=""><hr><p><a href="https://ai.plainenglish.io/activation-functions-in-machine-learning-99d469b14746">Activation functions in machine learning</a> was originally published in <a href="https://ai.plainenglish.io/">Artificial Intelligence 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[Danfo.js: Data Analysis in the Browser]]></title>
            <link>https://javascript.plainenglish.io/danfo-js-data-analysis-in-the-browser-1acb2633e688?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1acb2633e688</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Wed, 31 May 2023 13:45:47 GMT</pubDate>
            <atom:updated>2023-06-01T00:27:10.418Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to sort values by multiple columns</h4><p>Danfo.js is a JavaScript library for data analysis. It is inspired by the Python Pandas library and provides a similar API. Danfo.js allows to develop data apps in the browser. In this article, I will show how to sort a Danfo DataFrame by multiple columns in ascending or descending order. This seems to be a lack compared to the Pandas sort_values().</p><h4>Re-write the sortValues() method with VanillaJS</h4><p>I will write the sortValues() method using javascript array.sort() and array.compare() methods. First i will transform a Danfo DataFrame into a javascript array, and then, after sorting and comparing, the function will return a new Danfo DataFrame with the columns sorted in ascending or descending order.</p><pre>import * as dfd from &quot;danfojs&quot;<br><br>export function sortValues(df:dfd.DataFrame, columns:Array&lt;number&gt;, order:string){<br>      <br>      let a:Array&lt;any&gt; = df.values<br>      let sortIndex = columns<br><br>      let newArr=a.sort((a, b) =&gt; {<br>        let rst = 0;<br>        sortIndex.some((value) =&gt; {<br>          if (a[value] &gt; b[value]) {<br>            if(order == undefined || order == null || order == &#39;asc&#39;)rst = 1;<br>            if(order == &#39;desc&#39;)rst = -1;<br>            return true;<br>          } else if (a[value] &lt; b[value]) {<br>            if(order == undefined || order == null || order == &#39;asc&#39;)rst = -1;<br>            if(order == &#39;desc&#39;)rst = 1;<br>            return true;<br>          } else {<br>            rst = 0;<br>            return false;<br>          }<br>        });<br>        return rst;<br>      });<br><br>      <br>      return new dfd.DataFrame(newArr,{columns:df.columns})<br>}</pre><p>The function accepts an array of columns as numbers, where each number represents the index of the column to sort. You could also accepts an array of strings, where each string is the column name to sort. In this case, you must retrieve the index of each column name before sort and compare.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>.</em></p><p><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1acb2633e688" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/danfo-js-data-analysis-in-the-browser-1acb2633e688">Danfo.js: Data Analysis in the Browser</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[Personalize Your Own UI Simply with JavaScript]]></title>
            <link>https://javascript.plainenglish.io/html-input-type-file-personalize-your-own-ui-simply-with-javascript-1a9eea459a74?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a9eea459a74</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Sat, 30 Apr 2022 20:35:15 GMT</pubDate>
            <atom:updated>2022-05-05T00:58:26.906Z</atom:updated>
            <content:encoded><![CDATA[<h4>Instead of using HTML &lt;input type=“file”&gt;, use only JavaScript to personalize your UI.</h4><p>In the history of HTML, the HTML input type=“file” UI has been a bore. True, today exist some CSS libraries or JS frameworks you could use. But, what about completely being free to personalize your input UI? In this article, I will show you how you can simply do it with JavaScript.</p><h4>Step 1: create the HTML input</h4><p>I use document.createElement()<em> + </em>element.setAttribute()<em> </em>to create an HTML input type=“file”, accepting multiple CSV files as input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*HHIDdMHmHgMIeMU4rPj0Bg.png" /><figcaption>build the HTML input</figcaption></figure><h4>Step 2: open file dialog</h4><p>The function openDialog()<em> </em>simulate the user onclick event. I use the element.click() to do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*jUaHuRNr78K02tN6-lg47g.png" /><figcaption>open file dialog</figcaption></figure><h4>Step 3: what will see the end-user</h4><p>The end-user will see just what you want (button, icon, etc.). You only need an HTML element to target the fileInput. I choose an icon.</p><pre>&lt;i class=”material-icons” onclick=”openFileSystem()”&gt;open-folder&lt;/i&gt;</pre><pre>function openFileSystem(){</pre><pre>const fileInput = build()</pre><pre>fileInput.openDialog()</pre><pre>}</pre><p>That’s it! Just add onchange event handler on the fileInput to read the selected files.</p><pre>fileInput.onchange=()=&gt;{</pre><pre>…return fileInput.files</pre><pre>}</pre><p>That’s it for this topic. Thank you for reading.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a9eea459a74" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/html-input-type-file-personalize-your-own-ui-simply-with-javascript-1a9eea459a74">Personalize Your Own UI Simply with JavaScript</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[Classes vs. Literal Objects: A Minimalistic “Vanilla JS” Approach to OOP and Serialization]]></title>
            <link>https://javascript.plainenglish.io/classes-vs-literal-objects-a-minimalistic-vanillajs-approach-to-oop-and-serialization-in-f08fdbf6157?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f08fdbf6157</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Mon, 13 Sep 2021 15:41:51 GMT</pubDate>
            <atom:updated>2021-09-13T16:26:27.997Z</atom:updated>
            <content:encoded><![CDATA[<h3>Classes vs. Literal Objects: A Minimalistic “Vanilla JS” Approach to OOP and Serialization in JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZwQ3ZKff44MesgyrNOoA0w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jefflssantos?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jefferson Santos</a> on <a href="https://unsplash.com/s/photos/programming-language?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Object-Oriented Programming means identify and isolate “code workers” with specific properties and methods or functions interacting and exchanging data with each other.</p><p>ECMAScript 2015, also known as ES6, introduced JavaScript Classes. JavaScript Classes are templates for JavaScript Objects. This meant introducing keywords like <em>Class, static, extends</em>.</p><p>Although the use of classes is extremely useful for organizing code, programming in a client-server environment but above all in “web servless” architecture involves first of all the need to exchange data between different applications or pages (ie the javascript client app running inside the browser and an HTTP Service or API). In other words, different software components must be able to exchange the objects (or rather the data) of which they are composed in order to talk each other. This is called object serialization.</p><h4>Serialization</h4><p>In computing, serialization is <strong>the process of translating a data structure or object state into a format that can be stored</strong> (for example, in a file or memory data buffer) or transmitted (for example, over a computer network) and reconstructed later. (<a href="https://en.wikipedia.org/wiki/Serialization"><em>https://en.wikipedia.org/wiki/Serialization</em></a>)</p><h4>A simple serialization approach using Javascript Literal Objects</h4><blockquote>An object literal is a comma-separated list of name-value pairs inside of curly braces. Below is an example.</blockquote><pre><strong>exports var room = {</strong></pre><pre> <em>name</em>: &#39;kitchen&#39;,<br> <em>floor</em>: 1,<br> <em>measure</em>: 12,<br> <em>sayHello(){</em><br>  console.log(`Hello, i&#39;m the ${this.name}`)<br> <em>}</em></pre><pre><strong>}</strong></pre><p><strong>Sharing the room object over the network or routing in Single Page App</strong></p><p>What I’m gonna do is to separate the data from the methods and use an extends (but call it whatever you want) method to set or get the serialized room object. <strong>This will make the room object a static class with as many object data.</strong></p><pre>export var room = {</pre><pre><strong>extends(data){</strong><br>  return {<br>     name: data &amp;&amp; data.name ? data.name : undefined<br>     floor: data &amp;&amp; data.floor ? data.floor : undefined<br>     measure: data &amp;&amp; data.measure ? data.measure : undefined<br>  }</pre><pre><strong>},</strong><br> <br> sayHello(obj){<br>  console.log(`Hello, i&#39;m the ${obj.name}`)<br> }</pre><pre>}</pre><blockquote>Just note that the extends methods return a new object (remember when you create an object<em> you are giving a reference to it and not a value</em>).</blockquote><h4>A practical example</h4><pre>let room1 = room.extends({name: &#39;kitchen&#39;})<br>let room2 = room.extends({name: &#39;garage&#39;})</pre><pre>console.log(room.sayHello(room1)) //Hello, i&#39;am the kitchen<br>console.log(room.sayHello(room2)) //Hello, i&#39;am the garage</pre><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f08fdbf6157" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/classes-vs-literal-objects-a-minimalistic-vanillajs-approach-to-oop-and-serialization-in-f08fdbf6157">Classes vs. Literal Objects: A Minimalistic “Vanilla JS” Approach to OOP and Serialization</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[Data Visualization and Analysis with JavaScript]]></title>
            <link>https://javascript.plainenglish.io/off-line-data-visualizations-and-analysis-with-javascript-8e0a891493b1?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e0a891493b1</guid>
            <category><![CDATA[data-vizualisation]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[google-visualization]]></category>
            <category><![CDATA[pyplot]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 13:29:14 GMT</pubDate>
            <atom:updated>2021-09-11T19:01:57.696Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mpyrgqwMjfclV2oN1U2VIA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Luke Chesser</a> on <a href="https://unsplash.com/s/photos/data?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In the last few months i have been working to develop an off-line data analysis and visualization project. The scenario was this:</p><ul><li>A set of csv files resulting from queries on the ERP system;</li><li>A set of graphs self-produced by the end user.</li></ul><h4><a href="https://danfo.jsdata.org/"><strong>Danfo.js</strong></a></h4><p><em>Danfo.js is an open-source, JavaScript library providing high-performance, intuitive, and easy-to-use data structures for manipulating and processing structured data. </em>Danfo.js is heavily inspired by the <a href="https://pandas.pydata.org/pandas-docs/stable/index.html">Pandas</a> library and provides a similar interface and API.</p><blockquote>Basically danfo.js allows you to create client-side DataFrame. A DataFrame is a structured data object in tabular form (a matrix or 2-dimensional array).</blockquote><h3>Transform a local CSV files into a DataFrame</h3><h4><strong>Step 1. Reading the local CSV files</strong></h4><p>The first step is reading the csv file selected by the end-user from a local o shared disk where queries export results. For example, i want to transform the following csv file into a DataFrame. The exported csv file represent the dataset of sales having specified YEAR, CUSTOMER, PRODUCT_CATEGORY (features).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*t6LASpmJdGVlDQ01d1CRlQ.png" /><figcaption>annual_sales.csv</figcaption></figure><h4><strong>File Web API</strong></h4><p>File Browser API allow reading the file selected by the end-user.</p><p><em>What we need?</em></p><ul><li>A button and click event to load an input tag of type file allowing end-user to select the file</li><li>Load the selected file and read it as text</li></ul><h4><strong>HTML button</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7b5egjkslkdGzzA5e_KDw.png" /><figcaption>The HTML button and the readFile onclick event</figcaption></figure><h4>readFile function</h4><p>The result of this function is the CSV text string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*X2WrIymR-kppvthYEuJeJg.png" /><figcaption>Local csv file reader</figcaption></figure><h4>Step 2. Transform the CSV text string into a DataFrame</h4><p>A DataFrame can be constructed from an array of JavaScript literal objects. So the next step is to transform the CSV text string into an array of objects. The next function csv_to_dataframe(strCSV) will do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*Q6TygrXb_Fx53DVpwy0qog.png" /><figcaption>Convert csv string into array of literal objects</figcaption></figure><h4>Step 3. Build the danfo DataFrame</h4><p>This is the simplest step. Just construct a DataFrame object from the result of the previous function: df=new <strong>dfd</strong>.DataFrame(format_csv(strCSV))</p><p><strong>Where dfd is a reference to the global danfo.js library</strong> you can import as cdn, download locally, or install as NPM package (for details on how integrate Dando.js into your client app see <a href="https://danfo.jsdata.org/getting-started">https://danfo.jsdata.org/getting-started</a> and if you use framework like React, Angular o Vue see <a href="https://danfo.jsdata.org/examples/using-danfojs-in-react">https://danfo.jsdata.org/examples/using-danfojs-in-react</a>).</p><p>As always let me know your thoughts in the comments. And if you were interested I am going to publish the second part of this article to discuss:</p><ul><li>Powerful data transformation and analysis with the DataFrame</li><li>Visualize interactive and responsive graphs of different types reading the DataFrame with 3 free amazing JavaScript library: <a href="https://plotly.com/javascript/">pyplot</a>, <a href="https://apexcharts.com/">Apexchart</a>, <a href="https://developers.google.com/chart/interactive/docs/reference">Google visualization API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e0a891493b1" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/off-line-data-visualizations-and-analysis-with-javascript-8e0a891493b1">Data Visualization and Analysis with JavaScript</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[Scaffold Vue.js Apps with Vuetify]]></title>
            <link>https://javascript.plainenglish.io/front-end-scaffolding-with-vuetify-aebea69ce313?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/aebea69ce313</guid>
            <category><![CDATA[end-user-experience]]></category>
            <category><![CDATA[vuetify]]></category>
            <category><![CDATA[css-positioning]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Tue, 10 Aug 2021 07:34:41 GMT</pubDate>
            <atom:updated>2021-09-09T21:09:27.617Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NhJmuirxlq9GHHE9.jpg" /></figure><p>Scaffolding is one of the most important aspect of a front-end app, running into user experience, responsiveness and components reusability. Vuetify is an amazing Vue UI library to develop amazing front-end apps. When i start studying a new UI library, sometimes i run into this mistake: start from UI components. But soon i need to go back and dip into how scaffolding works to layout my apps with minimal effort and without writing specific code.</p><h3>Wireframes</h3><p>Vuetify wireframes (as defined on <a href="https://vuetifyjs.com/en/getting-started/wireframes/#examples">official docs</a>) “<em>are templates designed to provide a consistent approach to layouts, layering, and shadows</em>”.</p><p>Wireframes are build on 4 basic layout-system components:</p><ul><li><em>v-app-bar</em>; the app bar placed at the top of your UI with your app icon, navigation menu, etc …;</li><li><em>v-main</em>; where you place the UI content;</li><li><em>v-footer</em>; placed at the bottom of your UI for other actions that are specific to the page context.</li></ul><blockquote>The main question that you always ask yourself when you develop the UI is the position of this 3 blocks; scrolling the UI or changing its content shouldn’t effect your view but adapt it. And Vuetify offers a specific simple property you must declare on top and bottom components to achieve that without any effort.</blockquote><h3>App property</h3><p>The app property, as defined by Vuetify, <em>“designates the component as part of the application layout. Used for dynamically adjusting content sizing. Components using this prop should reside </em><strong><em>outside</em></strong><em> of </em><em>v-main component to function properly. You can find more information about layouts on the </em><a href="https://vuetifyjs.com/en/components/application/"><em>application page</em></a><em>. “</em></p><p><strong>Note:</strong> this prop automatically applies <strong>position: fixed</strong> to the layout element. You can overwrite this functionality by using the absolute prop.</p><p>So, you just have to declare the app property inside your &lt;v-app-bar&gt; (the same for &lt;v-footer&gt;), and the content will adjust its size, maintaining the app-bar at the top and scrolling behind it.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aebea69ce313" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/front-end-scaffolding-with-vuetify-aebea69ce313">Scaffold Vue.js Apps with Vuetify</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[Computer Vision Web API : Flask + base64]]></title>
            <link>https://python.plainenglish.io/build-a-computer-vision-web-api-with-flask-base64-like-imgix-814cb443aab7?source=rss-5b3159f2d54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/814cb443aab7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Immagi]]></dc:creator>
            <pubDate>Mon, 02 Aug 2021 23:55:48 GMT</pubDate>
            <atom:updated>2021-09-16T07:01:12.351Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Vision Web API : Flask + base64</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xD2mCk0DBjyV6PRLUqZ82A.jpeg" /></figure><p>Over the past twenty years, we’ve seen the WWW evolve from static to dynamic pages, from data to services. And soon AI has developed over ubiquity, on-demand and integration.</p><h4>Privacy and end-user concern: files or data?</h4><p>If you want to develop a <em>computer vision WebAPI</em>, you will soon have to dive into privacy and end-user concerns (<em>“Hey man, what will you do with my file?”</em>).</p><blockquote>Using <a href="https://www.base64decode.org/">Base64 decode and encode</a>, the browser and the server will exchange ASCII text strings. So it’s extremely powerful for streaming images if you don’t need web sockets.</blockquote><h3>Build the WebAPI</h3><p>The WebAPI is built on these components:</p><ul><li>A simple send_image.html file sending a 64base image over secure https post;</li><li>A <a href="https://flask.palletsprojects.com/en/2.0.x/">Flask server</a>, with flask_cors and Blueprint;</li><li>the base64 Phyton library to decode and encode base64 strings.</li></ul><p><strong>send_image.html</strong></p><p>This HTML file contains:</p><ul><li>a &lt;div&gt; with an onclick event attached calling the sendImage function. This function gets the File object and then read this file as DataURL;</li><li>a &lt;div&gt; showing the selected image sent to the server;</li><li>a &lt;div&gt; showing that image back from the API.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*hHXmMaGDN43tDWNhRueF7A.png" /><figcaption>send_image.html</figcaption></figure><h4>The server</h4><p>In order to serve the WebAPI we will use Flask with:</p><ul><li><a href="https://flask-cors.readthedocs.io/en/latest/">flask_cors</a>, allowing to receive requests from app hosted in other domains (clients);</li><li><a href="https://flask.palletsprojects.com/en/2.0.x/blueprints/">Blueprint</a> in order to give our API different routes and make Flask modular.</li></ul><h4>server.py</h4><p>server.py is our <a href="https://flask.palletsprojects.com/en/2.0.x/">Flask server </a>starting file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*uerrgafIolWi2KBt1vfXHQ.png" /><figcaption>server.py</figcaption></figure><p>At line 3, we import my <em>imagi python package</em> create under the server root folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*DUbpBaTjW2dTP32d6Gn4Lg.png" /><figcaption>my immagi python package</figcaption></figure><p><strong>immagi.py</strong></p><p>First, we import the libraries we need and create our <strong>immagi </strong>API root (https://localhost:5000/api/immagi) at line 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*6cqOKluAguGoowVEj7e-Vg.png" /><figcaption>immagi.py</figcaption></figure><p>Now we’re ready to develop our WebAPI service! We’re going to execute these steps:</p><ul><li>read the base64 image string from the browser HTTPS post request;</li><li>decode the string to <a href="https://docs.opencv.org/4.5.2/d6/d00/tutorial_py_root.html">OpenCV </a>img; at this point, you are able to transform, analyse, or apply an AI model to this image (you will need more request parameter; for example ?img=resize);</li><li>encode the new image to base64 string and send the response to the browser.</li></ul><p>You will find these steps with comments in the code below. Bye!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*BtqtArdQNkaEhYFy2R2q0g.png" /><figcaption>decoding and encoding base64, numpy, cv</figcaption></figure><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=814cb443aab7" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/build-a-computer-vision-web-api-with-flask-base64-like-imgix-814cb443aab7">Computer Vision Web API : Flask + base64</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>