<?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 Paul Alles on Medium]]></title>
        <description><![CDATA[Stories by Paul Alles on Medium]]></description>
        <link>https://medium.com/@paulallles?source=rss-e02faed963e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mNpEk80fUX_cDo9k.jpg</url>
            <title>Stories by Paul Alles on Medium</title>
            <link>https://medium.com/@paulallles?source=rss-e02faed963e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:56:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulallles/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[Expand AWS S3 Content Search capability from File name search to Advanced Query Search]]></title>
            <link>https://medium.com/@paulallles/expand-aws-s3-content-search-capability-from-file-name-search-to-advanced-query-search-0dfd99903565?source=rss-e02faed963e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dfd99903565</guid>
            <category><![CDATA[aws-s3]]></category>
            <dc:creator><![CDATA[Paul Alles]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 17:08:43 GMT</pubDate>
            <atom:updated>2024-03-07T17:08:43.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOwnCGlZJq4fdrzKCv6nyg.jpeg" /></figure><p>If you have prior experience with AWS S3, then I can assume you have some experience in storing or retrieving content from AWS S3. In a simple programmatic approach, we use the AWS SDK to access the S3 bucket and search for content using the file name, download the content, and perform data extraction or data processing. Let’s say at some point you want to search the S3 by object data, metadata, or retrieve a few data entries from the file. In this article, I’m going to explain how you can achieve all these search capabilities with AWS S3, Lambda andDynamoDB.</p><p>I’m going to use a very typical architecture that depicts how a client application accesses AWS S3 to retrieve files/objects. The execution flow is as follows: A user can upload a file to AWS S3, and then retrieve a file by making an API call to the application with a file name. The application server accesses the AWS S3 bucket and searches for the object with the given name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NRT4Z4UgRbHGUuGzZZQj3w.png" /></figure><p>Now, let’s imagine the application was updated to require advanced search capabilities for content within the S3 buckets. This includes search options such as company ID, employee ID, company name, and grouping documents by business name, along with metadata like the upload date.We can achieve these custom search options by integrating a Lambda function and DynamoDB into our current system.</p><p>In this enhanced architecture, in addition to the previous components, we now have a Lambda function and the AWS DynamoDB service. Once an object is uploaded to the S3 bucket, we can react to changes using the Lambda function triggered by S3 Events. When a new object is created, an event is published to the Lambda function, which then begins to index data into DynamoDB. Within the Lambda function, we can determine the types of information we want to index. With this setup, you can now perform complex queries utilizing the advanced query capabilities of AWS DynamoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mz4Ba8tfS_Bg4BQ4wp8NTw.png" /></figure><p>This architecture is better suited for systems that frequently execute complex queries requiring fast response times. In such cases, indexing with DynamoDB might be more suitable.</p><h3>What the different between AWS S3 Select and this custom indexing solution ?</h3><p>AWS S3 Select allows you to perform SQL-like queries directly on S3 objects. These queries can filter rows, select specific columns, and even perform simple aggregations and transformations on the data, although they are limited to executing simple SQL statements. However, it cannot handle complex queries and is restricted to a few data types such as CSV, JSON, and Apache Parquet. With the custom indexing solution, you have options for different file types, only constrained by AWS Lambda’s limitations.</p><p>Cost-wise, AWS S3 Select is the more affordable option. With the custom indexing solution, you need to consider Lambda execution costs and DynamoDB costs. Using this solution can become more expensive for larger datasets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dfd99903565" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animate only MUI Fab]]></title>
            <link>https://medium.com/@paulallles/animate-only-mui-fab-d6c602413438?source=rss-e02faed963e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6c602413438</guid>
            <dc:creator><![CDATA[Paul Alles]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 10:41:51 GMT</pubDate>
            <atom:updated>2024-03-07T12:51:18.416Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqXA0IMViTT3N-tBb3o1SA.jpeg" /></figure><p>I came across the MUI Fab component while searching for a way to highlight icons in a sidebar menu. Essentially, my requirement was to highlight the icon with a circular background when a user clicks on that icon or visits the page navigated to by the icon. I was looking for a straightforward approach and found the MUI Fab component to be a perfect fit. In this article, I will explain how to achieve icon highlighting using the MUI Fab and discuss the issues I encountered with MUI Fab animations.</p><p>There are several ways to animate the MUI Fab component and the icon included within the component, but I only wanted to animate the Fab component, not the icon. After conducting a few tests, I understood that only the width property enabled me to achieve the desired effect, not the height. As you can see in my sample code, I used the width property to change the visibility behaviour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*uD3AEgl5-9Rvo7TkXdmblg.gif" /></figure><pre>import { Fab } from &#39;@mui/material&#39;;<br>import HomeIcon from &#39;@mui/icons-material/Home&#39;;<br>import DashboardIcon from &#39;@mui/icons-material/Dashboard&#39;;<br>import Person2Icon from &#39;@mui/icons-material/Person2&#39;;<br><br>const FabTesting = () =&gt; {<br>return (<br>    &lt;Box&gt;<br>            &lt;Fab<br>                size=&quot;large&quot;<br>                sx={{<br>                    width: &#39;0px&#39;,<br>                    &#39;&amp;:hover&#39;: {<br>                        width: &#39;56px&#39;,<br>                    },<br>                }}<br>            &gt;<br>                &lt;HomeIcon fontSize=&quot;medium&quot; /&gt;<br>            &lt;/Fab&gt;<br>        &lt;/Box&gt;<br>    );<br>};<br><br>export default FabTesting;</pre><p>I also tried to incorporate the height property to introduce a radial expansion effect to this animation, but there was a hiccup. The MUI Fab starts to expand with a predefined height, and only the width starts from zero. That’s why you can see an ugly jump in height when the mouse pointer leaves the hover area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*RfQGTZkBon1TZXHHV9bcag.gif" /></figure><pre>import { Fab } from &#39;@mui/material&#39;;<br>import HomeIcon from &#39;@mui/icons-material/Home&#39;;<br>import DashboardIcon from &#39;@mui/icons-material/Dashboard&#39;;<br>import Person2Icon from &#39;@mui/icons-material/Person2&#39;;<br><br>const FabTesting = () =&gt; {<br>return (<br>    &lt;Box&gt;<br>        &lt;Fab<br>            sx={{<br>                width: &#39;0px&#39;,<br>                height: &#39;0px&#39;,<br>                transition: &#39;width 0.5s, height 0.5s&#39;,<br>                &#39;&amp;:hover&#39;: {<br>                    width: &#39;56px&#39;,<br>                    height: &#39;56px&#39;,<br>                },<br>            }}<br>        &gt;<br>            &lt;Person2Icon fontSize=&quot;medium&quot; /&gt;<br>        &lt;/Fab&gt;<br>    &lt;/Box&gt;<br>    );<br>};<br><br>export default FabTesting;</pre><p>So, my solution was to start the radial expansion effect not from zero width but from a height that doesn’t cause a jump effect. I thought I might be able to achieve a smooth transition with CSS opacity to address the MUI Fab height issue, but I still couldn’t find an effective solution to resolve this issue. If you have a solution, please leave a comment. I used MUI Version 5.15.11 for all the sample implementations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*RJyIid7WkX08Zd2gFb1Vgw.gif" /></figure><pre>import { Box, Fab, styled } from &#39;@mui/material&#39;;<br>import HomeIcon from &#39;@mui/icons-material/Home&#39;;<br>import DashboardIcon from &#39;@mui/icons-material/Dashboard&#39;;<br>import Person2Icon from &#39;@mui/icons-material/Person2&#39;;<br><br>const FabTesting = () =&gt; {<br><br>const MyFabComponent = styled(Fab)({<br>    size: &#39;large&#39;,<br>    width: &#39;35px&#39;,<br>    height: &#39;35px&#39;,<br>    transition: &#39;width 0.5s, height 0.5s&#39;,<br>    &#39;&amp;:hover&#39;: {<br>        width: &#39;56px&#39;,<br>        height: &#39;56px&#39;,<br>    },<br>});<br><br>const MyBoxComponent = styled(Box)({<br>    display: &#39;flex&#39;,<br>    justifyContent: &#39;center&#39;,<br>    alignItems: &#39;center&#39;,<br>});<br><br>return (<br>    &lt;Box display=&quot;flex&quot; gap={3}&gt;<br>        &lt;MyBoxComponent&gt;<br>           &lt;MyFabComponent&gt;<br>                &lt;HomeIcon fontSize=&quot;medium&quot; /&gt;<br>            &lt;/MyFabComponent&gt;<br>        &lt;/MyBoxComponent&gt;<br>        &lt;MyBoxComponent&gt;<br>            &lt;MyFabComponent&gt;<br>                &lt;DashboardIcon fontSize=&quot;medium&quot; /&gt;<br>            &lt;/MyFabComponent&gt;<br>        &lt;/MyBoxComponent&gt;<br>        &lt;MyBoxComponent&gt;<br>            &lt;MyFabComponent&gt;<br>                &lt;Person2Icon fontSize=&quot;medium&quot; /&gt;<br>            &lt;/MyFabComponent&gt;<br>        &lt;/MyBoxComponent&gt;<br>    &lt;/Box&gt;<br>    );<br>};<br><br>export default FabTesting;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6c602413438" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SVG Viewport and Viewbox]]></title>
            <link>https://medium.com/@paulallles/svg-viewport-and-viewbox-9bde17fd9324?source=rss-e02faed963e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bde17fd9324</guid>
            <dc:creator><![CDATA[Paul Alles]]></dc:creator>
            <pubDate>Mon, 12 Feb 2024 17:54:30 GMT</pubDate>
            <atom:updated>2024-02-12T17:54:30.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OF7v_dDC14tSkriA8RHwqQ.jpeg" /></figure><p>In the realm of web graphics, Scalable Vector Graphics (SVG) offer a unique blend of flexibility and clarity. Unlike traditional raster images, SVGs maintain their crispness regardless of scaling, making them ideal for logos, icons, and illustrations. Two fundamental concepts that determine how SVG elements are displayed within their containers are the SVG `viewBox` and the SVG viewport. Understanding these concepts empowers you to precisely control the visibility and scaling of your vector artwork.</p><blockquote>Before diving deeper, let me explain why I wanted to write an article about the SVG Viewport and ViewBox. I was tasked with developing a dashboard that displays a part of the world map and some stats about each specific country. While researching this requirement, I encountered the concept of an SVG Map. This area is fascinating and holds enormous potential for artistically visualizing components. During my work, the SVG Viewport and ViewBox played a significant role, and I’m here to explain the meaning and capabilities of these features.</blockquote><blockquote>First, let’s clarify the difference between raster images and SVG images. Raster images are made up of a grid of pixels, each with a specific color value. Think of them as tiny dots of color that come together to form an image. On the other hand, SVG images are defined by mathematical formulas and instructions, rather than pixels. This makes them resizable without distorting the image quality, as they consist of instructions on how to draw lines, shapes, and curves.</blockquote><p>Let’s focus on the Viewport. The viewport is the actual rectangular area where your SVG content gets displayed. It’s established by the `width` and `height` attributes within your `&lt;svg&gt;` tag. If you don’t define these attributes, the viewport will take the size of its parent container, based on the default SVG content size.</p><pre>&lt;svg width=&quot;400&quot; height=&quot;200&quot;&gt;&lt;/svg&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*-_CwtrV3HjnIxH_8YGtQdA.png" /></figure><p>The viewBox acts as a coordinate system and zoom control for the contents within the SVG. It’s defined by four values, usually specified within the tag <strong><em>&lt;svg&gt;</em></strong> as <strong><em>viewBox=”min-x min-y width height”</em></strong></p><ul><li><strong><em>min-x min-y</em></strong>: The coordinates of the top left corner of the viewBox.</li><li><strong><em>width height</em></strong>: The viewBox&#39;s dimensions.</li></ul><pre>&lt;svg viewBox=&quot;0 0 400 400&quot; &gt;<br>&lt;/svg&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*VTD0mlDTmjwdvqNGP8oBVQ.png" /></figure><h4>How to collaborate Viewbox and Viewport</h4><p>The viewport defines the outer boundaries of what’s visible, while the viewBox establishes what’s inside the frame and how it’s arranged.</p><ul><li><strong>Changing the viewBox Impacts the Display:</strong> Altering the viewBox values allows you to: <br>- <strong>Zoom:</strong> Focus in or out on a particular region of your SVG.<br>- <strong>Pan:</strong> Shift the focus to a different section of your artwork.</li></ul><p><strong>Conclusion</strong>.</p><p>The relationship between viewport and viewBox determines how your SVG graphic is scaled and positioned. Mastering this concept is key to controlling the presentation of your vector graphics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bde17fd9324" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Validation With Yup]]></title>
            <link>https://medium.com/@paulallles/validation-with-yup-bb12565c1f9d?source=rss-e02faed963e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb12565c1f9d</guid>
            <dc:creator><![CDATA[Paul Alles]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 16:40:25 GMT</pubDate>
            <atom:updated>2023-09-25T16:40:25.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pLiWUrglmnzfBYf1XJ4TA.jpeg" /></figure><p>Yup is a library for validating user input in JavaScript that follows a structured and declarative approach. It provides a user-friendly syntax for defining validation schemas, and a comprehensive set of validation rules to ensure that your data is reliable and accurate.</p><p>With Yup, you can easily validate various types of data, from simple values like strings, numbers, and dates, to more complex data structures like nested objects and arrays. Additionally, you can tailor validation rules and error messages to match your specific requirements.</p><p>One of the primary advantages of using Yup is that it plays well with other JavaScript libraries and frameworks, like Formik and React, which makes it a popular choice for front-end development.</p><p>Some of the features of yup</p><ul><li><strong>Schema-based validation</strong>: Yup allows you to define a schema for your data, and validate that data against the schema. The schema defines the structure of your data, as well as the validation rules for each field.</li><li><strong>Simple and intuitive syntax</strong>: Yup provides a clean and easy-to-understand syntax for defining validation rules. The syntax is similar to that of chaining methods, so it’s easy to read and write.</li><li><strong>Rich set of validation rules</strong>: Yup provides a wide range of built-in validation rules, such as required fields, string length limits, email validation, and more. You can also define custom validation rules to suit your specific needs.</li><li><strong>Custom error messages</strong>: Yup allows you to define custom error messages for your validation rules, so you can provide more informative feedback to your users.</li><li><strong>Integration with other libraries</strong>: Yup integrates well with other JavaScript libraries and frameworks, such as React and Formik, making it a popular choice for front-end developers.</li></ul><p>Javascript Validation Example:</p><p>Install Yup Package: npm install yup</p><p>First of all to use Yup validation, you first need to create a Yup <strong>schema</strong> object. This object defines the expected structure and validation rules for your form data. Then we can trigger validation rules whereever you want.</p><p>Here is a basic yup validation in Javascript. We can use this kind of validation for backend.</p><pre>import * as yup from &#39;yup&#39;;<br><br>// schema for yup validation<br>const schema = yup.object().shape({<br>  name: yup.string().required(),<br>  email: yup.string().email().required(),<br>  age: yup.number().positive().integer().required(),<br>  password: yup.string().required().min(6),<br>  confirmPassword: yup.string().oneOf([yup.ref(&#39;password&#39;), null], &#39;Passwords must match&#39;),<br>});<br><br>// data object that need to be validated<br>const data = {<br>  name: &#39;John Doe&#39;,<br>  email: &#39;john.doe@example.com&#39;,<br>  age: 30,<br>  password: &#39;password123&#39;,<br>  confirmPassword: &#39;password123&#39;,<br>};<br><br>// trigger validation rule<br>schema.validate(data)<br>  .then(valid =&gt; console.log(valid))<br>  .catch(error =&gt; console.log(error));</pre><p>Yup validation can be used with or without a form library. If you are using a form library such as Formik, you can pass the Yup schema object to the library’s validationSchema prop. This will allow the library to automatically handle validation for you.</p><p>Example validation with Formik library<br>In this example, Formik will automatically handle validation for the form fields. If the user enters invalid data, Formik will display error messages next to the relevant fields.</p><pre>import * as Yup from &#39;yup&#39;;<br>import Formik from &#39;formik&#39;;<br><br>const schema = Yup.object().shape({<br>  name: Yup.string().required(),<br>  email: Yup.string().email().required(),<br>});<br><br>const MyForm = () =&gt; {<br>  const [formData, setFormData] = useState({<br>    name: &#39;&#39;,<br>    email: &#39;&#39;,<br>  });<br><br>  const handleChange = (event) =&gt; {<br>    const { name, value } = event.target;<br><br>    setFormData({<br>      ...formData,<br>      [name]: value,<br>    });<br>  };<br><br>  const handleSubmit = async (event) =&gt; {<br>    event.preventDefault();<br><br>    const errors = await schema.validate(formData);<br><br>    if (errors) {<br>      // Handle validation errors<br>    } else {<br>      // Submit the form data to your backend<br>    }<br>  };<br><br>  return (<br>    &lt;Formik<br>      initialValues={formData}<br>      validationSchema={schema}<br>      onSubmit={handleSubmit}<br>    &gt;<br>      {({ values, errors, handleChange, handleSubmit }) =&gt; (<br>        &lt;form onSubmit={handleSubmit}&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            name=&quot;name&quot;<br>            value={values.name}<br>            onChange={handleChange}<br>            placeholder=&quot;Enter your name&quot;<br>          /&gt;<br>          &lt;input<br>            type=&quot;email&quot;<br>            name=&quot;email&quot;<br>            value={values.email}<br>            onChange={handleChange}<br>            placeholder=&quot;Enter your email&quot;<br>          /&gt;<br>          &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>        &lt;/form&gt;<br>      )}<br>    &lt;/Formik&gt;<br>  );<br>};</pre><p>Example validation without form library.<br>In this example, we first create a Yup schema object to define the expected structure and validation rules for our form data. Then, we create a validateFormData() function to validate the form data using the Yup schema. The validateFormData() function returns an error object if the data is invalid, or undefined if the data is valid.</p><pre>import * as Yup from &#39;yup&#39;;<br>// schema<br>const schema = Yup.object().shape({<br>  name: Yup.string().required(),<br>  email: Yup.string().email().required(),<br>});<br><br>// method to trigger validation and return the error message<br>const validateFormData = async (formData) =&gt; {<br>  const errors = await schema.validate(formData);<br><br>  if (errors) {<br>    return errors;<br>  } else {<br>    return undefined;<br>  }<br>};</pre><p>Html form that need to be validated. form id(“my-form”) is used to refer this form for validation check.</p><pre>&lt;form id=&quot;my-form&quot;&gt;<br>  &lt;input type=&quot;text&quot; name=&quot;name&quot; placeholder=&quot;Enter your name&quot;&gt;<br>  &lt;input type=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;Enter your email&quot;&gt;<br>  &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>In this example, we listen for the submit event on the form. When the form is submitted, we call the validateFormData() function to validate the form data. If any errors are found, we handle them accordingly. Otherwise, we know that the form data is valid and we can submit it to our backend.</p><pre>const form = document.querySelector(&#39;#my-form&#39;);<br><br>form.addEventListener(&#39;submit&#39;, async (event) =&gt; {<br>  event.preventDefault();<br><br>  const formData = new FormData(form);<br><br>  const errors = await validateFormData(formData);<br><br>  if (errors) {<br>    // Handle validation errors<br>  } else {<br>    // The form data is valid<br>  }<br>});</pre><p>Yup validation is a powerful and flexible tool for validating form data in JavaScript applications. It is easy to use and provides a wide range of validation features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb12565c1f9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>