<?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 Kavindu Gayantha on Medium]]></title>
        <description><![CDATA[Stories by Kavindu Gayantha on Medium]]></description>
        <link>https://medium.com/@96kavindugayantha?source=rss-985b9b527c1e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Oqq_oAK_0CVaulpLCXQ7oA.jpeg</url>
            <title>Stories by Kavindu Gayantha on Medium</title>
            <link>https://medium.com/@96kavindugayantha?source=rss-985b9b527c1e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:21:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@96kavindugayantha/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[Exception handling with Java]]></title>
            <link>https://medium.com/analytics-vidhya/exception-handling-with-java-77de91fcb15e?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/77de91fcb15e</guid>
            <category><![CDATA[exception-handling]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Sun, 03 Apr 2022 11:29:36 GMT</pubDate>
            <atom:updated>2022-04-03T11:29:36.925Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exception handling in Java</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-P3zmoCIshJqSyuAQQGeA.jpeg" /><figcaption>HPhoto by <a href="https://unsplash.com/@hishahadat?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shahadat Rahman</a> on <a href="https://unsplash.com/s/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hi fellows, have you heard about exceptions? Nope?🧐🤔. It’s OK 😉. It’s simply an error. 😌. When programming, we need to consider those kinds of errors. Those are called exceptions. So we should have to be aware of handling those exceptions as a programmer. The errors that occur in the compile-time can be identified by the compiler, they can be fixed easily but not the errors in the run time can be identified by the compiler. So we need to know them and should know the way of handling for not occurring those exceptions in our java code.</p><p>Here we go.</p><h4>why we should handle the exceptions?</h4><pre>statement line 1;<br>statement line 2;<br>statement line 3;  // exception occurs here<br>statement line 4;<br>statement line 5;</pre><p>Just imagine a situation that a code exists with lines of codes of 5 and an exception occurs in the line of 3, so after that line, the code is not running unless we don’t handle that exception. That’s why we need to know how to handle run-time errors ( exceptions ). Now let’s see how to handle them.</p><p>How can we handle the exceptions without knowing about them? 😉. Just go to find what those exceptions are first.</p><p><strong>There are two types of exceptions</strong></p><ul><li>Checked</li><li>Unchecked</li></ul><p>according to Oracle, there is another type called <strong>error</strong>.</p><p>Alright, now see each of them.</p><h4>Checked exceptions</h4><p>Checked exceptions are the exceptions that are checked at the compile time. If some code within a method throws a checked exception, then the method must either handle the exception or it must specify the exception using the <em>throws </em>keyword. The compiler knows when file handling, there can be an exception occur. And also when a database connection, if the database does not exist then an exception occurs (SQLException ). In that case we need to handle them definitely otherwise the program will not be run smoothly.</p><p><strong>examples for checked exceptions</strong></p><ul><li>IOException</li><li>SQLException</li><li>ClassNotFoundException</li></ul><p>Now you might have a doubt.🤔. Since the exceptions occur in the run time, checked exceptions are checked in the compile time. What is that? doubting compile-time and the run time. 🤔.</p><p>Don’t be confused. That means checked exceptions are considered <strong>as known exceptions</strong> which occur in the run time <strong>but it is checked in the compile-time</strong> and identified by the compiler as an exception.</p><p>EX: If we get data from a file since there is no such file at that location, how can we get data from such a file.🤔. Got it?. In that case, the compiler knows that there will be a problem if there is no such file. Then compiler shows ‘ <strong>there is a situation to have an exception so handle that issue and compile it ’</strong>. like that, we need to know and remember to have to try-catch block or throws keyword to use when handling a file or connecting to a database( if there is not a database like a name which we mentioned, there will be an exception. ) That is what meant by checked exception.</p><h4>Unchecked exceptions</h4><p>Unchecked exceptions are exceptions that are not checked at the compile time. It means if your program is throwing an unchecked exception and even if you didn’t handle that exception, the program won’t give a compilation error. Most of the times these exception occurs due to the bad data provided by the user during the user-program interaction. It is up to the programmer to judge the conditions in advance, that can cause such exceptions and handle them appropriately. All Unchecked exceptions are direct sub classes of RuntimeException class.</p><p><strong>examples for unchecked exceptions</strong></p><ul><li>ArrayIndexOutOfBoundException</li><li>NullPointerException</li><li>ArithmaticException</li><li>NumberFormatException</li></ul><p>Are you doubting? let’s see where those exceptions are placed.</p><h4>The class hierarchy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gx21xCme0VSORB5Ly0gKxQ.jpeg" /><figcaption>class hierarchy of exceptions</figcaption></figure><p>In this class hierarchy, we are not going to handle those all exceptions. There are some exceptions called serious problems according to this hierarchy they are in names <strong>StackOverflowErrors, OutOfMemoryErrors</strong>,<strong> VirtualMachineErrors</strong> like that errors no need to handle. It is very complicated.</p><p>Let’s see what the exceptions that we can handle are.</p><p>There are two ways of handling an exception.</p><ol><li><strong>throw out and ignore</strong></li><li><strong>catch and handle</strong></li></ol><p>we can either ignore the exception and throw or catch the exception and handle the task of exception handling. When we can’t directly identify where the exception is, we use throws to solve the exception. And also when we know where can an exception occurs we can use try-catch to handle the exception.</p><p>Now let’s see checked and unchecked further and how to handle them.</p><h4><strong>Checked Exception</strong></h4><p>Here one example of a checked exception.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17504bdd038727457d6ffadcc89ab28a/href">https://medium.com/media/17504bdd038727457d6ffadcc89ab28a/href</a></iframe><p>The output will be like this. Here an exception occurs because the file is not to be found. So FileNotFoundException occurs. So we need to handle those kinds of exceptions. <strong>checked</strong> means <strong>it checked when compiling time by the compiler whether this kind of exception can occur or not</strong>.</p><pre>Exception in thread &quot;main&quot; java.io.FileNotFoundException: B:/myfile.txt (No such file or directory)<br>	at java.io.FileInputStream.open0(Native Method)<br>	at java.io.FileInputStream.open(FileInputStream.java:195)<br>	at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138)<br>	at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:93)<br>	at Example.main(Example.java:6)</pre><p>let’s see how to handle them like this.</p><p>As I previously mentioned there are two types of exception handling. Now see how both types are working with an exception with those example codes.</p><p><strong>using throws</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/089b12010402736b6e88cfc797bab0f3/href">https://medium.com/media/089b12010402736b6e88cfc797bab0f3/href</a></iframe><p>This is how to handle IOexception with throws.</p><p>Let’s see how to handle that exception with try-catch block.</p><p><strong>using try-catch</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db0650575dc02ae1733fff31bcd272c0/href">https://medium.com/media/db0650575dc02ae1733fff31bcd272c0/href</a></iframe><p>in the lines of codes with file handling parts can be having exceptions so that those lines are covered by the try-catch block. That is how we can handle the exceptions which occur in the run time.</p><h4>Multi-catch block</h4><p>Now let’s see how we can handle more than one exception at the same time. In early java versions ( before java 7 ) we can’t handle exceptions in one catch block. we had to write each exception separately.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5d5aac35b2b125566f70c0d75d6da61/href">https://medium.com/media/f5d5aac35b2b125566f70c0d75d6da61/href</a></iframe><p>But in new versions of java, we can handle multiple exceptions in one catch block.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/269d597de91aad82e68f64635f244561/href">https://medium.com/media/269d597de91aad82e68f64635f244561/href</a></iframe><p>That is an added advantage of new versions of java.</p><h4>Unchecked Exception</h4><p>Those are checked in the runtime. So we don’t need to handle it. But we need to be aware of those kind of exceptions and also should have been able to avoid from being occurring an exception. To avoid from them, you need to know what those are, isn’t it? 🤓 Mostly we can see <strong>NullPointerExceptions.</strong></p><p>NullPointerException occurs when we try to get some values of an object which has not any values assigned. And IndexOutOfBoundsException occurs when we try to access wrong index of an array or list or something like that. example:</p><pre>int[] arr = new int[10]<br>for(int a = 0; a &lt;= 10; a++) {<br>   System.out.println(arr[a]);<br>}</pre><pre>// array size is 10<br>// but array indexes are 0,1,2,3,4,5,6,7,8,9 only</pre><p>Like this situations the program try to access indexes of that array which are beyond the limit of array indexes. So the program gives an exception <strong>IndexOutOfBound. </strong>Those kind of exceptions are found in the run time.</p><p>That’s how we can handle exceptions in java. Hope you learnt something. Until we meet again, bye for now. 👋👋</p><h3>About the author</h3><blockquote><a href="https://kavindu-gayantha.herokuapp.com/"><em>Kavindu Gayantha</em></a></blockquote><blockquote><em>B.Sc(Hons) in </em><a href="https://science.kln.ac.lk/tunits/setu/"><em>Software Engineering</em></a></blockquote><blockquote><em>University of Kelaniya, Sri Lanka</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77de91fcb15e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/exception-handling-with-java-77de91fcb15e">Exception handling with Java</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Future of User Interface Design]]></title>
            <link>https://medium.com/@96kavindugayantha/future-of-user-interface-design-600165dedc0a?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/600165dedc0a</guid>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[future-trends]]></category>
            <category><![CDATA[ui-ux-design]]></category>
            <category><![CDATA[user-interface-design]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Sun, 27 Mar 2022 15:32:04 GMT</pubDate>
            <atom:updated>2022-03-27T15:32:04.678Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*luGpr8Xva9G5tRq8.png" /></figure><p>User interfaces, do you know what that is.🤔? OK no worries.🤗 I will explain all about that. Let’s get started like this. Have you ever watched movies which is having amazing technology in use like IRON MAN, Minority Report … etc</p><figure><img alt="Minority report(2002)" src="https://cdn-images-1.medium.com/max/500/0*sY7A-YzDJaRkSQhh.jpg" /><figcaption>Minority Report movie</figcaption></figure><figure><img alt="IRON MAN movie" src="https://cdn-images-1.medium.com/max/1024/0*-tnKB_kY-QbnyEeH.jpeg" /><figcaption>Iron man movie</figcaption></figure><p>Hi guys, after long time🤗. This time I came up with a kind of interesting topic. <strong>User interfaces</strong>😎😁</p><h4>What is an user interface?</h4><p>Human users interact with a computer, website, or application through the user interface (UI). The purpose of good UI is to make the user’s experience simple and straightforward, requiring the least amount of work on the user’s side to achieve the best possible result. Did you get it?🤔. Ok I will tell it like this.</p><p>Everything that we can see in a device screen can be considered as a user interface. All of them are trying to interact with the user to execute the commands that given by the user to the machines.</p><p>There are several types of user interfaces. You might have seen those before.</p><ul><li>GUI(Graphical user interfaces)</li><li>CLI(Command line interface)</li><li>Voice based user interface</li><li>Gesture based user interface</li><li>Touch based user interfaces</li></ul><p>You might not be familiar with these terms. No worries. Keep reading this article. I will explain all.😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*AKorSw_YJWGkwUv0.jpg" /><figcaption>GUI vs CLI</figcaption></figure><p>You should have seen the GUI. 👀 Those are the UI the most users know. And you might have seen CLI also. In windows operating systems there is a tool called <strong><em>CMD</em></strong>, in linux based operating systems it is called as the<strong><em> terminal.</em></strong>🤗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*EDPKCl5oLv0qhZg8.png" /><figcaption>Touch screens</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0lTa-piIJpXVx0Ep.png" /><figcaption>voice based UI</figcaption></figure><p>If you are using a smart phone you should have heard about google assistant, apple siri. Those are examples for a voice based user interface. All the commands can be make with just our voice without touching the screen. That is awesome, isn’t it 😎 Yeh that is super cool until you meet gestures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*qvNso3Ld943XCR3Q.gif" /><figcaption>Gesture based UI</figcaption></figure><p>That is magical, isn’t it?. Things that you have seen in movies came into reality. In this kind of UIs you no need to touch it. Just swap here and there for giving commands to the system. In this picture it shows that changing the volume by hand gestures.😮</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*pTR1wcC86ex_9s5n.gif" /><figcaption>Advantage of gesture based UI s</figcaption></figure><p>Are you exited now looking these kind of things in real life?😇. Then just think how would be future user interfaces.🤔😎. Super cool, isn’t it?</p><p>Let’s dive into evolution of user interfaces.</p><p>Have you watched Iron Man 🤔? (If not go,watch &amp; continue reading 😜) Stark is getting his suits’ blueprints into a table as a 3D model and he is doing his works by hand gestures. Be honest that you think this is like a magic, isn’t it?😇. No it is not a magic anymore. You just know, this is a technology called mixed reality. (Someone might have think, what the heck that is😮)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*em2_MYciZ7cyXMvS.gif" /><figcaption>Iron Man</figcaption></figure><p>Actually what is mixed reality 🤔. First of all you need to know what AR, VR is.</p><h4>AR(Augmented Reality)</h4><p>Make computer generated objected into real world with enhancing the real world. And the AR objects are placed on top of the real objects. We can see some example of AR in several industries like gaming, manufacturing, constructions, textiles..etc. Pokemon Go game is one of example for using AR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*c5JtinBPPnxb3Ob7.gif" /><figcaption>Pokemon Go game interact with the real world</figcaption></figure><p>AR is used in google map. You can check it now with your smart phone. 😎😁 did you figure out this feature already in your hand?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*wT2VHmMd_FP4owEx.gif" /></figure><h4>VR(Virtual Reality)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*NqH41j8KPTxXtU8N.gif" /><figcaption>VR experience</figcaption></figure><p>Not like AR,in VR it provides us a virtual environment instead of interacting with the real world. It gives us another computer generated environment.</p><p>As an example:</p><p>You want to see a jungle but there is not any near by your place. So you can use VR headset and can feel like you are inside a jungle. When you look up you see what is up there in the jungle. When you turn around you can see what you see if you are now in the jungle. Super cool right?😜 see below example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/0*kwKtmLhhj7peTyCw.gif" /><figcaption>He is walking on a virtual environment with a VR box</figcaption></figure><p>Now let’s talk about mixed reality.</p><h4>Mixed Reality</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GyqStkGFKtzJgiQj.png" /><figcaption><a href="https://docs.microsoft.com/en-us/windows/mixed-reality/discover/images/mixedrealityspectrum.png">https://docs.microsoft.com/en-us/windows/mixed-reality/discover/images/mixedrealityspectrum.png</a></figcaption></figure><p>After mainframes, PCs, and cellphones, mixed reality is the next big thing in computing. Consumers and companies are adopting mixed reality. It frees us from screen-bound experiences by allowing us to engage naturally with data in our homes and with our friends. Hundreds of millions of online explorers have used their mobile devices to experience mixed reality. On social media nowadays, mobile AR is the most popular mixed reality option. People may not understand that the Instagram AR filters they employ are mixed reality experiences. With a mix of incredibly amazing holographic representations of humans and high resolution holographic 3D models and the actual environment around them, Windows Mixed Reality takes all of these user experiences to the next level. Microsoft is using this already.</p><figure><img alt="https://docs.microsoft.com/en-us/windows/mixed-reality/discover/images/mixed-reality-venn-diagram-300px.png" src="https://cdn-images-1.medium.com/max/1024/0*9bRNa55TZtfMwvjd.png" /><figcaption><a href="https://docs.microsoft.com/en-us/windows/mixed-reality/discover/images/mixed-reality-venn-diagram-300px.png">https://docs.microsoft.com/en-us/windows/mixed-reality/discover/images/mixed-reality-venn-diagram-300px.png</a></figcaption></figure><p>Micosoft holoLens is the project that Microsoft uses mixed reality. See the below link.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMVXH5V8MVQo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMVXH5V8MVQo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMVXH5V8MVQo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/08836b1d935957ca2e5ad3309eab26f5/href">https://medium.com/media/08836b1d935957ca2e5ad3309eab26f5/href</a></iframe><p>again we comes to Iron Man. In that movie we saw the magic. That is somewhat holograms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*hHcz8SYuC3ua_-Vx.jpg" /></figure><h4>Use of mixed reality in day today life</h4><ul><li><strong>Education:</strong></li></ul><blockquote>Within the education industry, mixed reality technologies are being used to improve students’ capacity to study and absorb knowledge. It also allows students to customize how they study.</blockquote><ul><li><strong>Engineering</strong></li></ul><blockquote>Mixed reality is quickly becoming a game-changer in engineering. From virtual sculpting and 3D modeling to remote repair help and project monitoring applications, there’s something for everyone. Engineers have begun to use mixed reality devices in a variety of ways.</blockquote><p><strong>Benefits in Engineering?</strong></p><ul><li>Real-time simulation of engineering processes.</li><li>Use MR with an industrial IOT device to monitor services.</li><li>Can learn about machine repairing things with MR.</li></ul><figure><img alt="https://www.lanner-america.com/wp-content/uploads/20191119-2.jpg" src="https://cdn-images-1.medium.com/max/1024/0*NCpArqKc9z5cA7jg.jpg" /></figure><ul><li>Entertainment</li></ul><blockquote>AR and VR technology has progressed to the point that the movie and television industries are considering incorporating them into their productions. The concept of interactive storytelling, which is a cross between a game and a film, will open up many new possibilities for mixed reality.</blockquote><p>The following picture shows<a href="https://www.magicleap.com/en-us/"> Magic Leap</a> in action, showing a whale in a school gymnasium😮😮</p><figure><img alt="https://www.lanner-america.com/wp-content/uploads/20191119-3.jpg" src="https://cdn-images-1.medium.com/max/824/0*0jbv-J42cHajEzlD.jpg" /></figure><p>.Design tools can be used for UI designs can be considered as Adobe XD, Figma, Marvel,… etc.</p><h4>Conclusion</h4><p>Those all are about future trends of user interfaces. Hope you got something from this article.</p><p>Then bye for today.✌️👋 Will meet again with a different topic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=600165dedc0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software License]]></title>
            <link>https://medium.com/@96kavindugayantha/software-license-a5802c8bbfa9?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5802c8bbfa9</guid>
            <category><![CDATA[software-license]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Wed, 09 Sep 2020 15:51:56 GMT</pubDate>
            <atom:updated>2020-09-09T17:10:52.864Z</atom:updated>
            <content:encoded><![CDATA[<p>Intro to what the software licenses are;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Cyt8oKAp3z_CW_EnYEa4Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@maxcodes?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Maxwell Nelson</a> on <a href="https://unsplash.com/s/photos/software?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hi, fellows,👋</p><p>Here I’m again. Today let’s talk about software license. You might have seen at least once name called software license. But do you know what that is?. No worries, let’s talk about this.Here we go.</p><p>I can tell you a one place which we can see software licenses to chose. You might use GitHub for your programming life. So that you might have seen this when going to make a new repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*UvpTO57WaaWhgpzihqNawA.png" /><figcaption>a list of license to choose</figcaption></figure><p>Let’s go like this.</p><p><strong>What is a software license </strong>🤔</p><p>Software license is a legal instrument for the use or redistribution of software. Under United States copyright law, all software is protected by copyright in both source code and object code formats,unless that software has been developed by the United States Government, in which case it can not be copyrighted.</p><p>ok now you got what the software license is. But you might think why we need it? Our code it public when we push to GitHub or like that websites. Don’t worry I am going to tell you why that is.😉</p><p><strong>Why do we need software licenses </strong>🤷‍♂️</p><p>You also reuse code when writing code, including code snippets, libraries, functions, frameworks, and whole applications. All software code comes with certain rights and obligations if you want to add it to your code database.Free and open source (FOSS) software is cost-free, but you’re not free to use it as you wish.Even unlicensed snippets of code copied from Stack Overflow have duties for reuse. But formally developed code usually comes with a special license for the software.</p><p>Now you have some understanding about the license in software. 🤗 . And also we need to know there are some types of software license we see. What are they? 🤷‍♂️, oh wait. I’m coming to that point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lovxQO12mwBmO3mhK2QeIg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/s/photos/software?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><strong>Types of software licenses</strong></p><ul><li><strong><em>Public domain</em></strong></li></ul><p>This is the most lenient kind of license for the software. When software is in the public domain, the software can be modified and used by anyone without any limitations. But make sure it’s always secure before you add it to your own codebase. Warning: Code that has no explicit license is NOT automatically available on the public domain. This includes snippets of code that you find on the internet.</p><ul><li><strong><em>Permissive</em></strong></li></ul><p>Also known as “Apache style” or “BSD style,” permissive licenses contain minimal requirements regarding how the software can be modified or redistributed. Perhaps the most popular license used with free and open source software is this type of software licence. Other common variant besides the Apache license and the BSD license is the MIT license.</p><ul><li><strong><em>LGPL</em></strong></li></ul><p>The GNU Lesser General Public License enables you to link your software to open source libraries. If you simply compile or link your own code to an LGPL-licensed library, you can release your application under any license you want, even a proprietary license. But if you modify the library or copy parts of it into your code, you’ll need to release your application under conditions similar to the LGPL</p><ul><li><strong><em>Copyleft</em></strong></li></ul><p>Copyleft licenses are also referred to as reciprocal or restrictive licences. The GPL is the most widely known example of a copyleft or reciprocal licence. These licenses allow you to modify the licensed code and distribute new works based on it, so long as under the same software license you distribute any new works or adaptations.</p><p>For example, a license for a component might say the work is free to use and distribute only for personal use. Therefore any derivative you create would also be restricted to personal use only. (A derivative is any new software that contains the component that you are developing.)</p><p>The catch here is that your software users would have the right to change the code, too. Therefore, you ‘d have to make your own source code available. But of course it may not be in your best interests to expose your source code.</p><ul><li><strong><em>Proprietary</em></strong></li></ul><p>This is the most restrictive of all types of software licences. The idea behind this is reservation of all rights. It is generally used for proprietary software where no modification or redistribution of the work is allowed.</p><p><strong>How do we know which licenses can be applied to the code in my code-base?</strong></p><p>You need to create a software bill of materials, or a list of all the components in your code before you can determine which licenses govern any reused code within your codebase. And with a software composition analysis tool, the quickest way to generate that list is. A good SCA tool will be able to find full components as well as code snippets, and it’ll tell you which licenses apply to each piece of code and whether you might be using licenses that have conflicts.</p><p>That’s about software licensing. That’s all for today. Thanks for reading my articles. Bye for now. See you soon with another article. 😌👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5802c8bbfa9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethical Whistle-blowing]]></title>
            <link>https://medium.com/@96kavindugayantha/ethical-whistle-blowing-91f9413c5b50?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/91f9413c5b50</guid>
            <category><![CDATA[whistleblowing]]></category>
            <category><![CDATA[whistleblower]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Sat, 25 Jul 2020 18:29:15 GMT</pubDate>
            <atom:updated>2020-07-25T19:00:00.517Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*Ms1Z8frhYhwG9-hc.jpg" /><figcaption><a href="https://www.ncl.ac.uk/media/wwwnclacuk/pressoffice/whistleblower-standard.jpg">ref:https://www.ncl.ac.uk/media/wwwnclacuk/pressoffice/whistleblower-standard.jpg</a></figcaption></figure><p>Hello fellows, Today I’m going to tell about whistleblowling. What is that? You might get a doubt like that. Don’t worry I am telling what that is.</p><h4>Whistle-blowing</h4><p>Whistleblowing is the term that can be used when a person passes on information concerning wrongdoing, such as corruption, sexual harassment .. etc. This can be referred to as “blowing the whistle”, “making a disclosure”, “making a whistleblowing report”, or otherwise. The person is usually closely associated with the organization, often an employee, but also sometimes a supplier or a customer. <br>Someone can be called as a<strong> whistleblower</strong> when they behave as that they believed to be misconduct, illegal and not in the company’s code of conduct and report that suspicion as a whistleblowing matter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0fHsHlwEKB6nvSy3.jpg" /></figure><h4>Whistle-bowling can be devided into two parts</h4><ul><li><strong><em>Organisational whistleblowing</em></strong> is a preventive tool for organisations to reduce the risks of malpractice and irregularities. Empowering employees and other relevant stakeholders to blow the whistle increases the chances of managers obtaining information on irregularities that should be acted upon at an early stage. Organisations that take their Code of Conduct seriously will therefore put in place mechanisms to enable organisational whistleblowing, such as a secure corporate whistleblowing system or hotline and a whistleblowing policy or guidelines.</li><li><strong><em>Public whistleblowing </em>i</strong>s In organisations where trust is low, the above mechanisms are not in place, or there is no possibility to be an anonymous whistleblower, the person may be more inclined to blow the whistle publicly. This may include reporting to the police, media or through online social channels, which of course brings a greater risk of reputational damage for organisations. In some instances, though, there is a duty to blow the whistle to a professional body or regulator.</li></ul><p>Now let’s talk about elements of ethical whistleblowing. What are they?</p><h4>Elements of ethical whistleblowing?</h4><p>There are four elements of the whistle-blowing process,</p><ul><li>The whistle-blower</li><li>The whistle-blowing act or complaint</li><li>The party to whom the complaint is made</li><li>The organization against which the complaint is lodged</li></ul><p>now let’s talk about steps for a whistleblowing that you should be aware of.</p><p><strong>Step 1</strong></p><blockquote>The company code of the conduct must be easy to embrace and take pride in. Management involvement, anchoring of the code and follow-up on deviations are important for making it trustworthy.</blockquote><p><strong>Step 2</strong></p><blockquote>Ensure your whistle-blowing policy is prepared for correct processing of whistle-blowing cases.</blockquote><p><strong>Step 3</strong></p><blockquote>A secure whistle-blowing service increases the chance of obtaining business-critical tip-offs. An independent third-party solution is a safe option for both the company and whistle-blower.</blockquote><p><strong>Step 4</strong></p><blockquote>A user-friendly reporting channel, which allows follow-up questions to be posted also to anonymous whistle-blowers, may be vital for investigation process.</blockquote><p><strong>Step 5</strong></p><blockquote>A well-supported whistle-blowing service safeguards high standards of business ethics and a transparent business environment. Positive roll-out of the service and recurring information on its objectives are the key to success</blockquote><p>These are the steps of whistleblowing or can be called as procedure of whistlebowling.</p><p>That’s all for this article. Hope you got something.Thank you for reading my articles. Will see again from another article soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91f9413c5b50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Threads in java]]></title>
            <link>https://medium.com/analytics-vidhya/threads-in-java-44cabd6da58a?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/44cabd6da58a</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[multitasking]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 06:35:53 GMT</pubDate>
            <atom:updated>2020-12-08T05:35:18.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Threads in Java</h3><h4>Explaining threads with java</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*HDAnEEnFuaYz4lr7" /></figure><p>The word thread might familiar to you.This is not the thread that you might hear if you are not thinking like a programmer, If not, don’t worry. Let’s go with that topic from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PcVV-Stq79lbp4y8tYcdqA.jpeg" /></figure><p>First lets talk about multi-tasking.</p><p>Multi-tasking means doing concurrently more than one tasks.There are two types of multi tasking</p><ul><li>Multi-threading</li><li>Multi-processing</li></ul><p>Just take a look at this picture. It’s about multi-tasking. It is showing that using the laptop while having meals. The two tasks are doing concurrently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*3LDrQt_iEajUaM66" /><figcaption>example for multi tasking- two processes at the same time</figcaption></figure><h4>Now let’s talk about multi-processing and multi-threading</h4><blockquote>Just imaging a situation we are making a document in a document making software ( Ms word, open office writer ) while listening to music. The Music player is also running in the background and the word processing software is the running foreground. That is a situation like multi-processing.</blockquote><p>These two tasks are running simultaneously. But not at the same time exactly. Just jumping to both tasks frequently. Like 1 millisecond in writing documents and other 1 millisecond in listening to music. Like that way continuously happens. We need to consider that mechanism when talking about multi-threading.</p><blockquote>Now imaging a situation like we download a file from the internet while downloading it we can download another file also. That is a multi-threading example.</blockquote><p>This time also it is same as multi-processing. Multi-threading is also happening like multi-processing.<br>let’s take another example that you all might have done so far.</p><blockquote>having meals while watching the TV.😉 Consider that situation. Watching TV while eating means we are neither all the time watching TV nor eating. We jump between those tasks simultaneously. It takes a few seconds to look at the plate of foods just look and then again look at the TV. In that situation, both watching TV and having meals are like threads(small processes or tasks) and it can be called multi-tasking according to our topic it can be considered as multi-threading also the theory is the same for both multi-threading and multi-tasking.</blockquote><h4>You might be having doubts about what a thread is. Don’t worry let’s go through it like this</h4><p>Thread is just like a small process. But it is lightweight which can share resources among them. We can divide a process into several threads and can be simplified the process. Threads have a single flow of control and every program is having a thread. And thread has a beginning, body, and the end. And it executes commands sequentially.</p><p>So multithreading means executing more than one command in parallel. Java supports for the Multithreading, it is a key benefit for developers. There should be having a way to run more than one thread at the same time. Java compiler takes the part of which thread should run at which time, like that. There is an algorithm to do that. It’s a bit difficult to understand that algorithm which is how that threads are running simultaneously.</p><p>Now you might have a question where else we can use threads. Here some examples where we can use threads.</p><ul><li>The best example of the use of thread is Games. We use multiple objects in games they are threads.</li><li>Like our previous example, running the music app in the background and working in anything else application.</li><li>Performing some execution while I/O waiting.</li></ul><p>Let’s take a look at the properties of threads. It has the main states. They are called the life cycle of a Thread</p><ul><li><strong>Newborn -</strong>When the thread is created, it is in this state.</li><li><strong>Runnable -</strong>Thread is ready to execute waiting for the availability of the processor.</li><li><strong>Running -</strong>This is the time when the thread is executed.</li><li><strong>Blocked -</strong>This happens when the Thread is suspended, slept, or waited in order to satisfy certain requirements. This state prevents entering a thread from running state or runnable state.</li><li><strong>Dead (Terminated )-</strong> After executing the run method. thread</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*hZMN3gBipz4sGZlD.png" /><figcaption><a href="https://static.javatpoint.com/images/thread-life-cycle.png">ref- https://static.javatpoint.com/images/thread-life-cycle.png</a></figcaption></figure><p>Now you might have a question where else we can use threads. Here some examples where we can use threads.</p><p>Now let’s see how to make a thread in java. There are two ways to make a thread in java.</p><ol><li>By extending the Thread class</li><li>By Implementing the Runnable interface</li></ol><p>from these both ways we can make threads. We need to understand which way is the ideal way for that relevant time.</p><p>Consider that java can’t exist multiple inheritances. In that case, it would rather use runnable interface to make threads in java. It depends on the situation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Fo-umu0P1AHEmc86yjKDg.jpeg" /><figcaption>two ways of making threads</figcaption></figure><p>Thread class is also have implemented from runnable interface. And Thread class has extended to make a thread.</p><p>Now let’s go deep in the first way of making a thread in java by extending thread class.</p><h4>1)Extending the Thread Class</h4><p>Just extend the thread class and override the run method inside it. The relevant codes can be placed inside that run method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab936477197a31d3eec5ad07cb058dcf/href">https://medium.com/media/ab936477197a31d3eec5ad07cb058dcf/href</a></iframe><p>Until call the start method , the Thread is not running. It is in the newborn state. To go to running state need to call start() method. In the extended thread class it must be having a run method .</p><h4>2) Implementing the runnable interface</h4><p>The runnable interface declares the run() method required for implementing threads in the programs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4de2987143163e45aa727943b76bd6c4/href">https://medium.com/media/4de2987143163e45aa727943b76bd6c4/href</a></iframe><p>This is how to make a thread with runnable interface in java.</p><h4>Now let’s see how to stop a thread.</h4><p>From stop() method, a thread can be stopped. When calling stop method, the thread goes to dead state from running state.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55abf951f51ae398c85880bcb09fb1fb/href">https://medium.com/media/55abf951f51ae398c85880bcb09fb1fb/href</a></iframe><h4>Let’s see what are the ways to block a thread</h4><p>There are several ways to block a thread</p><ul><li>sleep() — Thread gets started after a specified time interval unless it is interrupted.</li><li>suspend()— This method puts a thread in the suspended state and can be resumed using resume() method.</li><li>wait()— Causes the current thread to wait until another thread invokes the notify().</li><li>notify() — Wakes up a single thread that is waiting on this object’s monitor.</li><li>resume()— This resumes a thread, which was suspended using suspend() method.</li><li>stop()— stops a thread completely.</li></ul><p>This is how we can use threads in java. While java is allowing multi-threading, some other programming languages are not allowing for multi-threading. So that we can imaging how useful java is. 😉😉.</p><p>Hope you got something from my article. Thanks for reading my articles.</p><blockquote>HAPPY CODING !!</blockquote><h4>About the author</h4><blockquote>Kavindu Gayantha</blockquote><blockquote>Undergraduate</blockquote><blockquote>B.Sc(Hons) in <a href="https://science.kln.ac.lk/tunits/setu/">Software Engineering</a></blockquote><blockquote>University of Kelaniya.</blockquote><p><a href="https://kavindu-gayantha.github.io/">Kavindu Gayantha</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44cabd6da58a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/threads-in-java-44cabd6da58a">Threads in java</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Oriented Programming]]></title>
            <link>https://medium.com/analytics-vidhya/object-oriented-programming-9bbf8a6de2b3?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bbf8a6de2b3</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Wed, 20 May 2020 10:57:06 GMT</pubDate>
            <atom:updated>2020-05-25T16:11:44.251Z</atom:updated>
            <content:encoded><![CDATA[<h4>OOP concepts and its use</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*TgT3nCQQ06E8U51H.png" /><figcaption><a href="https://static.javatpoint.com/images/java-oops.png">ref:https://static.javatpoint.com/images/java-oops.png</a></figcaption></figure><p>What is coming to your mind when you hear OOP.? Sometimes it looks like just three letters. Yes it’s true it’s three letters. But behind that there are set of concepts that every programmer should know.</p><p>OOP stands for object-oriented programming. Object oriented programming can be interpreted as a set of powerful concepts that tries to model real world objects into code. We consider about classes and objects and methods..etc when writing code with oop concepts. We need to be familiar with those words when coding.<br>So let’s look at what those powerful concepts are.</p><p>There are main four concepts in OOP. They are,</p><ul><li>Inheritance</li><li>Polymorphism</li><li>Abstraction</li><li>Encapsulation</li></ul><p>Now I am going to explain each of these things one by one.First of all we need to know some keywords. They are,</p><h4>Class</h4><p>A class is like a blueprint. And also it’s a logical definition. It layouts the basic structure for an object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xf3wfEehMVdvznQNuzwrQg.png" /><figcaption>example of a class</figcaption></figure><p>according to this our class is Animal. So animals are representing the class of animal object. Inside the class the properties and the functions which is related to animal are located.</p><h4>Object</h4><p>Everything that exists in the real world is an object. And also an object is an instance of a class that models a real-world object. Once class may produce several objects as an example:-</p><blockquote>from a house blueprint, we can build several houses similar but location and name are different.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DMtbinn1hdqihoIzhdZrg.png" /><figcaption>animalObj is the object name of class Animal</figcaption></figure><p>This is how an object can be formed with a class in java. Everything in the class can access after making objects of that class.</p><p>Now let’s go to identify what the main concepts of oop are.</p><h4>Inheritance</h4><p>This is like inherit the same properties from generation to generation in the real world.</p><p>example:- animals make sound, but dog sounds and cats sound are different, and others also. That makes sound function comes from animals.</p><p>Now let’s take an example with code. This helps to avoid redundancy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*yJCmONcc9m4fmdb2qceKjA.png" /><figcaption>example of inheritance</figcaption></figure><p>Just think about an old handphone. We can get calls, send SMS, and sometimes we can listen to the radio only. But a new phone has more than those facilities. Camera, video, GPS.. etc. But it has functioned as the older phone was having like call, SMS, radio .. etc. So the new phone is having the same features as older phones that is inheritance.</p><p>Now let’s dive into inheritance with a code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8Rw8RzunY-cd33j8JLDOA.png" /><figcaption>without inheritance</figcaption></figure><p>Same functions have repeated in both classes. But when we use the inheritance concept we can avoid that issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SzuLO5-ZCjuky3xnlZIaHQ.png" /><figcaption>inheritance</figcaption></figure><p>In the concept of inheritance we have a doubt. If a new phone is inherited from old phone, some functions and properties of super class( old phone ) are different from sub class ( new phone ). So need to replace new phone’s features inside the new phone class. So we should be having a way to do that, shouldn’t we?. 😁</p><p>Yes of course there is a way , how to do that that is call method overriding. At the meaning of over ride you might feel something. 😉 If you don’t feel any sense, don’t worry I will teach it to you✌️ .</p><h4>Method overriding</h4><p>This means when we re-write a method that is the same as in superclass with a different body. example-:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*2cXgAknszNaF5_JWkx52-g.png" /><figcaption>consider as : man, cat, dog, inherits from animal class</figcaption></figure><p>Just think about eating function, commonly we use method eat() as the superclass. But there is a difference in eating of men and dogs, cats. So we can’t just inherit those methods and use them. We have to modify it as we want. Now consider about man class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ja85fBJnNEBkELpltD9ZYA.png" /><figcaption>method overriding example</figcaption></figure><p>We rewrite the body of the method eat(); as suitable for man class. So that is the call method overriding. It is a very useful concept.</p><p>When talking about method overriding we can’t just leave method overloading. It’s also a simple concept but very useful as method overriding. Let’s take a look at it now.</p><h4>Method overloading</h4><p>This is also a very important concept. That means we make the same method several times inside a class.</p><p>But an error might be occurred when calling to that method because there are so many methods with the same name. So that could not happen. Can’t exist the same named methods several times.</p><p>Deffenately there should be a difference,shouldn’t it? You might have thought about the different 😉.</p><p>That is the parameter signature. It should be different in same-named methods. Parameter signature is something with the parameters. Just think about a method like this.</p><pre>void method(int a){<br>//something here<br>}</pre><p>In here parameters are integer type only. So the parameter signature is ‘ int a’</p><pre>void method(int a, String s){<br>//something here<br>}</pre><p>In this method parameter signature is int a , String s So you can see that it doesn’t matter to have same method name because it has different parameters. That is parameter signature.</p><p>Now let’s see an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSxY9DzobnLoEB-I-edI-A.png" /></figure><p>example of method over loading</p><p>Like the above example, if we call method1() it is about a method in the 7th line. If we call a method1(5) it is about a method in the 10th line. If we call a method1(3,4), it is about the method in the 14th line. That’s it.</p><h4>Polymorphism</h4><p>Polymorphism means many forms of the same thing. Such as the same properties with a different method, same method with different properties.</p><p>The object of a sub class can assign to the super class reference and had many forms with super class reference. I mean many forms😉. That’s polymorphism.</p><blockquote>There are two types of polymorphism.</blockquote><ol><li><strong>Static polymorphism</strong> as well as consider as <strong>compile-time polymorphism</strong></li><li><strong>Dynamic polymorphism</strong> as well as consider as <strong>runtime polymorphism</strong></li></ol><p>Here there are two things with this concept that we should be knowing.</p><ul><li>overriding- used in runtime polymorphism</li><li>overloading- used in compile time polymorphism</li></ul><p>as an example. Just think like this.</p><p>There is a class Human. Inside it there is a function walk(), so we can override it after extending. (inherit)</p><p>One inherited function is “walking with hands-on forward” inside a subclass. That is the method overloading. <br>And another inherited function is “walking on foot in reverse” inside a subclass. That is method overriding.</p><p>The main difference between runtime and compile-time polymorphism is JVM identifies which method should run in which time like that and run it. But in the compile-time overloaded methods can be identified but overridden methods can’t be identified because the decision which method should run is decided at the run time. That is why it is called runtime polymorphism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WdhMoU2FTIHAiyE7DVCrCw.png" /><figcaption>static binding- compile time polymorphism( different parameter signature )</figcaption></figure><p>It has the same methods but different parameter signature. It is method overloading.It is called compile-time polymorphism ( we can see the difference of the methods at first sight )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRqt635p7fKLI2xwRG6jyA.png" /><figcaption>dynamic Polymorphism-runtime polymorphism</figcaption></figure><p>Here, the object of the subclass has assigned to the super class’s reference. When we call for vh.drive() it runs drive method in the car class.</p><h4>Abstraction</h4><p>Abstraction is used when we just use the function without knowing the mechanics( what is happening with a function ), and also ignore ill-relevant characters of an object. Abstraction is used for information hiding.</p><p><em>In real-world example:-</em></p><blockquote>We know how to accelerate a vehicle, by pressing an accelerating pad. And also we know how to stop a vehicle by pressing brake pads. But we don’t know the mechanism of those function, we just use as we want. We don’t need the mechanism though. Just use those functions. That is an abstraction. Let’s see further.</blockquote><p><em>another example:-</em></p><blockquote>In a coffee machine we don’t know how coffee is making and what are the ingredients like that but we know when the button is pressed a cup of coffee can be got from the machine. ( we know the output but don’t know the mechanism ).</blockquote><p>Now you might be having a doubt if the abstract method is not having a body how can hide information or how to write method body. 😉</p><p>The answer is simple. We can use method overriding technique to access abstract methods. We have to use inheritance and get super class’s abstract methods.</p><p>See the above example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dk8_xUhrJSVFv5PkVfy3Yw.png" /><figcaption>abstraction</figcaption></figure><blockquote><strong>Advantages of Abstraction</strong></blockquote><ul><li>Avoid repeating and increase re usability</li><li>Reduce complexity</li><li>secure data</li></ul><blockquote><strong>Abstract class &amp; Abstract methods</strong></blockquote><ul><li>An abstract method should be in a abstract class but an abstract class should not be having only abstract methods</li><li>Abstract methods should not be having a body.</li></ul><h4>Encapsulation</h4><p>Encapsulation means capsule properties and methods in one part. Like a medical capsule that covers medicines inside the capsule but we don’t know what are their ingredients and can’t see them and also we don’t have a bitter taste because of that. We see just the capsule.</p><p>Data hiding is the key feature in the connection of the encapsulation concept. We use access modifiers to implement encapsulation concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_MuKH88mVK0u-BkoRxq0PA.png" /></figure><p>In the above example name, age are private. can’t access directly so we can use getters and setters to get and set values inside the capsule. getName(), getAge() are getters that use to get the values. And setName(), setAge() are setters that use to set values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T3XvZSd7thEHxYhb7eCLQQ.png" /><figcaption>encapsulation</figcaption></figure><p>That is how we can use encapsulation with java.</p><p>I hope you got something from this article. That is what oop concepts and its use.</p><blockquote>Happy coding !!</blockquote><h4>About the author</h4><blockquote><em>Kavindu Gayantha</em></blockquote><blockquote><em>Undergraduate</em></blockquote><blockquote><em>BSC(Hons) in Software Engineering</em></blockquote><blockquote><em>University of Kelaniya.</em></blockquote><p><a href="https://kavindu-gayantha.github.io/">Kavindu Gayantha</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bbf8a6de2b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/object-oriented-programming-9bbf8a6de2b3">Object Oriented Programming</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git & GitHub { part 2 }]]></title>
            <link>https://medium.com/@96kavindugayantha/git-github-part-2-74bc19fc4c12?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/74bc19fc4c12</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[merge]]></category>
            <category><![CDATA[git-branch]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[pull-request]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 03:45:28 GMT</pubDate>
            <atom:updated>2020-04-25T18:43:29.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>Collaborative works with GitHub</h3><h4>Git &amp; GitHub part 2</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Cb2WlVRiO3csejByQUOiIQ.png" /><figcaption>GitHub Workflow</figcaption></figure><p>In this article I am explaining how to work with your team members through this platform.GitHub is a very good solution for the issue of being working collaboratively with a team. Let’s see how it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Z0e6zjbMxsaf8tnZ_dzMzQ.jpeg" /></figure><p>Just think as an example, if you are building a dynamic website. So you need to use a language which suitable for back-end development like(PHP, Js, Python, JAVA .. etc ) front-end could be HTML / CSS /Js something like that or using front-end development frameworks like Angular, Vue or libraries like React with back-end development frameworks like NodeJs(a runtime environment), Laravel, Spring. etc. Whatever it is, you need some connection when building front end with back-end. Unless it is very difficult to see what happens with the back-end. And other ones who build back-end don’t see the code of front-end developer. There is a problem there, isn’t it? So this is the solution.😎</p><p>Use GitHub to work with your team. Push your code to GitHub and let other members of your team connect with that repository. You need some Git knowledge to do this.</p><p>There are some git commands needed to know. I will tell you about that with this article. If you didn’t read my previous article about git, follow this <a href="https://medium.com/@96kavindugayantha/git-github-18240cbff4c6">link.</a> And continue reading this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjVxxziVYwYh_HacoHmCOg.png" /><figcaption>mn-repo</figcaption></figure><p>Just think about my-repo repository in the GitHub. Just think this is the repository that you are going to work with. Clone that repo into your local git repository. What is meant by that? 😉 let’s see</p><pre>$ git clone &lt;your git url&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWXmwh3jLc0-84oN0b7X4Q.png" /><figcaption>copy the url given in that dialog box(clone or download)</figcaption></figure><p>now go to any directory on your computer. Open terminal from there( or Gitbash) run above code there. Ex:-</p><pre>$ git clone <a href="https://github.com/Kavindu-Gayantha/my-repo.git">https://github.com/********/my-repo.git</a></pre><p>replace the URL with your repo URL. Now see the change of your local directory is became a Git repo with all updated with my-repo content.</p><p>try with git status command to see the changes in git</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*_UzA2fdBkGbe6z85I9DKLg.png" /><figcaption>branch is upto date with origin/master</figcaption></figure><p>now you can start working in that repository and can push changes and make a request to merge it to the main repository to the repo owner. Let’s see step by step how to do.</p><p>First you need to make some branches at least one, to avoid affecting the master branch code. So make a branch from the updated master branch with this command.</p><pre>$ git branch &lt;new-branch-name&gt;</pre><p>replace &lt;new-branch-name&gt; with your new branch name. like</p><pre>$ <strong>git branch features</strong></pre><p>if you want to know current branches in your git repository</p><pre>$ git branch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*xpovECRkdtw7M0gTFVpfdg.png" /><figcaption>star mark represent current working branch you can switch to any branch easity</figcaption></figure><p>now switch to your new branch ‘‘features’’.</p><pre>$ git checkout features</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*cQdtcmZ7ug41UMeK5R3apA.png" /><figcaption>see the star mark is changed to new branch features</figcaption></figure><p>now the current working branch is features branch now start working. You can make any number of branches as you wish.</p><p>Now let’s see change something and push to the remote repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*uRm165yPh5NPqYuIUi-VdA.png" /><figcaption>changed insite text.txt file.</figcaption></figure><p>now push with these commands.</p><pre>$ git add .<br>$ git commit -m &quot;changed something in text file&quot;<br>$ git push origin features</pre><p>I explained these commands in my <a href="https://medium.com/@96kavindugayantha/git-github-18240cbff4c6">previous article</a></p><p>We are pushing to features branch, aren’t we? So git push origin features. you can change anytime when you are in another branch. Make sure that you are not pushing your commits to the master branch.</p><p>Now make a pull request .Go to my-repo GitHub repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73CscK-MiS9HA-ERHVGEiA.png" /><figcaption>see, compare &amp; pull request button.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwfJtIOirUdeBDO8vW2vsg.png" /><figcaption>git commit message is displayed automatically as request header.</figcaption></figure><p>Create pull request and let owner of master branch to merge your pull request after reviewing it. If your branch can be accept it will be merged to master branch.</p><p>Now check these commands too.</p><p>To make a git pull , that helps to make up-to date of your local repository with the remote repository.</p><pre>$ git pull</pre><p>These are some few git commands that you should be aware of. There are more than these commands. These are some basic commands. 😉</p><p>Now you might understand how that problem solves which I mentioned previously about front-end back-end connecting. In this way, both front-end and back-end developers use one repository and other one clone it and make changes in his/her side and push and make a pull request. The owner of the repository will merge it after reviewing it. See, it’s not much hard. Very easy steps to follow. I hope you all enjoyed. 🙌 .</p><p>Thank you for reading my articles. Keep reading. 😉</p><p>check my YouTube video as well.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJEBDXTo6P2s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJEBDXTo6P2s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJEBDXTo6P2s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/39148b01087d6820bf022a12249294de/href">https://medium.com/media/39148b01087d6820bf022a12249294de/href</a></iframe><h3>Author:</h3><blockquote><a href="https://kavindu-gayantha.github.io/"><em>Kavindu Gayantha</em></a></blockquote><blockquote><em>Undergraduate</em></blockquote><blockquote><em>BSC(Hons) in Software Engineering</em></blockquote><blockquote><em>University of Kelaniya.</em></blockquote><p><a href="https://www.linkedin.com/in/kavindu-gayantha-73478615b/">https://www.linkedin.com/in/kavindu-gayantha-73478615b/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74bc19fc4c12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git & GitHub]]></title>
            <link>https://medium.com/@96kavindugayantha/git-github-18240cbff4c6?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/18240cbff4c6</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[git-commit]]></category>
            <category><![CDATA[install-git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git-confi]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 22:00:13 GMT</pubDate>
            <atom:updated>2020-03-18T05:32:44.304Z</atom:updated>
            <content:encoded><![CDATA[<h4>About git and its use for newbies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*jJ3Pj4-XqRyHm1aIELn8NA.jpeg" /><figcaption>git + GitHub</figcaption></figure><p>Git is a tool that every programmer should know. If you are new to word git, read this article until the end.😀</p><p>Git is used for version control. It can be used in software development for tracking changes in source code. It is very useful when we are developing a big program. Always there is a probability in software development to be crashed a software that we are developing. We can avoid that risk when using Git. That development under git control we can do it as several versions. If we went wrong in any version we can go to the previous version that works successfully and can continue our works. And also git is used for collaborative development. We can use git by dividing it into several branches and do changes in code. That affects only that relevant branch not to the main ( master ) branch. If something went wrong, that only affect that branch. It doesn’t matter we can delete any branch in any time and continue our works. Let’s see further how to get started working with Git and how these things happen.</p><p>Follow <a href="https://git-scm.com/downloads"><strong>this link</strong></a><strong> </strong>to download <strong>git</strong> to your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myVUfgy51mi9PcXogcTnyQ.png" /><figcaption><a href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></figcaption></figure><p>Actually, I am using Linux. So I will show you git bash commands from this article.</p><pre>$ sudo apt-get install git</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdGdt5CHbsp-WlhlTlVopA.png" /><figcaption>type in the terminal</figcaption></figure><p>now check the version of git. if it is shown any version like this, git is installed successfully.</p><pre>$ git --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7EbNdhAJdjMNTbABCbJPA.png" /><figcaption>check git version</figcaption></figure><p>before working with git we have to configure git. To configure git use these commands.</p><pre>$ git config --global user.name &quot;username here&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HscMMCMRulOUf8oLDlt3qw.png" /><figcaption>git config username</figcaption></figure><p>this user name is the name that you use as your user name in git commits.</p><pre>$ git config --global user.email &quot;your used email here&quot;</pre><p>this email is used as your email for git commits</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3gVKrPWX1pCTmDDW6XYYA.png" /><figcaption>configuration git</figcaption></figure><p>Now you are ready to use git. Let’s go through it.</p><p>When you use git another name is come to our mind ‘GitHub’. Actually GitHub is a service that use to host projects that use git, then others can see our source code, and they could be suggest changes and can make a request to edit the source code of our existing code. That is how major open source projects are built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*JeJ6mSsv2Qkj4tVeIfdpMw.png" /><figcaption>here some open source GitHub repositories</figcaption></figure><p>To use GitHub you should be having a GitHub account. refer <a href="https://github.com/join?source=header-home"><strong><em>this link</em></strong></a> to make a GitHub account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4R87AkQUfC8WGm-zI8jYw.png" /><figcaption>create github account</figcaption></figure><p>sign up with credentials. Then you are ready to use GitHub. : )</p><p>In GitHub all are made with repositories. You have to make repositories for each your projects. One repository for one project. Let’s see how to make a new GitHub repository.</p><p>In the GitHub page in the navigation bar click the icon of your profile pic that placed right corner. Then there is a drop-down menu appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJszfRkQ8KN8LiPnm2V1Yw.png" /></figure><p>select your repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*-LE-BXq-MSq5hP9kLh9Iew.png" /><figcaption>drop down menu</figcaption></figure><p>now click new button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhnxWTsBF19Y4ly8yvok1w.png" /><figcaption>new button</figcaption></figure><p>Then input repository name and a description as you wish. And create repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*zDRL1zr6DOjz-rUaNSLnMQ.png" /><figcaption>you can make the repository in public or private</figcaption></figure><p>private repositories are not visible to others but public is. However you can make changes in repository type as make public or make private. ;-)</p><p>Now you can see the page like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQCCwPpqySB3-6UesGjzyA.png" /><figcaption>my-repo new repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Cb2WlVRiO3csejByQUOiIQ.png" /><figcaption>simple diagram to explain Git and GitHub mechanism</figcaption></figure><p>Now let’s make a git repository locally. When we push our code to GitHub we should made it locally in a git repository. Let’s see how to do that.</p><p>Go to any directory in your computer as you wish to save your git project.And type below command to realize whether it is a git repository or not,</p><pre>$ git status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*5ieIafIF-1e5CvZasziB-g.png" /><figcaption>if it is not a git repository, this message will show</figcaption></figure><p>then make that repository as a git repository, type this code</p><pre>$ git init</pre><p>now that repository is a git repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*lIG_jmYEYg91YBy3n7YblQ.png" /><figcaption>initialize a git repository</figcaption></figure><p>now make some changes in this repository.( you can start your project here now ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*ZhSvOOo2df3GFexeDMt6PA.png" /><figcaption>made a text file and see what changes</figcaption></figure><pre>$ git status</pre><p>this command shows all git changes from last git commit.Now push this changes to git, follow these commands if this is the first git commit of this repository.</p><ol><li>git add</li><li>git commit -m “ commit name ”</li><li>git remote add origin &lt; paste git cloned url here &gt;</li><li>git push origin master</li></ol><pre>1).</pre><pre>$ git add .</pre><p>this means, add all git changes in this repository to git. dot sign(. ) says ‘all’</p><p>if we want , we can add file by file to git after naming which to add to git</p><pre>$ git add &lt;filename here&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LbFY_uRMo_8w7D17Rbe3Eg.png" /><figcaption>add textfile to git</figcaption></figure><pre>2).</pre><pre>$ git commit -m &quot;commit name here&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*g-mv_Qvx4sKhCHRbT0zmeA.png" /><figcaption>make commit name meaningful</figcaption></figure><p>this commit name shows us what was changed, and it is easy to go back on code and find out which commit has errors, if we met errors in development.</p><pre>3).</pre><pre>$ git remote add origin &lt;url here&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2e5jvX0aC7f4lY5W9hh1A.png" /><figcaption>paste the url in the place where repository clone or download option</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*U4GRbKqbXUFR1BJ7S7WT3A.png" /></figure><p>now we can push changes to remote repository.</p><pre>4).</pre><pre>$ git push origin &lt;branch name&gt;</pre><p>by default branch name is master so, command will be like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiz1JiF533SrCpuWY6FrYA.png" /><figcaption>git push origin master</figcaption></figure><p>Now check GitHub repository. All changes must have been updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kDsgSFM1uTeOFyEUrGMRzw.png" /><figcaption>GitHub updated</figcaption></figure><p>That’s all, very easy ,isn’t it?😉.</p><p>Follow these steps to make your git, if you are a beginner this will help you. I will show you some other git commands in my next article.</p><p>Thank you for reading my articles. 😊</p><p>follow my YouTube channel, I have uploaded a video based on git.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FiYQ8VMKWGYk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DiYQ8VMKWGYk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FiYQ8VMKWGYk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6cd00d47ba107663a4d4059fd373c49/href">https://medium.com/media/f6cd00d47ba107663a4d4059fd373c49/href</a></iframe><h4>Author:</h4><blockquote>Kavindu Gayantha</blockquote><blockquote>Undergraduate</blockquote><blockquote>BSC(Hons) in Software Engineering</blockquote><blockquote>University of Kelaniya.</blockquote><p><a href="https://www.linkedin.com/in/kavindu-gayantha-73478615b">Kavindu Gayantha - Undergraduate - University of Kelaniya Sri Lanka | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18240cbff4c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a server?]]></title>
            <link>https://medium.com/@96kavindugayantha/what-is-a-server-d5d58d4d54d0?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d58d4d54d0</guid>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[proxy-server]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[ftp-server]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Sun, 09 Feb 2020 12:17:15 GMT</pubDate>
            <atom:updated>2020-02-09T12:17:37.990Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a server</h3><p>explains about servers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*MiR6cN9QxSykwUkG1IwP1A.jpeg" /></figure><p>The term <strong>server</strong> might be familiar to you. What is actually a server is? .A server is also <strong><em>a computer</em></strong><em> </em>which has a huge capacity and huge processing power.Normally servers are being used by so many users, that’s why it needs huge processing power.Our personal computer is also be able to use as a server but if so many people is getting use that server at one time, that server doesn’t have resources to give what clients want , that is why server machines are having huge performance.</p><p>There are some types of servers.</p><h4>* Proxy server :</h4><blockquote><em>A proxy server is used between client and server connection. It interface with network application such as web browsers and web servers. Proxy servers are installed on devices some ISP s ( internet service providers ) use proxy servers for their services in their organizations. And also there is a third-party hosted website named web proxy servers which are available for users for browsing the internet. Normally proxy servers provide data caching, network connection sharing and data filtering as well as sometimes act like firewalls.</em></blockquote><h4>* DNS server</h4><blockquote>DNS stands for domain name server. Which means it stores domain names and IP addresses of websites that users are connecting through their server, it is called caching. and translates domain name into IP address because browser knows websites by their IP address not with domain name. That mechanism helps to improve the efficiency of the system.</blockquote><h4>* web server</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WeR3S6lz6gZ4P9-9GjNymg.png" /><figcaption><a href="https://media.prod.mdn.mozit.cloud/attachments/2014/09/24/8659/e4dbea826891566db3802b34fd0d836f/web-server.svg">ref:https://media.prod.mdn.mozit.cloud/attachments/2014/09/24/8659/e4dbea826891566db3802b34fd0d836f/web-server.svg</a></figcaption></figure><blockquote>When a client sends a request for a web page, the web-server searches it, if that page is found then it will send it to the client with an HTTP response.If the requested web page is not found, the web server will then send an <strong>HTTP response: Error 404 Not found.</strong></blockquote><blockquote>If the client has requested for some other resources then the web-server will contact the application server and data store to construct the HTTP response.</blockquote><h4>* FTP server</h4><blockquote>One of the oldest of the Internet services, File Transfer Protocol makes it possible to move one or more files securely between computers while providing file security and organization as well as transfer control.It is commonly used to download a file from a server through the Internet or to upload a file to a server.However FTP servers is considered as outdated. Just keep in mind FTP was made before TCP/IP exists. FTP is not longer updates there are some other protocols has designed for file transer in secure way better than FTP (FTPS, SFTP and HTTPS)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d58d4d54d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP request with Kotlin]]></title>
            <link>https://medium.com/@96kavindugayantha/http-request-with-kotlin-5a01363fdaa7?source=rss-985b9b527c1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a01363fdaa7</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[android-studio]]></category>
            <category><![CDATA[fuel]]></category>
            <dc:creator><![CDATA[Kavindu Gayantha]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 07:13:00 GMT</pubDate>
            <atom:updated>2020-01-23T07:13:00.072Z</atom:updated>
            <content:encoded><![CDATA[<h4>getting http response| fuel library| Kotlin in android studio</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*moZfqM8wGQP9DmrK.png" /></figure><p>First we need to make a new android project. I chose Basic Activity to make this project as main activity. I enter the project name as MyApp1 and chose the file location as I want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*TP3M2VJn0bxltcqZ.png" /></figure><p>Now project is ready to use.</p><p>Firstly we need to make the app permission to access the internet to get HTTP requests. To change the app permission go to <strong><em>AndroidManifest.xml </em></strong>file</p><pre><strong>path</strong> : app -&gt; Manifests -&gt; AndroidManifest.xml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/0*bWzExRmAgvqziWCf.png" /><figcaption>AndroidManifest file location</figcaption></figure><p>Then type below tag inside &lt;manifest&gt; .</p><pre>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;&gt; <br>&lt;/uses-permission&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/0*684qwFApOfI_yYO0.png" /><figcaption>internet permissions in androidmanifest.xml file</figcaption></figure><p>Then we need to add dependencies to the app. To do that go to gradle file.Actually there are two gradle files in a android project . How to know which gradle file is correct in inserting dependencies.?</p><p><strong>build.gradle(app)</strong> is for making dependencies related to the app, and <strong>build.gradle(project)</strong> is for making dependencies for the whole project.</p><p>we use <strong>fuel </strong>library for this task. There are other libraries also but here I used fuel library. Now go to <a href="https://github.com/kittinunf/fuel">GitHub</a> site here I have given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*-x7vCH9_0TJKv7aT.png" /><figcaption>fuel github repository follow the link i have given</figcaption></figure><p>now copy the code given in that page like ,</p><pre>//core<br>implementation &#39;com.github.kittinunf.fuel:fuel:&lt;latest-version&gt;&#39;</pre><p>paste that code inside the build.gradle file. And replace &lt;latest-version&gt; with the real version number given in that site. When I am writing this article the given version is 2.2.0 and sync the project to add these dependencies to the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*k_j4yj80rh_Y-faP.png" /></figure><p>Now type this code .</p><pre>Fuel.get(&quot;https://httpbin.org/get&quot;)<br>    .response <strong>{ </strong>request, response, result <strong>-&gt;<br>        </strong><em>println</em>(request)<br>        <em>println</em>(response)<br>        val (bytes, error) = result<br>        if (bytes != null) {<br>            <em>println</em>(&quot;[response bytes] ${<em>String</em>(bytes)}&quot;)<br>        }<br>      <strong>}</strong></pre><p>In above code</p><pre>Fuel.get(&quot;https://httpbin.org/get&quot;)</pre><p>Means from where we are getting responses as our request. httpbin is a simple HTTP Request &amp; Response Service. There are many other services also. Here I have given another one.’ jsonplaceholder’</p><pre>Fuel.get(&quot;https://jsonplaceholder.typicode.com/posts&quot;)//it shows all the results from posts end point</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*hOCDTcY31neocM3N.png" /><figcaption>Iadded that code inside the onCreate() method</figcaption></figure><p>Now we can call this function on button click or some in action. I made a button with id buttonClickMe and placed this code inside that function and get JSON response when button clicked.</p><pre>buttonClickMe.setOnClickListener<strong>{<br>    </strong>Fuel.get(&quot;https://jsonplaceholder.typicode.com/posts/2&quot;)<br>        .response <strong>{ </strong>request, response, result <strong>-&gt;<br>            </strong><em>println</em>(request)<br>            <em>println</em>(response)<br>            val (bytes, error) = result<br>            if (bytes != null) {<br>                <em>println</em>(&quot;[response bytes] ${<em>String</em>(bytes)}&quot;)<br>            }<br>        <strong>}<br>}</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/0*4FaufmF4wiyxHwMQ.png" /><figcaption>this is how I did it.</figcaption></figure><p>That is the way how we can get HTTP response from the Internet using fuel library in Android studio. :-)</p><p>Hope you learnt something.</p><p>this is the code : <a href="https://github.com/Kavindu-Gayantha/android-fuel">GitHub</a></p><p><a href="https://github.com/Kavindu-Gayantha/android-fuel">https://github.com/Kavindu-Gayantha/android-fuel</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a01363fdaa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>