<?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[The Code Monster - Medium]]></title>
        <description><![CDATA[Create.Share.Learn - Medium]]></description>
        <link>https://medium.com/the-code-monster?source=rss----92a8100cdab---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>The Code Monster - Medium</title>
            <link>https://medium.com/the-code-monster?source=rss----92a8100cdab---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 01:51:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/the-code-monster" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Android & iOS + Backend Apps With Kotlin Only]]></title>
            <link>https://medium.com/the-code-monster/android-ios-backend-apps-with-kotlin-only-844a83a514b4?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/844a83a514b4</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[cross-platform]]></category>
            <dc:creator><![CDATA[Himanshu Verma]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 04:56:26 GMT</pubDate>
            <atom:updated>2022-11-29T15:18:21.442Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Develop your backend, Android &amp; iOS Apps with Kotlin</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I_Od6XR9zxLVwGJVTWgmUQ.jpeg" /><figcaption>Image Credit: <a href="https://unsplash.com/@martinshreder">Martin Shreder</a></figcaption></figure><p>Kotlin has been one of the most talked about languages since its birth in 2011. Since then it has come a long way to ease out the development in Android. Kotlin almost replaced Java in Android Development, most of the apps nowadays are built in Kotlin. Since, in Kotlin you don’t need to write boilerplate code like you do in Java. Java is not going anywhere, but its not best fit for Android Apps, since Java was created when there was no idea of Smart Phones. As you know smart phones come up with limited resources. For more details like why Kotlin replacing Java, <strong>you can read</strong> <a href="https://betterprogramming.pub/power-of-kotlin-in-android-apps-development-a6b6bc8671cc"><strong>here</strong></a>.</p><h3>What is Kotlin Multiplatform Mobile (KMM)?</h3><p>Kotlin Multiplatform Mobile is an SDK to build iOS And Android Apps.</p><p>It offers all the combined benefits of creating cross-platform and native apps.</p><p>Like Flutter and React Native, you can also use Kotlin to build your Android and iOS Applications. And also you can build your backend with the same language. There’s no need to introduce any new programming languages to your codebase to make your app cross-platform.</p><p><strong>OKAY, Wait wait….. wait…</strong> Don’t directly jump into the development, since <strong>KMM</strong> is in <strong>BETA NOW, so you’ve to wait till we get the stable version.</strong></p><h3>So, Why Use Kotlin?</h3><p>Kotlin is one of the most newly developed languages which helps you to write less code and do more. It saves your development time and also reduce the code review time. And its easy to find bugs in clean and smaller codebase.</p><h3>Kotlin for server side</h3><p>Unlike just Cross Platform Apps, you can also build your backend with Kotlin. Kotlin applications can be deployed into any host that supports Java Web applications, including Amazon Web Services, Google Cloud Platform, and more.</p><ul><li><strong>Expressiveness: </strong>Kotlin’s innovative language features, such as its support for <a href="https://kotlinlang.org/docs/type-safe-builders.html">type-safe builders</a> and <a href="https://kotlinlang.org/docs/delegated-properties.html">delegated properties</a>, help build powerful and easy-to-use abstractions.</li><li><strong>Scalability</strong>: Kotlin’s support for <a href="https://kotlinlang.org/docs/coroutines-overview.html">coroutines</a> helps build server-side applications that scale to massive numbers of clients with modest hardware requirements.</li><li><strong>Interoperability</strong>: Kotlin is fully compatible with all Java-based frameworks, so you can use your familiar technology stack while reaping the benefits of a more modern language.</li><li><strong>Migration</strong>: Kotlin supports gradual migration of large codebases from Java to Kotlin. You can start writing new code in Kotlin while keeping older parts of your system in Java.</li><li><strong>Tooling</strong>: In addition to great IDE support in general, Kotlin offers framework-specific tooling (for example, for Spring) in the plugin for IntelliJ IDEA Ultimate.</li><li><strong>Learning Curve</strong>: For a Java developer, getting started with Kotlin is very easy. The automated Java-to-Kotlin converter included in the Kotlin plugin helps with the first steps. <a href="https://kotlinlang.org/docs/koans.html">Kotlin Koans</a> can guide you through the key features of the language with a series of interactive exercises.</li></ul><h3>Case Studies</h3><p>There are some really big companies like <a href="http://Netflix Android and iOS Studio Apps — now powered by Kotlin Multiplatform"><strong>NETFLIX</strong></a>, <strong>VMWARE</strong>, <strong>PHILIPS</strong> and many more, which are already started using Kotlin for Mobile App Development to simplify their app development efforts.</p><p>If you want, <strong>you can read more case studies</strong> <a href="https://kotlinlang.org/lp/mobile/case-studies/"><strong>here</strong></a> and learn how Kotlin helped them to build successful products which is being used by millions.</p><h3>First Cross Platform App With Kotlin: Android Studio</h3><p>If you’re already an Android Developer then you don’t have to worry about how to set up environment to create your project and run an Android App. To run the iOS App, you have to install the XCode on your MAC Machine.</p><p>If you completely new to Kotlin and you don’t know to install Android Studio on your machine, then you can <strong>download the Android Studio from official website </strong><a href="https://developer.android.com/studio?gclid=CjwKCAiA68ebBhB-EiwALVC-NjjENTcW-M8uKMrRCvBlT3cKGHYIE95qpGrpqW60PmLjF1mdIpq46hoCAe0QAvD_BwE&amp;gclsrc=aw.ds"><strong>here</strong></a><strong> </strong>and in order to create your cross platform project in Android Studio, you can follow<strong> </strong><a href="https://kotlinlang.org/docs/multiplatform-mobile-create-first-app.html#examine-the-project-structure"><strong>this</strong></a>.</p><p><strong>You can also watch </strong><a href="https://www.youtube.com/watch?v=mdN6P6RI__k&amp;ab_channel=KotlinbyJetBrains"><strong>this</strong></a><strong> video for KMM quick start guide.</strong></p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly. keep learning and keep growing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=844a83a514b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/android-ios-backend-apps-with-kotlin-only-844a83a514b4">Android &amp; iOS + Backend Apps With Kotlin Only</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“How Bias-Variance, Model Complexity & Underfitting-Overfitting are related?”]]></title>
            <link>https://medium.com/the-code-monster/how-bias-variance-model-complexity-underfitting-overfitting-are-related-fa3615b133b7?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/fa3615b133b7</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Agasti Kishor Dukare]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 04:28:55 GMT</pubDate>
            <atom:updated>2021-01-18T04:28:55.490Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I’ll explain how Prediction Errors are related to ML model complexity and thus contribute to model performance in the most simple language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yuWGiC9-hSl-MQlBn-nuxA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nikolalsvk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nikola Đuza</a> on <a href="https://unsplash.com/s/photos/fittings?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Whether you are a newbie in ML space or have years of experience, you must have observed that whenever you search for <strong>Overfitting </strong>on the web you’ll see either of the following one-liners:</p><p><a href="https://machinelearningmastery.com/overfitting-and-underfitting-with-machine-learning-algorithms/">Overfitting refers to a model that models the training data too well.</a></p><p>or</p><p><a href="https://towardsdatascience.com/understanding-the-bias-variance-tradeoff-165e6942b229">Overfitting models have high variance and low bias.</a></p><p>These definitions suffice if one’s goal is just to prepare for the exam or clear the interview. But if you are like me, who wants to understand things from basics, these surface-level explanations will not be enough.</p><blockquote>Why High Variance Low Bias Model is Overfitting and where does model complexity come into the picture? How does “Model Paying Too much attention to training data” translates to high variance and thus into overfitting?</blockquote><p>I needed more explanation. Hence, I dug deep so now you don’t have to! Here’s my take on the relation between Overfitting-Underfitting &amp; Bias-Variance.</p><h3>Bias &amp; Variance:</h3><p>In any ML Model, when we make predictions the model will always have some amount of error. We call it Prediction Error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LX0Tq5Atd29PoBizR8ECZA.png" /></figure><p><strong>Note:</strong> While the first two errors i.e. Bias &amp; Variance are controllable, we have no control over the Error due to noise.</p><p>Let’s say you have a ML model and you run it on the training dataset. Now if you take the average of the residuals (difference of prediction &amp; true value) &amp; subtract it from the average of true values, you’ll get <strong>Bias</strong>. Thus Bias is an indicator of how far off the model predictions as a whole are from the true values.</p><p>Now let’s say you took 5 datasets that are different from each other &amp; trained a single ML model on each of them. For each dataset, you took the difference between the randomly selected prediction &amp; the average of all the predictions. Observe how this difference changes for different datasets. This is the <strong>Variance.</strong></p><blockquote>Thus, we can see from these 2 definitions that, Bias tells on average, how <strong>accurate</strong> our model is in terms of making correct predictions while Variance tells how <strong>consistent</strong> our model is.</blockquote><p>For any ML model, our goal is to create a model that is consistent &amp; has high accuracy i.e. <strong>low Bias &amp; low Variance</strong>.</p><h3>Bias-Variance &amp; Model Complexity:</h3><p>The high Bias Model has high inaccuracy in terms of predictions. This means that the model fails to capture patterns &amp; relationships in data. This happens because the model cannot learn from data well. Thus the model is <strong>not complex enough</strong>.</p><p>High Variance Model has low consistency in terms of its predictions. This means that its predictions vary drastically with a change in the dataset which in turn is an indicator that the model fails to generalize well. This happens when the model captures the underlying pattern as well as noise in data. This is the sign of the model being <strong>high in complexity</strong>.</p><h3>Underfitting-Overfitting:</h3><p>Because High Bias models are not complex enough, they fail to capture the underlying patterns in data and thus result in high training &amp; test error which is a sign of Underfitting. Thus it is evident that <strong>Underfitting is the result of a Model that is not complex enough i.e. High in Bias</strong>.</p><p>Conversely, a model with High Variance is high in complexity. Thus while learning the underlying patterns in data, it also learns outliers &amp; noise. Therefore, it gives high accuracy on the familiar dataset i.e. training data. But when a slightly different dataset i.e. test data is presented to this model, its prediction varies considerably which results in poor accuracy. This is a sign of Overfitting. So, it’s observed that <strong>Overfitting is the result of a Model that is high in complexity i.e. High in Variance</strong>.</p><h3>Bias-Variance Tradeoff:</h3><p>As mentioned before, our goal is to have a model that is low in Bias &amp; low in Variance. To avoid High Bias, we will need to increase the complexity of our model &amp; similarly, to avoid High Variance, we will need to decrease the complexity of our model.</p><blockquote><strong>To achieve a low bias-low variance model, we need to create a model that will have low complexity &amp; high complexity simultaneously which is impossible!</strong> This is known as Bias-Variance Tradeoff. Hence, you will observe that a Model that is Underfitting i.e. High in Bias is always low in Variance &amp; vice versa.</blockquote><p>There you have it! This is my understanding of how Bias-Variance, Model Complexity &amp; Underfitting-Overfitting are interconnected. I hope you guys found it helpful.</p><p>If you have any queries or find any mistakes in concepts please feel free to write in the comments. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa3615b133b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/how-bias-variance-model-complexity-underfitting-overfitting-are-related-fa3615b133b7">“How Bias-Variance, Model Complexity &amp; Underfitting-Overfitting are related?”</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The right way of Using Third-Party API Keys in Android]]></title>
            <link>https://medium.com/the-code-monster/the-right-way-of-using-third-party-api-keys-in-android-775b6bfea31e?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/775b6bfea31e</guid>
            <category><![CDATA[api-keys-android]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[success_anil]]></dc:creator>
            <pubDate>Fri, 07 Feb 2020 15:42:20 GMT</pubDate>
            <atom:updated>2020-02-07T15:42:20.016Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*At3bYONIOzz-1BBYlUgc1g.png" /></figure><h4>Prologue</h4><p>What should be the right way of Using Third-party API Keys in Android?</p><p>Since you have been developing android applications for some time, you might have realized the benefits of Source Code Management System like Git. When you work solely it helps, when you work within a team it helps.</p><p>So you may have thought about this question in the past.</p><p>To start our topic of discussion in detail, I would first like to add a quote by an eminent personality <em>bill gates</em></p><p><strong><em>It’s fine to celebrate success but it is more important to heed the lessons of failure</em></strong></p><p>Good developers even good human beings keep on improving them, their ways of working, most important their perception and outlook. Our failures in life teach us more than our success in life. Experienced developers know this.</p><p>Let’s come back to our initial discussion.</p><p>Why we are emphasizing, on third-party APIs. Its because most of third party APIs like <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Google Maps</a> are easy to integrate and seem free when their usage is quite low. Whenever usage of APIs increases above a particular threshold, the company which has developed APIs starts charging. (<em>And someday my very popular idea/application will kill me if I am not careful about APIs operational cost</em>)</p><h4>Imagination</h4><p>Imagine a scenario, that you have developed an open-source application or library, which can add cool functionality in the application and other developers can use it for free in their code. But since you didn’t take steps to secure your API key properly and checked in it into the public source code repository like <a href="https://github.com/">GitHub</a>.</p><h4>The Havoc</h4><p>And nightmare comes up, a lot of other developers those are using your public library, making calls to Third-party API using your API Key. and soon the third party will start charging your <a href="https://www.sbicard.com/"><em>credit card</em></a><em> </em>since you have added that credit card to the third-party billing account.</p><h4>The rescue</h4><p>I am taking an example of the Android App here. See the below kotlin file</p><pre>/*<br> * Copyright (c) 2019. Relsell Global<br> */</pre><pre>package `in`.relsellglobal.firebasedatabasedemo</pre><pre>import `in`.relsellglobal.firebasedatabasedemo.pojo.CityContent<br>import android.os.Bundle<br>import android.view.LayoutInflater<br>import android.view.View<br>import android.view.ViewGroup<br>import androidx.fragment.app.Fragment<br>import androidx.recyclerview.widget.LinearLayoutManager<br>import androidx.recyclerview.widget.RecyclerView<br>import java.util.*</pre><pre>/**<br> * A fragment representing a list of Items.<br> * Activities containing this fragment MUST implement the<br> * [FrontListFragment.OnListFragmentInteractionListener] interface.<br> */<br>class FrontListFragment : Fragment() {</pre><pre>    // TODO: Customize parameters<br>    private var columnCount = 1</pre><pre>    private var recyclerView:RecyclerView? = null<br></pre><pre>    private var myItemRecyclerViewAdapter : MyItemRecyclerViewAdapter? = null</pre><pre>    val cityContentList: MutableList&lt;CityContent&gt; = ArrayList()</pre><pre>    val APPID = &quot;&lt;OPEN WEATHER API KEY&gt;&quot;</pre><pre>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)</pre><pre>        arguments?.let {<br>            columnCount = it.getInt(ARG_COLUMN_COUNT)<br>        }<br>    }</pre><pre>    override fun onCreateView(<br>        inflater: LayoutInflater, container: ViewGroup?,<br>        savedInstanceState: Bundle?<br>    ): View? {<br>        val view = inflater.inflate(R.layout.fragment_item_list, container, false)<br>        recyclerView = view.findViewById(R.id.list);<br>        // Set the adapter<br></pre><pre>        return view<br>    }</pre><pre>    override fun onActivityCreated(savedInstanceState: Bundle?) {<br>        super.onActivityCreated(savedInstanceState)<br></pre><pre>        var city = CityContent()<br>        city.cityName = &quot;dehradun&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID</pre><pre>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;new delhi&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;hyderabad&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;chennai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;mumbai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;mangalore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;dispur&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;indore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br>        recyclerView!!.layoutManager = LinearLayoutManager(activity);<br>        myItemRecyclerViewAdapter = MyItemRecyclerViewAdapter(cityContentList,activity)<br>        recyclerView!!.adapter = myItemRecyclerViewAdapter<br></pre><pre>    }</pre><pre>    override fun onDetach() {<br>        super.onDetach()<br>    }</pre><pre>    companion object {</pre><pre>        // TODO: Customize parameter argument names<br>        const val ARG_COLUMN_COUNT = &quot;column-count&quot;</pre><pre>        // TODO: Customize parameter initialization<br>        @JvmStatic<br>        fun newInstance(columnCount: Int) =<br>            FrontListFragment().apply {<br>                arguments = Bundle().apply {<br>                    putInt(ARG_COLUMN_COUNT, columnCount)<br>                }<br>            }<br>    }<br>}</pre><p>More specifically see the line</p><pre>val APPID = &lt;Open weather api key&gt;</pre><p>now open local.properties file and add your third party API key there. This file is already added into .gitignore file and doesn’t go to remote git repository whenever a commit/push is made.</p><pre>openweather_data_api_key=&lt;key value&gt;</pre><p>Besides above you want to access your API inside your kotlin files. But before doing that you need to create <strong>buildConfigField</strong> in your app level build.gradle file.</p><pre>defaultConfig {<br>        .....<br>        buildConfigField &quot;String&quot;, &quot;OPENWEATHERDATA_API_KEY&quot;, &quot;\&quot;&quot;+localProperties[&#39;openweather_data_api_key&#39;]+&quot;\&quot;&quot;<br>       ....<br>    }</pre><p>To access buildConfigField inside your kotlin file, you use property from the autogenerated BuildConfig.java file.</p><p>So your kotlin file snippet will become</p><pre>val APPID = BuildConfig.OPENWEATHERDATA_API_KEY</pre><p>Now, you can safely commit /push your file changes into a remote git repository without worry about API keys being published.</p><h4>Conclusion</h4><p>Congrats you have come up to this and investing time in growing yourself.</p><p>Remember friend nothing in this world is free. 🙂 Now you know the right way of Using Third-Party API Keys in Android</p><p>Thanks for reading. Feel free to check out my other blogs my team, on Android development topics.</p><p>Happy coding.</p><p>As a sidenote: Article was originally published at <a href="http://www.relsellglobal.in/">Relsell Global</a> at <a href="http://relsellglobal.in/android-development/android-kotlin-development/the-right-way-of-using-third-party-api-keys-in-android/">Link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=775b6bfea31e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/the-right-way-of-using-third-party-api-keys-in-android-775b6bfea31e">The right way of Using Third-Party API Keys in Android</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easy Android Programming: MVVM]]></title>
            <link>https://medium.com/the-code-monster/easy-android-programming-mvvm-34b61c73c9bf?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/34b61c73c9bf</guid>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[success_anil]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 13:27:18 GMT</pubDate>
            <atom:updated>2020-02-06T13:27:18.088Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*At3bYONIOzz-1BBYlUgc1g.png" /></figure><h4>Prologue</h4><p>This is first tutorial in EASY Android Programming: MVVM series.</p><p>Eminent Mr. <strong>Woody Guthrie</strong> has said it right</p><p><strong><em>Any fool can make something complicated. It takes a genius to make it simple.</em></strong></p><p>So how all this is connected?</p><p>Most of the experienced or intermediate software developers know that its the quality of the application that makes it saleable. Users like that app which doesn’t crash and do the desired work in lesser no of steps.</p><p>UI Experience designers put a lot of midnight oil to come up with eye-catching UI, yet, easy to navigate. The UI may allow a user to perform a task with a lesser no of steps.</p><p>Hardworking developers put a lot of effort to develop an application that confirms UX design by using required design patterns in coding.</p><h4>Process</h4><p>In this article, I will make an android application as a metaphor but the rules are similar for any type of software development. To make things clearer, I would start with <a href="https://medium.com/@success.anil.kk/the-need-for-mvvm-in-android-advance-learning-topic-e518f169009a">MVVM in Android development</a>.</p><p>Before proceeding further, I would expect you know Git (SCM), if not please study one of the earlier articles <a href="http://relsellglobal.in/technical-blogs/git-command-line-integration/">this</a> and <a href="http://relsellglobal.in/technical-blogs/starting-with-git-repository-addition-in-android-studio/">this</a>.</p><p>Checkout the weatherdata branch for the repository <a href="https://github.com/successanil/KotlinWeatherData/">link</a> . if you see code structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/0*hCP9H91CdD3X-tzI.png" /></figure><p>In continuation of the above, there are a bunch of kotlin files in firebasedatabasedemo package. Lets open FrontListFragment.kt file you will find below code.</p><pre>/*<br> * Copyright (c) 2019. Relsell Global<br> */</pre><pre>package `in`.relsellglobal.firebasedatabasedemo</pre><pre>import `in`.relsellglobal.firebasedatabasedemo.pojo.CityContent<br>import android.os.Bundle<br>import android.view.LayoutInflater<br>import android.view.View<br>import android.view.ViewGroup<br>import androidx.fragment.app.Fragment<br>import androidx.recyclerview.widget.LinearLayoutManager<br>import androidx.recyclerview.widget.RecyclerView<br>import java.util.*</pre><pre>/**<br> * A fragment representing a list of Items.<br> * Activities containing this fragment MUST implement the<br> * [FrontListFragment.OnListFragmentInteractionListener] interface.<br> */<br>class FrontListFragment : Fragment() {</pre><pre>    // TODO: Customize parameters<br>    private var columnCount = 1</pre><pre>    private var recyclerView:RecyclerView? = null<br></pre><pre>    private var myItemRecyclerViewAdapter : MyItemRecyclerViewAdapter? = null</pre><pre>    val cityContentList: MutableList&lt;CityContent&gt; = ArrayList()</pre><pre>    val APPID = BuildConfig.OPENWEATHERDATA_API_KEY</pre><pre>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)</pre><pre>        arguments?.let {<br>            columnCount = it.getInt(ARG_COLUMN_COUNT)<br>        }<br>    }</pre><pre>    override fun onCreateView(<br>        inflater: LayoutInflater, container: ViewGroup?,<br>        savedInstanceState: Bundle?<br>    ): View? {<br>        val view = inflater.inflate(R.layout.fragment_item_list, container, false)<br>        recyclerView = view.findViewById(R.id.list);<br>        // Set the adapter<br></pre><pre>        return view<br>    }</pre><pre>    override fun onActivityCreated(savedInstanceState: Bundle?) {<br>        super.onActivityCreated(savedInstanceState)<br></pre><pre>        var city = CityContent()<br>        city.cityName = &quot;dehradun&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID</pre><pre>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;new delhi&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;hyderabad&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;chennai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;mumbai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;mangalore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);</pre><pre>        city = CityContent()<br>        city.cityName = &quot;dispur&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;indore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        cityContentList.add(city);<br>        recyclerView!!.layoutManager = LinearLayoutManager(activity);<br>        myItemRecyclerViewAdapter = MyItemRecyclerViewAdapter(cityContentList,activity)<br>        recyclerView!!.adapter = myItemRecyclerViewAdapter<br></pre><pre>    }</pre><pre>    override fun onDetach() {<br>        super.onDetach()<br>    }</pre><pre>    /**<br>     * This interface must be implemented by activities that contain this<br>     * fragment to allow an interaction in this fragment to be communicated<br>     * to the activity and potentially other fragments contained in that<br>     * activity.<br>     *<br>     *<br>     * See the Android Training lesson<br>     * [Communicating with Other Fragments](http://developer.android.com/training/basics/fragments/communicating.html)<br>     * for more information.<br>     */</pre><pre>    companion object {</pre><pre>        // TODO: Customize parameter argument names<br>        const val ARG_COLUMN_COUNT = &quot;column-count&quot;</pre><pre>        // TODO: Customize parameter initialization<br>        @JvmStatic<br>        fun newInstance(columnCount: Int) =<br>            FrontListFragment().apply {<br>                arguments = Bundle().apply {<br>                    putInt(ARG_COLUMN_COUNT, columnCount)<br>                }<br>            }<br>    }<br>}</pre><p>app level build.gradle file</p><pre>apply plugin: &#39;com.android.application&#39;</pre><pre>apply plugin: &#39;kotlin-android&#39;</pre><pre>apply plugin: &#39;kotlin-android-extensions&#39;</pre><pre>def localProperitiesFile = rootProject.file(&quot;local.properties&quot;)<br>def localProperties = new Properties()<br>localProperties.load(new FileInputStream(localProperitiesFile))</pre><pre>android {<br>    compileSdkVersion 28<br>    defaultConfig {<br>        applicationId &quot;in.relsellglobal.firebasedatabasedemo&quot;<br>        minSdkVersion 19<br>        targetSdkVersion 28<br>        versionCode 1<br>        versionName &quot;1.0&quot;<br>        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;<br>        buildConfigField &quot;String&quot;, &quot;OPENWEATHERDATA_API_KEY&quot;, &quot;\&quot;&quot;+localProperties[&#39;openweather_data_api_key&#39;]+&quot;\&quot;&quot;<br>    }<br>    buildTypes {<br>        release {<br>            minifyEnabled false<br>            proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;), &#39;proguard-rules.pro&#39;<br>        }<br>    }<br>}</pre><pre>dependencies {<br>    implementation fileTree(dir: &#39;libs&#39;, include: [&#39;*.jar&#39;])<br>    implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;<br>    implementation &#39;androidx.appcompat:appcompat:1.1.0&#39;<br>    implementation &#39;androidx.constraintlayout:constraintlayout:1.1.3&#39;<br>    implementation &#39;com.google.firebase:firebase-core:17.2.2&#39;<br>    implementation &#39;com.google.firebase:firebase-database:19.2.0&#39;<br>    implementation &#39;com.android.volley:volley:1.1.1&#39;</pre><pre>    implementation &#39;androidx.legacy:legacy-support-v4:1.0.0&#39;<br>    implementation &#39;androidx.recyclerview:recyclerview:1.1.0&#39;<br>    testImplementation &#39;junit:junit:4.12&#39;<br>    androidTestImplementation &#39;androidx.test:runner:1.2.0&#39;<br>    androidTestImplementation &#39;androidx.test.espresso:espresso-core:3.2.0&#39;<br>}</pre><pre>apply plugin: &#39;com.google.gms.google-services&#39;</pre><p>When you run the application you see below screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/144/0*8B8iUsZPhjvNLa9N.png" /></figure><p>Right now we are having the list of cities as in-memory ArrayList. So it’s faster to load. Even rotation changes will not crash the application. But what if we load our list from a remote database like firebase realtime db.</p><h4>Problem</h4><p>So the above process to download the list from firebase might take few milliseconds and by that time user may choose to rotate the screen of the device.</p><p>Consequently, in android, the corresponding activity would restart on rotation now if we have designed the architecture of our application as MVP (Model view presenter ), so our view and the model classes would be interacting on the bases of interfaces or callbacks.</p><p>Basically, this means that Model classes have reference to view in direct or wrapped form. so that, whenever data arrives after a network call, the model may update the view.</p><p>On rotation, the activity would restart all the view become null and the corresponding earlier view’s reference in model class becomes null, and once this happens if model classes try to update a null view app crashes. As a side note, customers don’t like those apps which crash. It hardly matters for them, how much pain the developer has taken to develop the application.</p><h4>The Rescue</h4><p>Rescue is introducing MVVM Pattern to your code.</p><p>MVVM Pattern involves Model View ViewModel. Now in simple terms Model updates ViewModel. The view has put observer on ViewModel so when view requires only then it can retrieve updated values from ViewModel.</p><p>Therefore the crash that may result when the device is rotated won’t appear. Moreover, a ViewModel has no information regarding activity or Fragments.</p><p>So in our application, the code for FrontListFragment.kt onActivityCreated method would become</p><pre>override fun onActivityCreated(savedInstanceState: Bundle?) {<br>        super.onActivityCreated(savedInstanceState)</pre><pre>        recyclerView!!.layoutManager = LinearLayoutManager(activity);</pre><pre>        val model = ViewModelProviders.of(this).get(CitiesViewModel::class.java)<br>        model.getCitiesList().observe(this, androidx.lifecycle.Observer { cityContentList -&gt;<br>            myItemRecyclerViewAdapter = MyItemRecyclerViewAdapter(cityContentList,activity)<br>            recyclerView!!.adapter = myItemRecyclerViewAdapter</pre><pre>        })<br></pre><pre>    }</pre><p>In the above code snippet, you will see fragment is observing on data from ViewModel. Now since we have introduced ViewModel our code structure will be like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*vDq2hLUhwEKJ7EbK.png" /></figure><p>We have added a new package called ViewModel which will keep our ViewModel classes.</p><p>We have added CitiesViewModel class.</p><pre>package `in`.relsellglobal.firebasedatabasedemo.viewmodels</pre><pre>import `in`.relsellglobal.firebasedatabasedemo.BuildConfig<br>import `in`.relsellglobal.firebasedatabasedemo.pojo.CityContent<br>import androidx.lifecycle.LiveData<br>import androidx.lifecycle.MutableLiveData<br>import androidx.lifecycle.ViewModel<br></pre><pre>class CitiesViewModel : ViewModel() {<br>    val APPID =<br>        BuildConfig.OPENWEATHERDATA_API_KEY</pre><pre>    private lateinit var citiesContent: MutableLiveData&lt;List&lt;CityContent&gt;&gt;</pre><pre>    fun getCitiesList(): LiveData&lt;List&lt;CityContent&gt;&gt; {<br>        if (!::citiesContent.isInitialized) {<br>            citiesContent = MutableLiveData()<br>            loadCities()<br>        }<br>        return citiesContent<br>    }</pre><pre>    private fun loadCities() {<br>        val listOfCities = mutableListOf&lt;CityContent&gt;()<br>        var city = CityContent()<br>        city.cityName = &quot;dehradun&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)</pre><pre>        city = CityContent()<br>        city.cityName = &quot;new delhi&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;hyderabad&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;chennai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;mumbai&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)</pre><pre>        city = CityContent()<br>        city.cityName = &quot;mangalore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)</pre><pre>        city = CityContent()<br>        city.cityName = &quot;dispur&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)<br></pre><pre>        city = CityContent()<br>        city.cityName = &quot;indore&quot;<br>        city.apiUrl =  &quot;http://api.openweathermap.org/data/2.5/weather?q=&quot;+city.cityName+&quot;&amp;appid=&quot;+APPID<br>        listOfCities.add(city)</pre><pre>        citiesContent.value = listOfCities</pre><pre>    }<br>}</pre><p>To keep code simple we will stop here , we are not exploring other components in MVVM and fetching data from other sources.</p><p>By introducing MVVM to the code, we have touched two main advantages of MVVM</p><ol><li>Clean Separation of Concerns</li><li>ViewModels are Lifecycle aware.</li></ol><h4>Conclusion</h4><p>This brings us to the end of the blog. Share your feedback.</p><p>Thanks for reading</p><p>Happy Coding</p><p>Article originally published at the <a href="http://relsellglobal.in/android-development/easy-android-programming/easy-android-programming-mvvm/">blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34b61c73c9bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/easy-android-programming-mvvm-34b61c73c9bf">Easy Android Programming: MVVM</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should Women Train Differently Than Men? The Short Answer is “No”]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/the-code-monster/should-women-train-differently-than-men-the-short-answer-is-no-60943fea0076?source=rss----92a8100cdab---4"><img src="https://cdn-images-1.medium.com/max/2000/0*3pRoTCwkGKgxsKzq" width="2000"></a></p><p class="medium-feed-snippet">The year was 1977. &#x201C;Pumping Iron&#x201D;, a documentary of the road to the 1975 Mr. Olympia, featuring Arnold Schwarzenegger, was released to the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/the-code-monster/should-women-train-differently-than-men-the-short-answer-is-no-60943fea0076?source=rss----92a8100cdab---4">Continue reading on The Code Monster »</a></p></div>]]></description>
            <link>https://medium.com/the-code-monster/should-women-train-differently-than-men-the-short-answer-is-no-60943fea0076?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/60943fea0076</guid>
            <category><![CDATA[women]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[fitness]]></category>
            <category><![CDATA[health]]></category>
            <dc:creator><![CDATA[Zack Harris]]></dc:creator>
            <pubDate>Sat, 04 Jan 2020 01:07:44 GMT</pubDate>
            <atom:updated>2020-01-04T01:07:44.802Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Linear Regressions and Split Datasets Using Sklearn]]></title>
            <link>https://medium.com/the-code-monster/split-a-dataset-into-train-and-test-datasets-using-sk-learn-acc7fd1802e0?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/acc7fd1802e0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Himanshu Verma]]></dc:creator>
            <pubDate>Fri, 03 Jan 2020 09:31:32 GMT</pubDate>
            <atom:updated>2022-11-30T04:45:55.983Z</atom:updated>
            <content:encoded><![CDATA[<h4>A basic guide to show how you can split your main dataset into two parts</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RjNxLZloej2yTz6JtwkKQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@drew_beamer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Drew Beamer</a> on <a href="https://unsplash.com/s/photos/split?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In this article, we’re going to learn how we can split up our dataset into two parts — e.g., training and testing datasets.</p><p>When we have training and testing datasets, then we’ll apply a machine-learning linear-regression algorithm to predict the price of a car on the basis of its mileage and age (how old the car is).</p><h3><strong>Step #1</strong></h3><p>We’re going to use a couple of libraries in this article: pandas to read the file that contains the dataset, sklearn.model_selection to split the training and testing dataset, and matplotlib to draw the regression line.</p><p>First of all, import the following packages:</p><pre>import pandas as pd<br>from sklearn.model_selection import train_test_split<br>from matplotlib import pyplot as plt</pre><p>If you don’t have the above packages installed, then please install them before moving ahead.</p><h3><strong>Step #2</strong></h3><p>In this step, we’ll load our CSV file to explore the dataset by using pd as a pandas reference variable and call the read_csv() function along with the file name to read the file.</p><p>And now display the top five rows by using the head() function.</p><pre>df = pd.read_csv(&#39;carprices.csv&#39;)<br>df.head()</pre><p><strong>Note: </strong>Either move your CSV file inside your working directory or pass the full pathname along with file name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*5KqBPYP4Wzqi-AWzJRNzkQ.png" /><figcaption>Top five rows of our dataset</figcaption></figure><h3>Step #3</h3><p>Before splitting up the dataset into training and testing datasets, our focus must be finding the dependent and independent variables. Once these variables are prepared, then we’re ready to go to split up the dataset.</p><p>We’ll see the relationship between the mileage and sell price by drawing the data points, and after that, we’ll prepare the dependent and independent variables. Finally, we’ll split the dataset.</p><p>So let’s draw the data points using the following line of code:</p><pre><br>plt.scatter(df[&#39;Mileage&#39;],df[&#39;Sell Price($)&#39;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*5k53SZ_UIMZZJBJXYkAdiQ.png" /></figure><p>Now prepare the <em>x</em> and <em>y</em> variables, and display the data of the <em>x</em> variable.</p><pre>X = df[[&#39;Mileage&#39;,&#39;Age(yrs)&#39;]]<br>Y = df[&#39;Sell Price($)&#39;]<br>X.head(10)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*CWaluX8fY7ttzwvF9MzfVQ.png" /></figure><p>I assigned Mileage and Age(yrs) in X, so it&#39;s showing both of them.</p><p>Since we’ve split our data into <em>x</em> and <em>y</em>, now we can pass them into the train_test_split() function as a parameter along with test_size, and this function will return us four variables. They’re x_train, y_train, x_test, and y_test.</p><pre>x_train, x_test,y_train,y_test = train_test_split(X,Y,test_size =0.2)<br># print the data<br>x_train</pre><p>As many times as you rerun the above code, you’ll get a different result every time. This is because thetrain_test_split() function picks up the random rows every time, and it’s good for our machine-learning model. If you don’t want thetrain_test_split() function to pick up the random rows, then you can do so by setting random_state = 10.</p><p>The test_size parameter in the train_test_split() function defines the size of the testing data in a percentage. Let’s say we have 100 rows, and if we pass test_size=0.2, then it means we want to keep 20% of the data of the entire dataset for the testing purposes. So in this, only 80 rows will be used for training the model.</p><p>So in case of my dataset, there are 20 rows in total, and I have given 80% data for the training the model. I’m left with 20% data. If I print the length of the x_train variable, then it’ll print 16 — and if you print the length of the x_test, then it will print 4.</p><h3>Step #4</h3><p>Now we’re going to fit our <em>x</em> and <em>y</em> into a machine-learning model to predict the output, but before that, we have to import the LinearRegression from the sklearn.linear_model and create an object of the LinearRegression class.</p><pre>from sklearn.linear_model import LinearRegression<br>clf = LinearRegression()</pre><p>Now fit the x_train and y_train variables.</p><pre>clf.fit(x_train,y_train)</pre><p>Now predict the output by passing the x_test variable.</p><pre>clf.predict(x_test)</pre><p><strong>Predictions:</strong> array([38014.72666327, 16170.60704425, 17307.00704693, 34927.2349164 ])</p><p>Now let’s test the accuracy of our model.</p><pre>clf.score(x_test,y_test)</pre><p><strong>Accuracy: </strong>0.904677273463023</p><p>It means our model is accurate up to 90% of the time.</p><h3>Conclusion</h3><p>We have seen how we can split up the dataset into training and testing parts to pass it to the fit function. Also, we have used the linear-regression algorithm to predict the price of the car on the basis of its mileage and age.</p><p>Download my Jupyter Notebook from my <a href="https://github.com/himanshujbd/train_test">GitHub</a> account.</p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly.</p><p><a href="https://mailchi.mp/b08da935e5d9/himanshuverma"><strong>Subscribe</strong></a> my mailing list to get the early access of my articles directly in your inbox or follow my own publication on Medium <a href="https://medium.com/the-code-monster"><strong>The Code Monster</strong></a> to polish your technical knowledge.</p><h3>Know your author</h3><p>Himanshu Verma has graduated from the Dr. APJ Abdul Kalam University, Lucknow (India). He is an Android &amp; IOS Developer and Machine Learning &amp; Data Science Learner, a Financial Advisor, and a Blogger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acc7fd1802e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/split-a-dataset-into-train-and-test-datasets-using-sk-learn-acc7fd1802e0">Linear Regressions and Split Datasets Using Sklearn</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything you need to know about Microservices]]></title>
            <link>https://medium.com/the-code-monster/everything-you-need-to-know-about-microservices-772e6baee13?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/772e6baee13</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Himanshu Verma]]></dc:creator>
            <pubDate>Tue, 31 Dec 2019 12:04:46 GMT</pubDate>
            <atom:updated>2022-11-29T15:30:36.062Z</atom:updated>
            <content:encoded><![CDATA[<h4>An article to understand the Microservice in a simplest terms</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBoNrTjzeJUv8soYvV9ISw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@christianfregnan?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Christian Fregnan</a> on <a href="https://unsplash.com/s/photos/box?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Microservice is a software development technique which aims to break down the components of the applications into smaller parts which are independent from each other and can work together. Breaking down the application components provide ease in development, increase code readability and also codebase becomes easy to maintain and test.</p><h3><strong>Why Microservices</strong></h3><p>To proceed further with Microservices, firstly understand what is the monolithic architectures.</p><p>Monolithic means composed all in one place. Monolithic is a traditional way of writing code which incorporates components of the software in a single container and these components are interconnected ,dependent and tightly coupled. In a tightly coupled architecture, each component and its associated components must be present in order to execute and compile successfully.</p><p>As you can see from the given image below, user interface, business logic and data interface all in a single codebase and this indicates that to maintain and test this codebase will not be easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*OtgV4GEX6TQL_MgHFagc8A.jpeg" /><figcaption>Credit: <a href="https://www.n-ix.com/microservices-vs-monolith-which-architecture-best-choice-your-business/">n-ix.com</a></figcaption></figure><p>Let’s understand this with an example</p><p>You are creating an E-commerce web application (like Amazon) which accepts orders from customers, verifies inventory and avail credits, and ships them. The application consists of several components including the user interface along with some backend services for checking credit, maintaining inventory and shipping orders.</p><p>The application is deployed as a single monolithic application. You can run multiple instances of the application behind a load balancer in order to scale and improve availability.</p><p>The image shown below is an example of E-commerce web application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*uRokPU7ojbLWnPvwLeLRLw.png" /><figcaption>Credit: <a href="https://1.bp.blogspot.com/-ZaCVj-4FJFY/XfoYlKCAYyI/AAAAAAAAA-c/XC7ROY9oqnk-gx7XK3Ev9GDwu6zXsFoVwCNcBGAsYHQ/s1600/Monolithic-Architecture2.png">javaexpertreboot.blogspot.com</a></figcaption></figure><p>This solution works perfectly until your E-commerce site not to be become large, once the application becomes large and the team grows in size, this approach has a number of drawbacks that become increasingly significant:</p><ul><li><strong>Unreliable</strong> — Even if one feature of the system fails, then the entire system fails</li><li><strong>Unscalable</strong> — Applications cannot be scaled easily since each time the application needs to be updated, the complete system has to be rebuilt</li><li><strong>Blocks Continuous Development </strong>— Many features of the applications cannot be built and deployed at the same time</li><li><strong>Slow Development </strong>— Development in monolithic applications take a lot of time to be built since each and every feature has to be built one after the other</li><li><strong>Not Fit For Complex Applications </strong>— Features of complex applications have tightly coupled dependencies</li><li><strong>Overloaded IDE</strong> — the larger the codebase the slower the IDE and the less productive developers are.</li></ul><h3>Solution to the problem</h3><p>Define an architecture that structures the application as a set of loosely coupled, collaborating services. This approach corresponds to the Y-axis of the Scale Cube.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*fnyR-GjoKS8MsA_igbOvbw.png" /><figcaption>Credit: <a href="https://1.bp.blogspot.com/-nVZffR7HLwM/XfsmNZV70hI/AAAAAAAAA-o/muZbg5NUb8k73PUYr8Dd_BKuegNl5DVQQCNcBGAsYHQ/s1600/microservices2.png">1.bp.blogspot.com</a></figcaption></figure><p>Benefits of the microservice</p><ul><li><strong>Highly maintainable and testable</strong> — enables rapid and frequent development and deployment.</li><li><strong>Loosely coupled with other services</strong> — enables a team to work independently the majority of time on their service(s) without being impacted by changes to other services and without affecting other services.</li><li><strong>Independently deployable </strong>— enables a team to deploy their service without having to coordinate with other teams</li><li><strong>Capable of being developed by a small team</strong> — essential for high productivity by avoiding the high communication head of large teams</li></ul><h3>Microservice vs Monolithic Architecture</h3><p>Let’s take an use case of e-commerce site to better understand the difference</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MmhFVDc3KiHdMo_pug8RHw.png" /><figcaption>Credit: <a href="https://1.bp.blogspot.com/">https://1.bp.blogspot.com/</a></figcaption></figure><p>The main difference we observe from the above image is that all the features initially were under a single instance sharing a single database. But then, with microservices, each feature was allotted a different microservice, handling their own data, and performing different functionalities.</p><h3>Conclusion</h3><p>So it is clear from the above discussion that microservice technique of writing software solves the problem of code maintenance, code testing and also adding new features doesn’t affect the entire system. We can also minimise the system failures.</p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly.</p><p><a href="https://mailchi.mp/b08da935e5d9/himanshuverma"><strong>Subscribe</strong></a> my mailing list to get the early access of my articles directly in your inbox and Don’t forget to follow my own publication on Medium <a href="https://medium.com/the-code-monster"><strong>The Code Monster</strong></a> to polish your technical knowledge.</p><h3>Know your author</h3><p>Himanshu Verma has graduated from the Dr. APJ Abdul Kalam University, Lucknow (India). He is an Android &amp; IOS Developer and Machine Learning &amp; Data Science Learner, a Financial Advisor, and a Blogger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=772e6baee13" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/everything-you-need-to-know-about-microservices-772e6baee13">Everything you need to know about Microservices</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[12 Smart Ways to Search on Google Like a pro]]></title>
            <link>https://medium.com/the-code-monster/12-smart-ways-to-search-on-google-like-a-pro-4d095fcb7309?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/4d095fcb7309</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[google-search]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Himanshu Verma]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 13:57:57 GMT</pubDate>
            <atom:updated>2022-11-29T15:28:46.091Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this guide, we’ll learn 10 smart ways to optimise your Google search queries</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RmhaUuqqsXLRcJF0poJIqw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@darshan394?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Deva Darshan</a> on <a href="https://unsplash.com/s/photos/ways?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>We all use Google in our daily life to search our queries and we get the response accordingly. But you might have come across a situation where you searched your query but didn’t get the exact links what you’ve been searching for and waste a lot of time to find the exact piece of information you needed. It happens due to Unoptimized queries, so in this guide we’ll learn those tricks which will help save your time as well as give you the exact information you needed.</p><h3>Table of content</h3><ul><li>Site Search</li><li>Related Words</li><li>The wildcard</li><li>Time Range</li><li>File Types</li><li>The OR operator</li><li>Word Definition</li><li>Calculator</li><li>Search Exact Phrase</li><li>Hyphen</li><li>inTitle</li><li>Flight Running Status</li></ul><h3>Site Search</h3><p>The site keyword allows you to search on a specific site, for example if you want google to show results only for Amazon for iPhone 7, so you could type in your query as follows.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-r3c8vRguxYBb7P8sSxu3Q.png" /><figcaption>site keyword</figcaption></figure><h3>Related Words</h3><p>This keyword helps you to find the links which is related to the word you typed in your search query.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhhIoYF2pLc4XEo9EEqhsQ.png" /><figcaption>related keyword</figcaption></figure><h3>The wildcard</h3><p>The asterisk (*) is a wildcard which could fit in any query of which few words are missing. For example if you want search the lyrics of any song but you forgot few words, then this keyword will help you find your favourite songs.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vb1nATXgc-cGlHy2eVlC3A.png" /><figcaption>The wildcard</figcaption></figure><h3>Time Range</h3><p>The operator allows you to search your queries on the basic of time range. Let’s say you want to search movies which were released from 2000 to 2019, then you can use this operator.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88aairi9ME80UMWQpyhNPg.png" /><figcaption>Time Range</figcaption></figure><h3>File Types</h3><p>This operator allows you to search any specific file on the basis of its type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*311VJPdAPoPddmFVDb_Vmw.png" /><figcaption>filetype</figcaption></figure><h3>The OR operator</h3><p>This operator lets you find the results which contains any one word out of two.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-LXHK7l8mMPosSKVJzIeQ.png" /><figcaption>OR operator</figcaption></figure><h3>Word Definition</h3><p>By using word definition you can get the full description of the word.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3rqBNySzAGtDyNOzYsg_w.png" /><figcaption>define operator</figcaption></figure><h3>Calculator</h3><p>For using this operator you don’t have type it, you just put your mathematical expressions on the search box and hit enter, you’ll get the result.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2OxDC5zQotRJD8lOkMgNQ.png" /><figcaption>calculate expressions</figcaption></figure><h3>Search Exact Phrase</h3><p>Quotation mark lets you perform exact phrase search that will only include results with those exact words in that exact order.</p><h4>Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2GZvRfAETEEb5pfBnMy00g.png" /><figcaption>Search exact phrase</figcaption></figure><h3>Exclude a word from the search</h3><p>If you don’t want any word to appear in your search, then you can use the following way of searching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvkD_3KTWwtqCGfn7BaYWw.png" /><figcaption>Omit a word</figcaption></figure><h3>inTitle</h3><p>This operator shows you those results in which your query’s words match.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Rk2diybdlQAQiktSlDoJQ.png" /><figcaption>inTitle</figcaption></figure><h3>Flight Running Status</h3><p>If you want to know the status of the running flight in which your loved ones are flying and you have to catch them on the Airport, then you can do this by using the following smart trick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpEvgr-ERos7m7KLw22sLg.png" /><figcaption>Flight Running Status</figcaption></figure><h3>Conclusion</h3><p>These 12 tricks will help you save a lot of time and makes you feel confident and enable you to be more productive.</p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly.</p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly.</p><p><a href="https://mailchi.mp/b08da935e5d9/himanshuverma"><strong>Subscribe</strong></a> my mailing list to get the early access of my articles directly in your inbox and Don’t forget to follow my own publication on Medium <a href="https://medium.com/the-code-monster"><strong>The Code Monster</strong></a> to polish your technical knowledge.</p><h3>Know your author</h3><p>Himanshu Verma has graduated from the Dr. APJ Abdul Kalam University, Lucknow (India). He is an Android &amp; IOS Developer and Machine Learning &amp; Data Science Learner, a Financial Advisor, and a Blogger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d095fcb7309" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/12-smart-ways-to-search-on-google-like-a-pro-4d095fcb7309">12 Smart Ways to Search on Google Like a pro</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android 8.0 Behavior Changes]]></title>
            <link>https://medium.com/the-code-monster/android-8-0-behavior-changes-4e1a4776d69c?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/4e1a4776d69c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Abhishek Tripathi]]></dc:creator>
            <pubDate>Fri, 20 Dec 2019 06:56:36 GMT</pubDate>
            <atom:updated>2019-12-20T06:56:36.445Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this guide, i’ll walk you through the behaviour changes occurred in Android 8.0</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*gHIDRXhmg3E5OE0zYG3bXg.png" /><figcaption>Image credit to <a href="http://blogs.innovationm.com/android-8-0-behavior-changes/">innovationM</a></figcaption></figure><p>As you all know Android is quite volatile operating system which means that every weeks bring some changes and changes might be regrading the bugs fixing, flaws in security, new features and list goes on. So in this guide, we’ll learn some major changes made in Android 8 which is Oreo (Codebase name).</p><h3><strong>Introduction</strong></h3><p>As everyone knows, a lot of changes made after API level 26 for optimizing Android system’s performance, the battery uses and other system-level problems which I am writing below:</p><ul><li>Changes in Service</li><li>Changes in Broadcast Receiver</li><li>Changes in Push Notification</li></ul><h4><strong>Changes in Broadcast Receiver</strong></h4><p>So before understanding the changes in broadcast receiver let’s first understand two types of broadcast receivers in Android.</p><h4><strong>Implicit BroadCast </strong>Receiver #1</h4><p>BroadCast Receiver that is provided by Android system like CONNECTIVITY_CHANGE, ACTION_BATTERY_LOW.</p><h4><strong>Explicit BroadCast Receiver #2</strong></h4><p>BroadCast Receiver which is created by the user by extending Broadcast Receiver class is Explicit BroadCast Receiver.</p><p>Now next thing is that you can register Broadcast Receiver in Android using two ways first using java code and second is in manifest.xml file. The difference is when you declare Broadcast Receiver using java code then this will not be triggered when your app is closed but if you declare in manifest.xml then this will be triggered even if your app is not running.</p><p>So after Oreo, you can not declare every implicit broadcast receiver in manifest.xml (<strong>Note: </strong>Not every Broadcast Receiver but few of them you can declare) and Android gives you a list of the implicit broadcast receiver which you can declare in manifest.xml even after Oreo. Besides that list, you can not declare any implicit broadcast receiver in manifest.xml file.</p><p><strong>Ex- ACTION_LOCKED_BOOT_COMPLETED</strong>, <strong>ACTION_BOOT_COMPLETED</strong></p><p>Android allows these broadcast because they are sent only once when system boot and too many apps need to receive this broadcast to schedule alarm, jobs and so forth.</p><p><a href="https://developer.android.com/guide/components/broadcast-exceptions.html">List of implicit Broadcast Reciever allowed after oreo.</a></p><h3><strong>Reasons before Oreo</strong></h3><p>There are couple of reasons listed below we were facing Android 8, so let’s have a look at below.</p><ul><li>If you register an app to receive broadcast then the app’s receiver consumes resources every time the broadcast is sent. If too many apps are registered to receive broadcast then this can cause problems because every apps receiver consumes resources and it also impacts the user experience.</li><li>The main changes after Oreo are that Background Service is not allowed, only foreground service is allowed. First, let’s understand when services are considered as background service :</li></ul><h4><strong>Case #1</strong></h4><p>When you start a service and put the app in the background and the user is not aware of your service.</p><h4><strong>Case #2</strong></h4><p>Your app is in the background and you are starting a service, eg an alarm manager which gives you a callback and you start a service.</p><p>In the above-mentioned cases, these services will be considered as background services. So if you run a background service then Android will kill your service after a certain amount of time, but remember if you are using your app means your app is in foreground then service will not be killed.</p><ul><li>After Oreo background service is not allowed because the developer’s start their services and the work done by the service gets completed, but the service still keeps running. This leads to degradation in device performance and drains the battery. As I have mentioned above, there is no more background service after Oreo so you might think about the alternatives for it. Below I have stated the alternatives:</li></ul><p><strong>(a)-Foreground Service</strong>: Foreground service is if the user is aware that the service is running like displaying a notification attached to service for example in Ganna music application you will always see a notification while a song is playing.</p><p><strong>(b)-Job Service: </strong>Another alternative for the background service is to use Job service which is similar to service but the difference is that it is not in your hands to start it. You will just create your JobService object and give this to Job Scheduler and Job scheduler will start this service when it will see that the resources are free. You can not force JobShedular to start your Job Service immediately, but you can just request the Job Scheduler to start in some specific time which is shown in the example below. JobShedular is similar to ThreadShedular and JobService is similar to Thread. You can also define different event for starting your job service. For example, the service will start when the device is connected to the internet or it is charging. You can also call Job Service as a combination of BroadCast Reciever and Service.</p><p><a href="https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setBackoffCriteria(long,%20int)">Events that you can attach with your Job Service.</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51058af77eef5675bd5163da96687a6f/href">https://medium.com/media/51058af77eef5675bd5163da96687a6f/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b8be7fd53f1fc2a794a627d090e7134/href">https://medium.com/media/9b8be7fd53f1fc2a794a627d090e7134/href</a></iframe><p>And now this will run even if your app is in the background.</p><p>Let’s understand some important things related to Service with the following points:</p><p><strong>(I)-</strong> You start a Service with start service () method when your app is running means app is in foreground then Service will not be killed in any case.</p><p><strong>(II)-</strong> When you are starting your Service with startService() method then in onStartCommand method of Service class, call startForground() method and give a notification object and now a notification will show as long your Service will be running. As I have told you above after Oreo for displaying a notification please create a channel for notification. I will suggest you create the channel in the Application file of the project. The use of this notification channel is explained below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba62df0768c736d811f351480f2d6c09/href">https://medium.com/media/ba62df0768c736d811f351480f2d6c09/href</a></iframe><p>Now, this is your foreground Service but If you will not call startForeground() method from onStartCommand() method and put your app in the background then after some Android will kill your Service.</p><p><strong>(III)</strong>-You can use not StartService() method when your app is in the background after Oreo if you call this then Android will through IllegalStateException.</p><p><strong>(IV)</strong>-If you are starting a Service when your app is in the background then use startForegroundService() method, and one more thing after calling startService() Method Android will give you 5 seconds to call startForeground() method from onStartCommand().If within 5 seconds you call this method then Android will continue your Service otherwise after 5 seconds it will be killed.</p><p>Note: Always use ContextCompat class and it will handle conditions related to Android version.</p><p><strong>ContextCompat.startForegroundService(this, serviceIntent);</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/257a11869aacd95fe4c5c538b22f295f/href">https://medium.com/media/257a11869aacd95fe4c5c538b22f295f/href</a></iframe><ul><li>After Oreo, you can divide your app’s notifications into channels. You can set different behavior on different channels. All notifications that are posted to the same channel have the same behavior. For example, I can create a channel for the most urgent notifications. By using the channel, every notification will have a different sound, vibration or a notification light. You can create more channels like this and can customize according to your requirements. So after Oreo, you have more control over your notifications.</li></ul><p>We have one more chance after Oreo which are notification dots. Now after Oreo if your notifications appear then you will see dots or badges on app launcher icons. So for now if you want to know for a particular application if you have gotten a new notification then you can check the dots displayed along with the application’s icon. I will suggest you create notification channel in Application class of project like given in the code below-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a5f9938978e9d60ac5b53cadf0b2bf4/href">https://medium.com/media/2a5f9938978e9d60ac5b53cadf0b2bf4/href</a></iframe><p>Now your notification channel is created with channel id “exampleServiceChannel” , you will use this channel id when you create you notification builder object like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3392bbf9d68ee8a80e7e562f7726c79/href">https://medium.com/media/b3392bbf9d68ee8a80e7e562f7726c79/href</a></iframe><p><strong>Conclusion:</strong> I have tried to cover each and every point related to changes in Push Notification, Service and BroadCast Reciever after Oreo. I hope the concepts are easy to grasp and in case of any mistakes please feel free to comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e1a4776d69c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/android-8-0-behavior-changes-4e1a4776d69c">Android 8.0 Behavior Changes</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Technology in a single view]]></title>
            <link>https://medium.com/the-code-monster/blockchain-technology-in-a-single-view-caa733ca9d4a?source=rss----92a8100cdab---4</link>
            <guid isPermaLink="false">https://medium.com/p/caa733ca9d4a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Himanshu Verma]]></dc:creator>
            <pubDate>Wed, 18 Dec 2019 17:24:58 GMT</pubDate>
            <atom:updated>2022-11-29T15:27:22.125Z</atom:updated>
            <content:encoded><![CDATA[<h4>A complete guide of blockchain technology</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eHOdZ80zy3KhBu7IFLpovQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@neural_notworks?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shaojie</a> on <a href="https://unsplash.com/s/photos/chain?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The term Blockchain might sound like its too much complicated at first but to be honest its not, if i break this term down into two new words, then they are block and chain. And now block means the container or box which can contain the information such as transactions date, amount of money transferred or deposited and the name of a person whom money was sent. So in simplest term, blockchain is the chain of blocks which are interconnected by a link or node.</p><p>What we will learn from this guide</p><ul><li>Introduction to Blockchain Technology</li><li>How it works?</li><li>How blockchain going is to disrupt various industries?</li><li>Applications</li></ul><h3>Introduction</h3><p>A blockchain is a list of records called blocks that are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. — <strong>Wikipedia</strong></p><p>The blockchain technology uses the Distributed Ledger Technology (DLT) which never allows anyone to alter the data in the chain. Blockchain technology ensures that the data is highly secured by higher level of encryption because cryptographic algorithms and hashing keep the blockchain secure.</p><h3>How it works?</h3><p>First of all let’s have a look at the following image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOO5nqTh2hNDqNJV6c9REg.jpeg" /><figcaption>Image credit to <a href="https://101blockchains.com/ultimate-blockchain-technology-guide/#prettyPhoto/0/">101blockchains.com</a></figcaption></figure><p>Let’s create the scenario of online banking and understand how money is sent to another account.</p><h4>Step #1</h4><p>Let’s say a user wants to send the X amount of money to another bank account, so he initiates the transaction.</p><h4>Step #2</h4><p>When the transaction is initiated by the user in the step 1, then a fresh new block is created if we understand this in terms of blockchain technology.</p><h4>Step #3</h4><p>When the new block is created, now the block is broadcasted to all the nodes in the network or chain.</p><h4>Step #4</h4><p>Since this newly created block is visible to every node of the network, now its time to validate this block. Every node in the network validates every newly created block to validate it, when every node returns the same response which means that the block is valid.</p><h4>Step #5</h4><p>When the validation process is successful, now the block is added to the chain.</p><h4>Step #6</h4><p>In the last step of this process, transaction is verified and gets executed. In the last step X amount of money would be transferred to the respective account.</p><h3>How blockchain is going to disrupt various industries?</h3><p>The blockchain technology is going to disrupt various industries such as Banking, Healthcare, Real Estate and many more. Since everything is being online rapidly, so the use of online applications increased drastically from the last few years and as long as the security is concerned, then nobody wants to take any kind of risk when it comes to keeping the data secured. And as you now know blockchain technology is so powerful and secured which doesn’t allow anyone to tamper or damage the data.</p><h3>Applications</h3><p>The blockchain technology is being used in various fields such as health, online payment transfer and many more. Some of the most prominent applications are given follows.</p><ul><li>Payments and money transfer</li><li>Assets management</li><li>Insurance</li><li>Healthcare</li><li>Internet of Things (IoT)</li><li>Passport</li><li>Personal Identification</li><li>Real Estate</li><li>Travel</li><li>Food and supply chain etc.</li></ul><h3>Conclusion</h3><p>Blockchain technology is the most secured and prominent way of keeping online things safe. Since it goes through the long process to validate even a single block and when every node in the network nod its head in yes, then it verifies and executes it due to which hacking is close to impossible.</p><p>I hope you liked reading this article, you can also visit my <a href="http://thehimanshuverma.com/"><strong>website</strong></a><strong> </strong>where I keep posting article regularly.</p><p><a href="https://mailchi.mp/b08da935e5d9/himanshuverma"><strong>Subscribe</strong></a> my mailing list to get the early access of my articles directly in your inbox or follow my own publication on Medium <a href="https://medium.com/the-code-monster"><strong>The Code Monster</strong></a> to polish your technical knowledge.</p><h3>Know your author</h3><p>Himanshu Verma has graduated from the Dr. APJ Abdul Kalam University, Lucknow (India). He is an Android &amp; IOS Developer and Machine Learning &amp; Data Science Learner, a Financial Advisor, and a Blogger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caa733ca9d4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-code-monster/blockchain-technology-in-a-single-view-caa733ca9d4a">Blockchain Technology in a single view</a> was originally published in <a href="https://medium.com/the-code-monster">The Code Monster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>