<?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 DSC KGEC on Medium]]></title>
        <description><![CDATA[Stories by DSC KGEC on Medium]]></description>
        <link>https://medium.com/@dsckgec?source=rss-203c83e893ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BFXoqU2Cj3GpFK79OrtCaA.png</url>
            <title>Stories by DSC KGEC on Medium</title>
            <link>https://medium.com/@dsckgec?source=rss-203c83e893ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:57:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dsckgec/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[Feature scaling in machine learning: -]]></title>
            <link>https://medium.com/@dsckgec/feature-scaling-in-machine-learning-6d6eab5744d2?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d6eab5744d2</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[feature-scaling]]></category>
            <category><![CDATA[gdsc]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Sat, 26 Nov 2022 17:08:43 GMT</pubDate>
            <atom:updated>2022-11-26T17:08:43.034Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Feature Scaling is a technique to standardize the independent features present in the data in a fixed range. It is performed during the data pre-processing to handle highly varying magnitudes or values or units. If feature scaling is not done, then a machine learning algorithm tends to weigh greater values, higher and consider smaller values as the lower values, regardless of the unit of the values. What it does is keep the distribution of the data, the correlation and covariance absolutely the same however scales every independent or the feature matrix columns to a smaller scale. We do this as most of the ML algorithms problems perform significantly better after scaling.</strong></p><p><strong>There are mainly two types of feature scaling, the first one is Standardization or Z-score normalization, another one is Normalization.</strong></p><p><strong>Standardization: — The result of standardization (or Z-score normalization) is that the features will be rescaled to ensure the mean and the standard deviation to be 0 and 1, respectively.</strong></p><p><strong>Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*aE1VL4Pg3u1GHoDUFtp_DA.png" /></figure><p><strong>Normalization: — Normalization is a technique often applied as part of data preparation for machine learning. The goal of normalization is to change the values of numeric columns in the dataset to use a common scale, without distorting differences in the ranges of values or losing information.</strong></p><p><strong>There are mainly three techniques for Normalization,</strong></p><p>· <strong>Min-Max Scaling</strong></p><p>· <strong>Mean Normalization</strong></p><p>· <strong>Max absolute Scaling</strong></p><p><strong>Min-max Scaling: — Min-max normalization is one of the most common ways to normalize data. For every feature, the minimum value of that feature gets transformed into a 0, the maximum value gets transformed into a 1, and every other value gets transformed into a decimal between 0 and 1.</strong></p><p><strong>Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*gZ7LfECXMGeIZElLjIIK2A.png" /></figure><p><strong>Mean Normalization: — The data can be normalized by subtracting the mean (µ) of each feature and a division by the standard deviation (σ). This way, each feature has a mean of 0 and a standard deviation of 1.</strong></p><p><strong>Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*7IJBrunxSBYag-15kryIKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*s6s-9_9AOCb6mmVWiq4iUw.png" /></figure><p><strong>Max-Absolute Scaling: — Maximum absolute scaling scales the data to its maximum value; that is, it divides every observation by the maximum value of the variable. The result of this transformation is a distribution in which the values vary approximately within the range of -1 to 1.</strong></p><p><strong>Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*-8r7wvIejTpMKKZbZWLgHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*xd2rsBwqaaouK7ZObS9EbA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d6eab5744d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google’s Cloud Platform]]></title>
            <link>https://medium.com/@dsckgec/googles-cloud-platform-1264918d8c27?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/1264918d8c27</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Fri, 18 Nov 2022 15:02:00 GMT</pubDate>
            <atom:updated>2022-11-18T15:02:00.453Z</atom:updated>
            <content:encoded><![CDATA[<p>Google’s Cloud Platform (GCP) is a collection of Google’s computing resources, made available via services to the general public cloud offering.</p><p>The GCP resources consist of physical hardware infrastructure — computers, hard disk drives, solid state drives, and networking — contained within Google’s globally distributed data centres, where any of the components are custom designed using patterns similar to those available in the Open Compute Project.</p><p>This hardware is made available to customers in the form of virtualized resources, such as virtual machines (VMs), as an alternative to customers building and maintaining their own physical infrastructure.</p><p>As a public cloud offering, software and hardware products are provided as integrated services that provide access to the underlying resources. GCP offers over 50 services including Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) offerings in the categories of Compute, Storage &amp; Databases, Networking, Big Data, Machine Learning, Identity &amp; Security, and Management &amp; Developer tools.</p><p>GCP is hosted on the same underlying infrastructure that Google uses internally for end-user products including Google Search and YouTube.</p><p>These services can be used independently or in combination for developers and IT professionals to construct their own, custom cloud-based infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*JvP70cI9jXfpHL7k" /></figure><h3>Services provided by Google Cloud Platform(GCP)</h3><h3>Storage</h3><p><strong>Cloud Storage:</strong> Cloud Storage is a RESTful service for storing and accessing your data on Google’s infrastructure. The service combines the performance and scalability of Google’s cloud with advanced security and sharing capabilities.</p><p><strong>Persistent Disk:</strong> Persistent Disk is a durable and high performance block storage service for Google Cloud Platform. Persistent Disk provides SSD and HDD storage that can be attached to instances running in either Compute Engine or Google Kubernetes Engine.</p><p><strong>Cloud Filestore:</strong> Cloud Filestore is a scalable and highly available shared file service fully-managed by Google. Cloud Filestore provides persistent storage ideal for shared workloads. It is best suited for enterprise applications requiring persistent, durable, shared storage which is accessed by NFS or requires a POSIX compliant file system.</p><p><strong>Cloud Storage for Firebase:</strong> Cloud Storage for Firebase adds customizable Google security (via Firebase Security Rules for Cloud Storage) to file uploads and downloads for your Firebase apps, as well as robust uploads and downloads regardless of network quality through the Firebase SDK. Cloud Storage for Firebase is backed by Cloud Storage, a service for storing and accessing your data on Google’s infrastructure.</p><h3>Databases</h3><p><strong>Cloud Bigtable:</strong> Cloud Bigtable is a fast, fully-managed, highly-scalable NoSQL database service. It is designed for the collection and retention of data from 1TB to hundreds of PB.</p><p><strong>Datastore</strong>: Datastore is a fully-managed, schemaless, non-relational datastore. It provides a rich set of query capabilities, supports atomic transactions, and automatically scales up and down in response to load. It can scale to support an application with 1,000 users or 10 million users with no code changes.</p><p><strong>Firestore:</strong> Firestore is a NoSQL document database for storing, syncing, and querying data for mobile and web apps. Its client libraries provide live synchronization and offline support, while its security features and integrations with Firebase and Google Cloud Platform accelerate building serverless apps.</p><p><strong>Memorystore:</strong> Memorystore, which includes Memorystore for Redis and Memorystore for Memcached, provides a fully-managed in-memory data store service that allows customers to deploy distributed caches that provide sub-millisecond data access.</p><p><strong>Cloud Spanner:</strong> Cloud Spanner is a fully-managed, mission-critical relational database service. It is designed to provide a scalable online transaction processing (OLTP) database with high availability and strong consistency at global scale.</p><p><strong>Cloud SQL:</strong> Cloud SQL is a web service that allows you to create, configure, and use relational databases that live in Google’s cloud. It is a fully-managed service that maintains, manages, and administers your databases, allowing you to focus on your applications and services.</p><h3><strong>Compute</strong></h3><p><strong>App Engine</strong>: App Engine enables you to build and host applications on the same systems that power Google applications. App Engine offers fast development and deployment; simple administration, with no need to worry about hardware, patches or backups; and effortless scalability.</p><p><strong>Batch</strong>: Batch is a fully-managed service that allows you to create batch jobs at scale. The service dynamically provisions certain Google Cloud resources, schedules your batch job on the resources, manages the queue for the job, and executes the job. Batch is natively integrated with Google Cloud services for storage, logging, monitoring, and more.</p><p><strong>Compute Engine</strong>: Compute Engine offers scalable and flexible virtual machine computing capabilities in the cloud, with options to utilise certain CPUs, GPUs, or Cloud TPUs. You can use Compute Engine to solve large-scale processing and analytic problems on Google’s computing, storage, and networking infrastructure.</p><p><strong>Google Cloud VMware Engine (GCVE)</strong>: GCVE is a managed VMware-as-a-Service that is specifically designed for running VMware workloads on Google Cloud Platform. GCVE enables customers to run VMware virtual machines natively in a dedicated, private, software-defined data centre.</p><h3>Media and Gaming</h3><p><strong>Game Servers:</strong> Game Servers is a managed service that enables game developers to deploy and manage their dedicated game servers across multiple Agones clusters around the world through a single interface.</p><p><strong>Live Stream API:</strong> Live Stream API is a cloud-based live encoder that processes high-quality contribution feeds for 24x7 live linear or live events and prepares the streams for digital distribution. It compresses the video and audio elementary streams with the latest video codecs and packages the streams in standardized container formats to reach all IP connected devices.</p><p><strong>Transcoder API</strong>: Transcoder API can batch convert media files into optimized formats to enable streaming across web, mobile, and living room devices. It provides fast, easy to use, large-scale processing of advanced codecs while utilizing Google’s storage, networking, and delivery infrastructure.</p><p><strong>Video Stitcher API:</strong> Video Stitcher API enables users to dynamically insert content or ads using server-side video insertion technology. Video and ads are conditioned into a single stream for video on demand (VOD) or live streams to deliver flexible and target personalization at scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1264918d8c27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose]]></title>
            <link>https://medium.com/@dsckgec/jetpack-compose-a53b2e35c455?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/a53b2e35c455</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[composer]]></category>
            <category><![CDATA[jetpack]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Tue, 01 Nov 2022 16:29:44 GMT</pubDate>
            <atom:updated>2022-11-01T16:29:44.695Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Developed by Google, Jetpack Compose is a new modern, declarative UI toolkit for building quick and efficient user interface components for Android applications. It leverages the power and expressiveness of the Kotlin language and is unbundled, similar to other Jetpack libraries, ensuring consistency across different API versions. It comes with all the functionality needed to build a rich and responsive application UI and features full interoperability with current Android views, making it easy for developers to implement in existing projects.</p><p>But why choose to Compose when Android already has robust UI creation tools using views, widgets, and XML? Due to Compose’s powerful declarative syntax and structure, developers can create rich UI many times faster than with the old toolset. Due to how state and data are handled in Compose, developers are less likely to make costly errors and introduce hard-to-find bugs in their codebase.</p><h3><strong>UI and State</strong></h3><p>With many imperative, object-oriented UI toolkits, the UI is initialized by instantiating a tree of widgets. This is often done by inflating an XML layout file. Each widget maintains its internal state and exposes getter and setter methods that allow the app logic to interact with the widget. In contrast to this, in Compose’s declarative approach, widgets are relatively stateless and do not expose setter or getter functions. Widgets are not exposed as objects. The composable is responsible for transforming the current application state into a UI every time the observable data updates.</p><p>The concept where the UI is changed directly to reflect changes in the app’s state is not new and is embraced by many different modern development platforms. Some of these are also used for Android development, such as React and Flutter. The new Jetpack Compose toolkit is an evolution of this paradigm. At its core, it emits UI directly, smartly modifying only the views affected by the data change. In this way, the UI always reflects the current state of the app’s data and prevents issues caused by developers manually handling the synchronization task themselves.</p><p>When using Compose, the information flow will be unilateral — it will only flow in one direction from the data state to the views. This means that architectures such as MVP with a two-way communication flow might be more challenging to integrate with Compose. Preferable architectures such as Google’s recommended MVVM can use LiveData and ViewModels to observe state changes and automatically emit new UI using Compose if needed.</p><h3><strong>Getting Started</strong></h3><p>The core building blocks of Jetpack Compose are the composable functions. These functions take some input and describe a part of the app’s UI, generating what’s shown on the screen.</p><p>A composable function is created by adding the <strong><em>@Composable</em></strong> annotation to the function name. Similar to coroutines, composable functions can only be called from within the scope of other composable functions.</p><p>Composable functions can accept parameters that allow the app logic to describe the UI. These parameters can also include LiveData objects which can be updated dynamically. Each time a parameter is changed, the composable function will be triggered again so that a new UI can be emitted to reflect the change. Composable functions emit UI hierarchy by calling other composable functions. In this example, the <strong><em>Text()</em></strong> function creates the text UI element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8A_ZXLwC4C_C8ork" /></figure><p>Composable functions don’t return anything. They describe the desired screen state and directly emit UI instead of constructing UI widgets. That is why they do not need to return anything.</p><p>Composable functions can be previewed inside the Android Studio IDE by adding the <strong><em>@Preview</em></strong> annotation before <strong><em>@Composable.</em></strong> Currently, only functions without any parameters can be previewed in this way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JPkEZQlQL494iUI3" /></figure><h3><strong>Recomposition</strong></h3><p>In the old imperative UI model, to change a widget, a setter must be called on the widget to change its internal state. In Compose, the composable function is automatically called again when there is a change in the data. This causes the function to be recomposed, and in turn, the widgets emitted by the function are redrawn, if necessary, with the new data. The Compose framework can intelligently recompose only the components that have changed.</p><p>The process of calling your composable functions again when inputs change is called recomposition. When Compose recomposes based on new inputs, it smartly only calls the functions or lambdas in the code that might have changed and skipped the rest. By skipping all functions or lambdas that don’t have changed parameters, Compose can recompose efficiently and greatly improve the performance of the UI.</p><p>Composable functions might be re-executed as often as every frame, such as when an animation is being rendered. It is very important to keep these functions fast to avoid jank during animations and view creation. Suppose expensive operations need to be executed, such as reading from shared preferences or making complex calculations. In that case, these should be done in a background coroutine and their values passed to the composable function as a parameter. Ignoring these best practices could lead to unresponsive UI and stutter, especially when scrolling lists and animating components.</p><p>Things to be aware of when using Compose:</p><ul><li>Composable functions can execute in any order.</li><li>Composable functions can execute in parallel.</li><li>Recomposition skips as many composable functions and lambdas as possible.</li><li>The recomposition is optimistic and may be canceled.</li><li>A composable function might be run quite frequently, as often as every frame of an animation.</li></ul><h4><strong>Layouts and UI Hierarchy</strong></h4><p>At their core, composable functions are used to emit UI elements. A single function can emit several UI elements. However, developers should guide how these should be arranged to achieve the desired outcome. Special layout functions can be used, like a <strong><em>Column</em></strong> that places items vertically on the screen, or a <strong><em>Row </em></strong>that places them horizontally. Both <strong><em>Column </em></strong>and <strong><em>Row </em></strong>support configuring the alignment of the elements they contain. To display elements one on top of the other, developers can use the <strong><em>Box </em></strong>function.</p><p>These fundamental building blocks are often enough to create most layout configurations, but they can also be combined to form more elaborate structures if required. In contrast to Android views, where developers need to avoid nested layouts for performance reasons, Compose handles nested layouts very efficiently, making them a great way to design a complicated UI.</p><p>To customize, decorate, and augment composable, the Compose toolkit uses modifiers. These are standard Kotlin objects which can be created by calling one of the <strong><em>Modifier </em></strong>class functions. These functions can be chained together to set multiple properties at once. In this case, the order of chaining is important, as each function makes changes to the modifier object returned by the previous one so that the sequence will affect the final result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3TwRnb5VhR64NnhX" /></figure><p>Modifiers enable developers to customize a large set of things, including:</p><ul><li>Change the composable’s size, layout, behavior, and appearance.</li><li>Add information, like accessibility labels.</li><li>Process user input.</li><li>Add high-level interactions, like making an element clickable, scrollable, draggable, etc.</li></ul><h4><strong>Lists</strong></h4><p>The list component is a fundamental building block of every Android app. Its main feature is the ability to render only the currently visible elements on the screen, thus improving the list’s performance and responsiveness. In the past, this was achieved by the Android RecyclerView which required cumbersome adapter classes to be created and maintained. Creating list headers and footers was also a pain, especially if these had custom behavior such as sticky headers.</p><p>With Jetpack Compose this functionality can be achieved with just a few lines of code using the new lazy composable functions, such as the <strong><em>LazyColumn()</em></strong> function. These are different from other Compose layout functions, as they have their own DSL (domain-specific language) used to achieve the desired behavior. The main building block used by the Compose list is the <strong><em>items()</em></strong> function used to describe and lay out the items that will be displayed on the screen. This can be done by supplying the function with a list of objects that will emit the UI for a given item in the list.</p><p>Just like with RecyclerView, lists created with Compose can be arranged in different layout patterns. LazyColumn is used for vertical lists, while horizontal lists can be created with LazyRow. To create more complex grid patterns, LazyVerticalGrid can be used.</p><p>The app will need to react and listen to scroll position and item layout changes in some cases. The lazy components handle this use-case by employing the <strong><em>rememberLazyListState() </em></strong>function that provides a reference that tracks the list’s current state.</p><p>While it is a best practice to supply all the needed data upfront as parameters to the Compose function, there will be times when it will be required to execute code asynchronously inside the function itself. The recommended way to do this is with the new coroutines introduced in Kotlin. To use coroutines inside a Compose function, a coroutine scope has to be acquired first. This is achieved by calling the special <strong><em>rememberCouroutineScope()</em></strong> function. After that, we can launch the coroutine by calling <strong><em>scope.launch()</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KkidsPqJpdBztpwP" /></figure><h4>Conclusion</h4><p>The Jetpack Compose toolkit is being developed rapidly by Google and will soon become the preferred way of creating UI for Android applications. It will be beneficial to many developers to get acquainted with it as early as possible. This new powerful tool brings many improvements to the UI creation process, allowing users to achieve more with less code and produce a highly maintainable and less error-prone codebase.</p><p>Jetpack Compose not only bring benefits, though. It presents additional challenges that have to be overcome by developers. They will have to learn and adapt to an entirely new way of building the user interface of their apps while being more mindful of the performance and structure of their UI code. A key factor to successfully implementing Compose will be obtaining a fundamental understanding of how recomposition and state work inside the toolkit. These good practices will help developers achieve better optimization and performance and improve their app’s structure and data flow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a53b2e35c455" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript String Methods]]></title>
            <link>https://medium.com/@dsckgec/javascript-string-methods-5c9e93971eb5?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c9e93971eb5</guid>
            <category><![CDATA[string-methods]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[javascript-string]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Sun, 30 Oct 2022 16:34:00 GMT</pubDate>
            <atom:updated>2022-10-30T16:55:19.991Z</atom:updated>
            <content:encoded><![CDATA[<p>String methods are very helpful while working with strings</p><p>let the string be</p><pre>var str=&quot;this is a string inside a string&quot;</pre><h4><strong>String length</strong></h4><p>The length property returns the length of the string after considering all the white spaces.</p><pre>var len = str.length;<br>console.log(len);</pre><pre>Output = 32</pre><h4><strong>The indexOf() Method</strong></h4><p>The first occurrence of a substring: As we see in str we have two occurrences of “string” so this method finds the index of the first occurrence of “string” in str.</p><pre>var position = str.indexOf(&#39;string&#39;);<br>console.log(position);</pre><pre>Output = 10</pre><p>This method also accepts a second parameter as the starting position for the search:</p><pre>var position = str.indexOf(&#39;string&#39;,11);<br>console.log(position);</pre><pre>Output =26</pre><h4>The lastIndexOf() methods</h4><p>The lastIndexOf() methods searches backward (from the end to the beginning)</p><p>Last occurrence of a substring</p><pre>var position = str.lastIndexOf(&#39;string&#39;);<br>console.log(position);</pre><pre>Output =26</pre><p>If the second parameter is 15, the search starts at position 15, and the search goes till the beginning of the string.</p><pre>var position = str.lastIndexOf(&#39;string&#39;,15);<br>console.log(position);</pre><pre>Output =10</pre><h4><strong>The substring() Method</strong></h4><pre>NOTE: Substring method can&#39;t take negative values of index</pre><pre>var substr1 = str.substring(1, 6);<br>console.log(substr1);</pre><pre>Output= his i</pre><h4><strong>The slice() Method</strong></h4><p>It’s the same as the substring() method but the difference is that it can take the negative value of an index</p><pre>var substr1 = str.slice(1, -19);<br>console.log(substr1);</pre><pre>Output = his is a str</pre><h4><strong>The substr() Method</strong></h4><p>substr() is a function which returns the substring starting from index value given in the first argument to the index value given in the second argument -1</p><pre>var substr1=str.substr(1,3);<br>console.log(substr1);</pre><pre>Output = his</pre><h4>The replace() Method</h4><p>By default, the replace() method replaces only the first match</p><pre>var replaced= str.replace(&#39;string&#39;,&#39;new-word&#39;);<br>console.log(str);<br>console.log(replaced);</pre><pre>Output= this is a string inside a string<br>        this is a new-word inside a string</pre><p>To replace all matches, use a regular expression with a /g flag (global match)</p><pre>var replaced= str.replace(/string/g,&#39;soujo&#39;);<br>console.log(str);<br>console.log(replaced);</pre><pre>Output = this is a string inside a string<br>         this is a new-word inside a new-word</pre><h4><strong>The toUpperCase() Method</strong></h4><p>Changes the string to upper case</p><pre>console.log(str.toUpperCase());</pre><pre>Output = THIS IS A STRING INSIDE A STRING</pre><h4><strong>The concat() Method</strong></h4><p>concat can be used as a replacement of “+” operator. It joins two or more strings</p><pre>var newString=str.concat(&#39; new string&#39;);<br>console.log(newString);</pre><pre>Output = this is a string inside a string new string</pre><h4>The trim() Method</h4><p>trim method removes spaces only from starting and end of a String</p><pre>var strWtihWhiteSpaces= &quot;           this containes          whitespaces        &quot;;<br>console.log(strWtihWhiteSpaces);<br>console.log(strWtihWhiteSpaces.trim());</pre><pre>Output =            this containes          whitespaces        <br>         this containes          whitespaces</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c9e93971eb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to perform different types of positioning in CSS ?]]></title>
            <link>https://medium.com/@dsckgec/how-to-perform-different-types-of-positioning-in-css-9060078d6bf6?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/9060078d6bf6</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[positioning]]></category>
            <category><![CDATA[css-positioning]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 13:57:38 GMT</pubDate>
            <atom:updated>2022-10-25T15:37:48.244Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to perform different types of positioning in CSS ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*7jo8VkrVRvqCI5HeNyzFWQ.png" /></figure><p>Confused about positioning elements in a webpage? Still don’t know how to use CSS? or Looking for a variety of positioning styles for designing? Sounds like you? You’re at the right place.</p><p>Cascading Style Sheets (CSS) is a style sheet language used for designing, styling and formatting of a document written in markup languages such as HTML, XML.</p><p>Cascading Style Sheets (CSS) is a style sheet language used for designing, styling and formatting of a document written in markup languages such as HTML, XML. CSS is a commonly used language used to layout web pages and provide user-friendly interfaces. While HTML provides structure to a website, CSS is used to control presentation, formatting and layout of the webpage. Let’s now understand how is CSS used in different aspects –</p><p>With the help of CSS, we can alter the font, color, size, and spacing of the content in HTML tags. We can also align elements, split it in multiple columns, or add animations and many other decorative features as well. Alongside with designing, CSS saves a lot of time and provides a wide variety of attributes which helps to load pages faster, maintain websites efficiently and also allows multiple device compatibility.</p><p>There is a lot more to explore and learn about CSS and hence, we must utilize it as — “I<em>t’s better to be late than be dead on time.”</em></p><p>So, now let us learn about one of the most important attributes in CSS — <strong>Positioning</strong>.</p><h3>What is positioning?</h3><p>Well, the positioning in CSS sets a location of the HTML element in a document. You can position any element as you want with the help of this property. As your website project gets more detailed, using the CSS position property will make your work much easier.</p><p>There are five position properties in CSS, namely :-</p><ul><li><strong>Relative</strong></li><li><strong>Absolute</strong></li><li><strong>Fixed</strong></li><li><strong>Static</strong></li><li><strong>Sticky</strong></li></ul><p>Now, let us get to know about them one by one –</p><h3>Position: Relative</h3><p>When an element is assigned “position: relative” it will be shifted relatively from its actual position with respect to its parent element.</p><p>Example:</p><p>Let’s say we have a parent element. Within this parent element we have a child element like this –</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/0*Y1Fy7UUzqposl_DD" /></figure><p>Note that, just writing this CSS rule alone will not change anything.</p><p>To modify the position, you’ll need to apply the top, bottom, right, and left properties mentioned earlier and in that way specify where and how much you want to move the element.</p><pre>.box-1 {<br>  background-color: blue;<br>  width: 180px<br>  height: 180px;<br>}.box-2 {<br>  background-color: red;<br>  width: 180px<br>  height: 180px;<br>  position: relative;<br>  left: 50px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/0*iOIKPEkjcHKtZam4" /></figure><p>As you can see the child element takes 50px from left with respect to its parent element.</p><h3>Position: Absolute</h3><p>Position absolute takes the document out of the document flow. This means that it no longer takes up any space like a relative does.</p><p>When position absolute is used on an element, it is positioned absolutely with reference to the closest parent that has a position relative value. If there are no parent elements that have a relative position, then the absolutely positioned element will take its reference from the browser window.</p><p>Example:</p><p>Take previous example, if we use position: absolute and set left 0px in the child element we can see like this –</p><pre>.box-1 {<br>  background-color:  blue;<br>  width: 180px<br>  height: 180px;<br>}<br>.box-2 {<br>  background-color:  red;<br>  width: 70px<br>  position:  absolute;<br>  left: 0;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*0_LKzg9m2z-2OLCB" /></figure><p>It’s not even in the parent element because it is positioned relative to the body. If you want a child element moving around the parent element you can update the parent element by declaring position: relative.</p><h3>Position: Fixed</h3><p>An element with position: fixed property always stays in the same place even if we scroll the page.</p><p>Example:</p><pre>.box-1 {<br>  position: fixed;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*cYrYZB9M8MRabAqv" /></figure><p>As you can see the heading is fixed in one place, you can add top, bottom, left and right to fix this.</p><h3>Position: Static</h3><p>This is a default property in any HTML element. This means if you don’t declare position for an element in CSS, it will automatically be set to static. It puts the elements in its normal position. As a default property the top, bottom, left and right have no effect here.</p><p>Example:</p><pre>.box-1 {<br>  position:  static;<br>  left: 100px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/0*NenigOTCTWxckbmv" /></figure><p>As we can see that though we have used left:100px but it has no effect as the position is static here.</p><h3>Position: Sticky</h3><p>Position: sticky elements will initially behave like position: relative elements, but if you keep scrolling, they will get taken out of the normal flow and behave like position: fixed wherever you have positioned them.</p><p>This can be really useful if you want to stick an element that’s initially farther down the page to the top of the screen.</p><p>Example:</p><pre>.box-1  h1  {<br>  background-color:  yellow;<br>  position:  sticky;<br>  top: 0;<br>}</pre><p>The result would be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*ueLSTeClGZGC7w--" /></figure><p>See, if we scroll our content, the heading is still stuck at the top.</p><p>Positioning allows you to take elements out of normal flow and make them place at a different position in a markup language, such as by placing on the top of another element or by always remaining in the same position inside the browser interface.</p><p>CSS allows different methods to position your elements. Understanding how CSS affects the on-page alignment can improve your designing skills and the overall user experience of the page.</p><p>We hope this CSS Positioning tutorial has helped you to understand the CSS position property and its workings. Mastering CSS takes constant practice. So, keep practicing to get better at it.</p><p>Thanks for reading!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9060078d6bf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a Modal Bottom Sheet in your Flutter App without using any third party package or…]]></title>
            <link>https://medium.com/@dsckgec/how-to-create-a-modal-bottom-sheet-in-your-flutter-app-without-using-any-third-party-package-or-cff4a9dab085?source=rss-203c83e893ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/cff4a9dab085</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app]]></category>
            <category><![CDATA[modalbottomsheet]]></category>
            <dc:creator><![CDATA[DSC KGEC]]></dc:creator>
            <pubDate>Tue, 18 Oct 2022 19:41:00 GMT</pubDate>
            <atom:updated>2022-10-18T19:41:00.062Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How to create a Modal Bottom Sheet in your Flutter App without using any third party package or library ?</strong></h3><p><strong>In this blog, we are going to introduce what is a modal bottom Sheet, its utilities, how it is implemented effectively without any third party packages, customize it as per our needs, and replicate it as a multipurpose widget.</strong></p><ul><li><strong>What is a Modal Bottom Sheet?</strong></li><li><strong>Basic BoilerPlate for home.dart</strong></li><li><strong>Introduction to showModalBottomSheet widget</strong></li><li><strong>Using onPressed and controller</strong></li><li><strong>Implementing Custom Widget</strong></li><li><strong>Adjusting the Height, Width, padding etc.</strong></li><li><strong>Future Customized Modifications as per choice</strong></li></ul><p>A modal bottom sheet is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app.</p><p>A closely related widget is a persistent bottom sheet, which shows information that supplements the primary content of the app without preventing the user from interacting with the app. Persistent bottom sheets can be created and displayed with the <a href="https://api.flutter.dev/flutter/material/showBottomSheet.html"><strong>showBottomSheet</strong></a><strong> function </strong>or the <a href="https://api.flutter.dev/flutter/material/ScaffoldState/showBottomSheet.html"><strong>ScaffoldState.showBottomSheet</strong></a><strong> method</strong>.</p><p>Here, I will be guiding you to make a stylish modal bottom sheet in any screen of your app. First of all, initialize your Flutter App. Make sure to delete all the widget from the main.dart file . We will be writing all our code in a newly created home.dart file. Boilerplate for home.dart file -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*KTHrYLe3Pvsj15NfCAWCCg.jpeg" /></figure><p>Just declare a stateful widget, and create a button Show, to enable the Bottom Sheet. Now we move to the main part of creating the modal Bottom Sheet. To enable the bottom modal sheet, call the function inside onPressed of a simple Elevated Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*Dmdi6iBnh2E8zsPOBhF6jQ.jpeg" /></figure><p>Use BuildContext to preserve the State of the Application. Now you will notice that a blank short screen is popping up everytime Show is pressed.</p><p>Let’s Customize the Modal Bottom Sheet Widget by creating a custom widget namely ModalWidget. Customize it as your wish! We will be creating a Rounded Rectangular shaped widget with Padding on both sides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*HoL8VTbY9KDu5CxplkWWAA.jpeg" /></figure><p>Now there is a <strong>trick to apply padding</strong> to a modal bottom sheet. We need to change the default color of the sheet to <strong>Colors.transparent </strong>and the color of the <strong>container to White</strong>. Now you are done! Apply padding as you wish. Implement any number of widgets as per your needs. Just keep the layout tight, as the Modal Bottom Sheet should not take more than 50% of the screen size.</p><p>Final Screen :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*fSNh6eNs3Ivld_b6EOZ1DA.jpeg" /></figure><p><strong>Flutter Bottom Modal Sheet has a ton of other parameters to play with !</strong></p><p><strong>Customize as much as your wish!!</strong></p><p><em>Future&lt;T?&gt; showModalBottomSheet&lt;T&gt;(</em></p><p><em>{required BuildContext context,</em></p><p><em>required WidgetBuilder builder,</em></p><p><em>Color? backgroundColor,</em></p><p><em>double? elevation,</em></p><p><em>ShapeBorder? shape,</em></p><p><em>Clip? clipBehavior,</em></p><p><em>BoxConstraints? constraints,</em></p><p><em>Color? barrierColor,</em></p><p><em>bool isScrollControlled = false,</em></p><p><em>bool useRootNavigator = false,</em></p><p><em>bool isDismissible = true,</em></p><p><em>bool enableDrag = true,</em></p><p><em>RouteSettings? routeSettings,</em></p><p><em>AnimationController? transitionAnimationController,</em></p><p><em>Offset? anchorPoint}</em></p><p><em>)</em></p><p>Thanks for reading !!!</p><p><strong>The Source Code — </strong><a href="https://github.com/saptarshiweb/modal_bottom_sheet_tutorial"><strong>saptarshiweb/modal_bottom_sheet_tutorial (github.com)</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cff4a9dab085" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>