<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: KevinSarav</title>
    <description>The latest articles on DEV Community by KevinSarav (@kevinsarav).</description>
    <link>https://dev.to/kevinsarav</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F146014%2Fa88d2f2d-2718-43ba-8225-9dccdcf0d1c2.png</url>
      <title>DEV Community: KevinSarav</title>
      <link>https://dev.to/kevinsarav</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kevinsarav"/>
    <language>en</language>
    <item>
      <title>Unit Testing</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Sat, 19 Oct 2019 19:16:20 +0000</pubDate>
      <link>https://dev.to/kevinsarav/unit-testing-2f02</link>
      <guid>https://dev.to/kevinsarav/unit-testing-2f02</guid>
      <description>&lt;p&gt;In my internship, one thing that is heavily stressed is to have 100% code coverage. This means that every single possible path you can go through in a function will be explored and made sure they are each successful. For example, if you have an if and an else statement and your program usually only goes through the if statement and not the else, you want to make sure the else statement is also tested.&lt;/p&gt;

&lt;p&gt;I will be discussing the cmocka framework for testing with the C programming language, though I'm sure there are many other kinds. Cmocka is just the one I'm most familiar with.&lt;/p&gt;

&lt;p&gt;There are two kinds of tests you can do. There is the unit test and the functional test. The functional test will call a function and if there is another function called inside of it, that function will also be called. This kind of testing is very simple to do: all you have to do is call the function you want to test and just make sure doing that doesn't throw any errors.&lt;/p&gt;

&lt;p&gt;Unit testing, on the other hand, is a very powerful tool, but also a little more complicated to implement. Unit testing tests functions in isolation. If the function you want to test called another function inside of it, you don't want to call the actual function. You want to call something called a mock of the function.&lt;/p&gt;

&lt;p&gt;Think of a mock as a test double. Instead of calling the actual function inside your function under test and risking something it does affecting the results of your function under test, you make a mock of the function inside your function under test and call that instead. The mock function just takes the place of the actual function.&lt;/p&gt;

&lt;p&gt;You might be wondering how the program will know to call the mock if you just want to test everything or call the actual function if you want to actually run the program, then. The answer, at least for the C programming language and the cmocka framework, is that unit testing is done during the pre-processing stage. The pre-processing stage occurs before the actual processing is done. The C programming language using cmocka allows you to give commands for the pre-processing stage by using macros.&lt;/p&gt;

&lt;p&gt;The macro is basically a pre-defined, all-caps string. The program goes through everything once over in the pre-processing stage. If this macro string is encountered, then this macro will be replaced with something different depending on if it's the pre-processing stage or the actual processing stage. This concept is used when unit testing.&lt;/p&gt;

&lt;p&gt;Another thing you want to test as you're unit testing is to make sure that the parameters that are passed through are correct. This is done by having a stack. In this stack, you put in values that must be tested (in this case, your parameters), and on the other side, you will take values out of the stack one by one to test the values. To put values into this stack, you use a will_return function call. To take values out for testing, you use a mock() function call. To test your parameters, you can use assert functions, usually assert_int_equal, inside of your mock functions. &lt;/p&gt;

&lt;p&gt;Inside of your assert function call, you usually have two parameters: one is a mock() call that takes the value from your stack to test, and the other is what that mock should actually be. Because will_return and mock() are intertwined in this manner, you can never have more or less mock() calls than will_return. If this occurs, you will get a noticeable error to indicate there's still stuff in your stack or you're trying to pull from an empty stack.&lt;/p&gt;

&lt;p&gt;I hope this helps any new developers understand unit testing. Unit testing is very fundamental and is the best way to catch errors during programming. If a developer accidentally misspells a variable inside of a function that already has a unit test function attached to it, then that error will be caught during unit testing. Similarly, if a developer re-arranges variables or removed variables or alters parameter results, the unit test will catch that.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Internship Updates</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Thu, 26 Sep 2019 14:15:04 +0000</pubDate>
      <link>https://dev.to/kevinsarav/internship-updates-45f0</link>
      <guid>https://dev.to/kevinsarav/internship-updates-45f0</guid>
      <description>&lt;p&gt;So far, my internship has been going well. I just completed my first Jira ticket and put it up for code review with a pull request. I've already addressed all the comments from my co workers, so I should be able to merge soon. My ticket was about adding unit tests using the cmocka framework to one function. My next ticket will be the same, except I'll be adding unit tests for the rest of the functions in the file I was working on. We aim for 100% code coverage. For a lot of this internship, I've been by myself researching and trying to tackle my problems myself.&lt;/p&gt;

&lt;p&gt;Some challenges I faced were with working with Git. I initially had one issue where any code changes I made weren't being reflected on my unit tests. I found out that that was because my VS Code was only making changes to the files in my local machine, not the files on my Linux machine. To solve this, I added a Remote SSH extension to my VS Code so I can connect to my VM and make my code changes on there.&lt;/p&gt;

&lt;p&gt;Another issue I faced recently was trying to remove a single white space that I added with a commit. For some reason, Bitbucket flagged a white space in the diff file, even after I already fixed it on Bitbucket. One of my co workers suggested I remove the commit. I found out that to do this, I needed to use the command git revert . However, I've been having issues trying to connect to my Bitbucket branch instead of my local branch, so whenever I reverted the commit and pushed, I could not see the change reflected on Bitbucket. To fix this, I ran the command git checkout -B   because whenever I tried to access my Bitbucket branch, I get an error saying a branch already exists with that name. After doing this, reverting the commit, committing this change, and pushing, my Bitbucket finally removed the commit and the white space is no more.&lt;/p&gt;

&lt;p&gt;Some future issues I expect to face are with these unit tests. For the most part, I've been doing the usual unit tests, but in the future, I suspect to tackle problems where I'd have to understand what the code is doing to do the unit test properly. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>What I Learned</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Tue, 10 Sep 2019 23:02:12 +0000</pubDate>
      <link>https://dev.to/kevinsarav/what-i-learned-1m95</link>
      <guid>https://dev.to/kevinsarav/what-i-learned-1m95</guid>
      <description>&lt;p&gt;Today I will discuss briefly what I learned during my first few days of my internship. I will try to keep things vague so as not to discuss company trade secrets. If I am wrong in anything, please correct me so I can learn the right things.&lt;/p&gt;

&lt;p&gt;I learned about controllers, storage boxes and servers. I've learned about initiators and target devices as well as the SAS protocol. I learned the history of protocol advancements. Parallel ATA was the first, then came SATA, then SCSI, then finally SAS. I learned about firmware and drivers. I learned about backplanes, expanders, cooker boards and VSMs. I learned about SDKs and platforms. &lt;/p&gt;

&lt;p&gt;In my next post, I hope to talk more about the things I learn. I hope to eventually play with the hardware, write some C++ code, and encounter some challenges to talk about. For now, I'm mainly learning about the company's products and about the field. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Left Rotation Challenge</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Tue, 03 Sep 2019 02:53:27 +0000</pubDate>
      <link>https://dev.to/kevinsarav/left-rotation-challenge-g5l</link>
      <guid>https://dev.to/kevinsarav/left-rotation-challenge-g5l</guid>
      <description>&lt;p&gt;Today, I took on the Left Rotation challenge on HackerRank's Array section using C++. This challenge took me a lot of thinking to complete. I will explain my thinking process below.&lt;/p&gt;

&lt;p&gt;My first thought before starting this assignment is that if I rotate every value in the array to the left one by one, it may take a significant amount of time if I encounter a test case with a big array. To combat this, what I'll want to do is move every value to their final destination instead of moving them one by one to their final destination.&lt;/p&gt;

&lt;p&gt;To accomplish this, first I considered recursion. However, recursion proved a little too difficult to think about doing because I had several variables I wanted to use, and those variables would be altered in some way through the iterations of the recursion.&lt;/p&gt;

&lt;p&gt;My next thought is to have a for loop going through a counter. This counter makes sure every value in the array is rotated. I instantiated two temporary integer variables that will hold the value at the beginning and the value at the destination. A place integer variable kept track of where I was in the array. Through the iterations of the counter for loop, I will be working from the place from the previous iteration. &lt;/p&gt;

&lt;p&gt;My first challenge is finding out how to make this work when the first thing I want to do will be different from every iteration after it. To solve this, I made an if statement that said if the counter variable is equal to zero, meaning this is the for loop's first iteration, then I will make the temporary variable equal to the value at place, which should be the value at the first index. I did not have to make an else statement or add any additional stuff into the if statement because I found out that was the only significant difference between the first iteration and every one after.&lt;/p&gt;

&lt;p&gt;I already knew how the rotation will be done. I will subtract the d variable from the place variable. If place is less than zero, then I will make place equal to the size of the array minus the place variable's value. &lt;/p&gt;

&lt;p&gt;My next challenge was finding out how to swap. Initially, I swapped the value at the original location with the value at the final destination. However, the challenge was that because of how my code was done, the value at the final destination is never visited again at the previous place and so is never put at its final destination. It is only the value that is at the final destination that keeps being rotated. On top of that, I never stored the value that I would be rotating for its next iteration. To fix this problem, instead of swapping, I just stored the variable in a second temporary variable as mentioned previously and did not do anything with the value at the previous place. I only focused on changing the value at the new place.&lt;/p&gt;

&lt;p&gt;My next challenge was finding out what to do with one of the test cases. One test case was 10 left rotations with an array of size 20. The issue was that my for loop only every changed the values at the first place, the last place, and the middle place because after two 10-left-rotations, I ended up back at the origin. To solve this, I made an origin variable that kept track of if my for loop ever got back to origin. I made an if statement that said if place is equal to origin and counter is not equal to the size of the array minus 1, or the last iteration, then add one to place and origin, and make the temporary variable equal to the value at the new place. I put this at the end of the for loop so that first the steps inside the for loop will be completed, and then the variables I mentioned will be changed for the next iteration.&lt;/p&gt;

&lt;p&gt;I hope to discuss more about other challenging HackerRank challenges in future posts. I will use C++ to do the challenges in preparation of my internship. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Internship</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Sun, 18 Aug 2019 04:09:41 +0000</pubDate>
      <link>https://dev.to/kevinsarav/internship-25la</link>
      <guid>https://dev.to/kevinsarav/internship-25la</guid>
      <description>&lt;p&gt;Hello. I have some fantastic news. I was recently offered a software engineering internship. I am expecting to start on the 9th. I hope to post more about my experiences in my internship and what I'm learning.&lt;/p&gt;

&lt;p&gt;I am still trying to work on my checkerboard Android application using Kotlin. I'm having issues moving the pieces so that they fit in the grid in the appropriate places. For some reason, every JPG picture of a checker piece I put on the board is pushed to the top left corner. Clicking and dragging to the spot I want to put the piece in doesn't help. Changing the row and column doesn't help, either. I'm assuming it has something to do with the overall layout, but I'm not familiar with Android layouts. &lt;/p&gt;

&lt;p&gt;I will update on the app when I find a solution. However, I plan to work on polishing my C++ skills for the internship. The job relies more on C++, so I want to make sure everything I can do with Kotlin and Java, I can do with C++. I also want to make sure I perfect pointers because pointers are very important in C++. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Update on Progress</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Mon, 29 Jul 2019 20:40:23 +0000</pubDate>
      <link>https://dev.to/kevinsarav/update-on-progress-332b</link>
      <guid>https://dev.to/kevinsarav/update-on-progress-332b</guid>
      <description>&lt;p&gt;Hello. This post will summarize what I've learned and what I hope to improve, as well as what changes have occurred.&lt;/p&gt;

&lt;p&gt;I'm currently not part of the job search site project anymore. However, everything I learned about web development getting ready for that project is still intact. I've reached the final projects of the Udemy web dev course. My biggest challenge with the face recognition project is making a box appear where the face is, but the coordinates of the box are printed on the console.&lt;/p&gt;

&lt;p&gt;I'm currently taking an interest in and learning Android app development. I'm going through free YouTube videos to learn. I'm mainly interested because it uses Java, which I love a lot more than web development languages. &lt;/p&gt;

&lt;p&gt;I've completed a series of videos on using Java to make Android apps. I'm currently reading a book that goes over Kotlin's application to Android. So far, the first quarter taught how it differed with Java and other features of it, but I have yet to learn how to apply it to Android development.&lt;/p&gt;

&lt;p&gt;The reason why I wanted to learn Kotlin for Android is because I read online that it is a very convenient and clean language to use. I find some of the things done with Java for Android development is redundant. Also, it's very similar to Java, which should make it easy to learn.&lt;/p&gt;

&lt;p&gt;I'm trying to make an Android calculator app using Kotlin. My calculator app is attempting to mimic the behavior of the Windows application, much like my Java program I mentioned already does. I wanted to transfer that concept to make an application using Kotlin. So far, my app consists of a TextView at the very top with the number aligned to the very right and a GridLayout that holds all the buttons. &lt;/p&gt;

&lt;p&gt;Right away, one of the challenges is making the front end look neat. The buttons on the fifth column, the rightmost column, are cut in half. I could not find help online on how to tackle this. My workaround to this was to just shrink the buttons on the rightmost column so they fit inside of the emulated phone. &lt;/p&gt;

&lt;p&gt;However, my next challenge is that when I emulate the app on my phone, it cuts off the fifth column entirely. This is my first time seeing first-hand what people mean when saying developing for Android is difficult because of the multitude of devices. I thought Android Studio would immediately scale my app so it would work on other phones, but that doesn't appear to be the case. I read solutions online that say the only way is to make separate XML files for small, normal, large and X-large screens, and then also landscape mode versions of those. &lt;/p&gt;

&lt;p&gt;I could have made different XML files, but I did not want to go through such lengths for such a simple app. To work around this problem, I elected to remove one column from my GridLayout, center the GridLayout, and arrange the buttons to fit in this new, smaller GridLayout. In essence, I added a buffer/margin to either side of my GridLayout so that no matter the phone, all my buttons will fit inside.&lt;/p&gt;

&lt;p&gt;In my next post, I hope to talk further about my calculator app.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Web Development</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Mon, 24 Jun 2019 20:22:32 +0000</pubDate>
      <link>https://dev.to/kevinsarav/web-development-40ol</link>
      <guid>https://dev.to/kevinsarav/web-development-40ol</guid>
      <description>&lt;p&gt;In this post, I will discuss what I have learned so far. I've been taking a web development course through Udemy. In the course, I have brushed up on my HTML and CSS. I learned new tools for styling, such as Bootstrap, Flex, Grid, and using templates online to style a website. &lt;/p&gt;

&lt;p&gt;In this course, I have also brushed up on my JavaScript and learned how I can use that with React to make reusable components and a responsive website. Right now, I am on the final project where I am building a face recognition website. You input the image address, and it'll display the image and a box around any human faces contained in the image. &lt;/p&gt;

&lt;p&gt;The main reason I've been focusing on web development is because I will be helping on a project's front end. My team right now is considering exploring other avenues that are quicker to complete. I mentioned before we were considering making a career seeking website. However, after a lot of discussion, we've realized that it will take a lot of research, resources and time to complete, so we will think of other ideas we can pursue. &lt;/p&gt;

&lt;p&gt;I'm very excited about learning React. I see a lot of jobs online needing React experience, so if I use what I learn to do the final projects and make projects of my own, I'm sure I'll stand out as an applicant. I also hope to get back into learning app development. While what I'm learning will make it so that I don't have to dabble in HTML and CSS too much to make a website, I still prefer app development. &lt;/p&gt;

&lt;p&gt;In my next post, I hope to talk about the final projects I will have finished from the Udemy course. I also hope to talk about any advances in learning about app development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learning</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Thu, 06 Jun 2019 18:39:35 +0000</pubDate>
      <link>https://dev.to/kevinsarav/learning-13jf</link>
      <guid>https://dev.to/kevinsarav/learning-13jf</guid>
      <description>&lt;p&gt;I wanted to give an update on my progress. So far, I've been doing a lot of learning. I joined a startup trying to make a unique career website. I can't lay out too many details, but hopefully this idea becomes successful. To that end, I've been learning a lot of web development so I can be useful to the team. I learned about React and Webpack as well as brushed up on my HTML, CSS and JavaScript skills.&lt;/p&gt;

&lt;p&gt;On the side, I have also been trying to learn Android development using Android Studio. My teammates for the startup don't think a native app is necessary, but I hope this knowledge can be used for future employment opportunities. I went to an iOS development meetup a month or so ago, and I talked extensively with one of the members who told me that app development is very in-demand. Not only that, but Java is my favorite language and I've always preferred that kind of development over web development. I hope I get enough practice to get those kinds of jobs, but if not, all of this web development will definitely be useful, especially since JavaScript is so similar to Java, which I enjoy.&lt;/p&gt;

&lt;p&gt;In my next post, I hope to talk more about my accomplishments with the startup and any Android projects I have started. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>HackerRank</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Tue, 21 May 2019 03:51:24 +0000</pubDate>
      <link>https://dev.to/kevinsarav/hackerrank-2hhi</link>
      <guid>https://dev.to/kevinsarav/hackerrank-2hhi</guid>
      <description>&lt;p&gt;Hello, all. In this post, I want to talk a little bit about what has transpired since my last post.&lt;/p&gt;

&lt;p&gt;My group project was successful, but I do wish I could've played more of a role. I was tasked with the HTML of one page of the project, but not the database stuff that I really wanted to learn. I hope to use the database stuff from my group project as an example for the Clean Exchange. So far, I have looked at the HTML that's already made and played around with the Bootstrap that one of the contributors used. I've never used Bootstrap before then, but it seems like a very easy way to add style to your web page.&lt;/p&gt;

&lt;p&gt;I started HackerRank challenges today along with challenges from other websites. The reason for this is because I had a technical interview last week and the interviewer recommended I learn hash sets and hash maps. Little did I know that hash maps in Java are actually similar to dictionaries in Python, which I did learn in a freshman university class. The interviewer immediately lost interest in hiring me after I admitted I didn't know what hash maps and hash sets were, but he let me move on to show my code.&lt;/p&gt;

&lt;p&gt;On top of that, he recommended I take time to talk out loud about my thinking process before diving in to coding and trying things out. In school, it was never really stressed to think about the things that can go wrong. I've always just typed whatever and tested it to see if it would work, but my interviewer wasn't satisfied with my method of coding because he mentioned that it takes up company resources. I used too many loops and he said that using loops when they weren't necessary was wasteful and recommended a much easier solution to the problem he tasked me with.&lt;/p&gt;

&lt;p&gt;I've also had a technical interview online recently that I absolutely failed at because I didn't understand the questions and I was supposed to use a programming language I haven't used in about 2 years. On top of my inexperience I realized I had in both interviews, I also was very nervous with time constraints and being in front of a live human, and it made me sloppy.&lt;/p&gt;

&lt;p&gt;Because of my failure at the technical interviews, I want to sharpen my programming skills by taking on challenges online. So far, I'm working on the warm up assignments in HackerRank. Most have been easy, but one caught my attention. The "Pairs" warm-up had me looking through an array of elements and output how many pairs there are that had a given difference between the two. It sounded easy, but when I submitted my code, I realized that I failed the later test cases. The reason was because there was a time-out. Apparently, my code took too long.&lt;/p&gt;

&lt;p&gt;I looked online and realized that HackerRank times out if your code takes longer than expected. I looked further online and found that this can occur if there are too many loops, among other reasons, which is exactly something my interviewer warned me about. At that point, I thought now might be a good time to heed what my interviewer recommended and learn about hash sets and hash maps. With that fresh in my mind, I thought about how I could make my code more efficient so it doesn't time out. I decided instead of having 2 for loops, I could just put everything in the array in one HashMap and then have 1 for loop. In the for loop, I would look for the key that is equal to the difference between the current value I'm looking at and the difference value. &lt;/p&gt;

&lt;p&gt;I'm honestly shocked at how important something I learned in a freshman class came in handy for technical interviews and making my code more efficient. Because of how important this is, I will post my solution to the challenge below. Next time, I hope to discuss further any progress I've made with the Clean Exchange, any other personal projects I start, and the HackerRank challenges. I hope to find more ways to use hash maps and hash sets to make my code more efficient and to make me a more appealing candidate in interviews. I also hope to practice thinking about things before testing them out.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    HashMap&amp;lt;Integer, Integer&amp;gt; map = new HashMap&amp;lt;Integer, Integer&amp;gt;();

    for(int i = 0; i &amp;lt; arr.length; i++)
        map.merge(arr[i], 1, Integer::sum);

    int count = 0;
    for(int i = 0; i &amp;lt; arr.length; i++){
        if(map.containsKey(arr[i]-k))
            count += map.get(arr[i]-k);
    }
    return count;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Progress</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Sat, 11 May 2019 06:07:17 +0000</pubDate>
      <link>https://dev.to/kevinsarav/progress-3gmb</link>
      <guid>https://dev.to/kevinsarav/progress-3gmb</guid>
      <description>&lt;p&gt;Today, I will be discussing my progress in my calculator and group project. In summary, the calculator project is almost done. The only thing missing is a display to show what's being done and fixing the calculations for multiplying/dividing and doing continuous calculations.&lt;/p&gt;




&lt;p&gt;One major problem that occurred was when I was doing a calculation. I noticed a nullpointerexception error. That usually indicates that something wasn't instantiated properly. At first, I suspected it might have been because I was instantiating 2 ArrayLists at the same time, but then I noticed it's because I forgot to put String in between the second &amp;lt;&amp;gt;. A simple mistake like that caused me much headache searching online and trying to print stuff everywhere to find out what's wrong.&lt;/p&gt;

&lt;p&gt;Another problem that occurred was with the calculation itself. I noticed an arrayindexoutofbounds exception. This usually indicates that I'm going beyond the limit of an array. I found out it was because of how I was doing my for loops. Logically, the operation ArrayList is going to have 1 less value than the one for my inputs. However, I didn't account for that in my code, so my code was trying to pull from beyond the operation ArrayList's size when trying to pull the last element in the input ArrayList. To solve this, I made my first for loop start at 1 (the second value in input) so that I can do the operation with that and the first value. In my method, I also subtracted 1 from the for loop value so I can start at the first operation ArrayList value. This continues until the operation ArrayList ends and not after using this method.&lt;/p&gt;

&lt;p&gt;Another interesting problem was replicating the Windows calculator's behavior. For example, when you get a result that ends in .0, the calculator naturally displays an integer, but when the result is .0005, it displays that instead of the integer. If I wanted to use .contains() to see if the String has a decimal point, that doesn't solve the issue of differentiating between the two results I mentioned above. I realized that .contains() is too specific and I need something that can handle more unpredictable results. &lt;/p&gt;

&lt;p&gt;That's when I realized I could use a concept I learned in a free JavaScript programming class called regular expressions (regex). With regex, I can search in a String for a pattern of characters instead of a specific sequence of characters. The magic pattern for the calculator behavior I explained above is "[.]0*\d[1-9]+". I had to use [.] because the decimal point by itself generally means any character in regex, but I want to search for a decimal point in the String. The 0* means 0 or more 0s, so if there's no zero, 1 zero or a bunch of zeroes after the decimal point, this pattern catches that. The \d[1-9]+ means any digit from 1-9 that occurs 1 or more times after the sequence (or lack thereof) of 0s falls under the pattern. This elegant solution helps me with the unpredictability of what I needed.&lt;/p&gt;

&lt;p&gt;The group project is practically finished. The only issue is pulling data from the database into a drop-down menu. I was assigned one web page to make with HTML. It basically consisted of a text box, drop-down menus and buttons. I haven't used HTML in a long time, but the Internet proved very useful. I wasn't able to delve too much into the SQL, PHP and Apache like I originally planned, but I did learn from the code my colleagues made about them and I did make an Apache server before I knew we would be using a different technology called XAMPP. XAMPP easily installs and runs Apache and MySQL for you. I saw how the SQL codes for the project made tables for our database and the PHP codes pulled data from the tables and manipulated them.&lt;/p&gt;




&lt;p&gt;That essentially sums up my progress. Overall, very productive day. In my next post, I hope to discuss the completion of this calculator project that I've been working on for so long. I also want to go over more specifics about the group project and hopefully my next personal project. I hope to use a different language than my preferred Java next time just to increase my exposure, hopefully using the languages we've used in this group project.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Recursive Method</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Mon, 22 Apr 2019 05:23:58 +0000</pubDate>
      <link>https://dev.to/kevinsarav/recursive-method-2k9o</link>
      <guid>https://dev.to/kevinsarav/recursive-method-2k9o</guid>
      <description>&lt;p&gt;In this post, I will go over a project I just completed. It uses recursion to find out the different combinations of coins that can be done from a given number of cents. I will be going over the challenges from this project.&lt;/p&gt;

&lt;p&gt;My first stumbling stone with this project is getting the recursion to work. For some reason, every time I tried to do recursion, I end up in an infinite loop even though I tried to make sure the recursion included a decremented value. I concluded this might be because Java is pass by value and not pass by reference since I was trying to use a value taken in from outside the method. I solved this by just making an object with my class and using that instead.&lt;/p&gt;

&lt;p&gt;My next stumbling block is how to go about the program. The first logical step is to split up the coins in a way a logical person would. You would want the more valuable coins first. For example, you would choose to get 1 quarter instead of 2 dimes and 1 nickel. I made a separate method that aimed to do just that. On top of that, I used recursion for that method as well. &lt;/p&gt;

&lt;p&gt;The main stumbling block with this logic is what to do after that point. Logically, you'll want to turn nickels to pennies first, and then turn dimes to nickels, and then quarters to dimes, and so on and so on. I made a method that did just that. The method worked for everything under 25 cents, but anything greater than 25 cents caused me to get wrong amounts of combinations. I concluded this may be because of my logic on how to deal with quarters. I initially made it so that once the dimes and nickels have been turned to pennies, then I decrement the quarters by 1, add 2 dimes and 1 nickel, logically. However, my program failed to account for values bigger than the current amount of dimes. For example, if I turn 1 quarter into 2 dimes and 1 nickel, and there's 17 pennies on the side, I am forgetting the combination of having 4 dimes and 2 pennies. My logic would never bring me back to that higher dime value and instead, I'm left with smaller values for dimes and nickels.&lt;/p&gt;

&lt;p&gt;To solve this, I first added 25 pennies to the amount of pennies so that I can turn the pennies so far into dimes first, and then nickels. This way, I'm accounting for combos with the higher amount of dimes. Then I add the result of the pennies divided by 10 and then I turn pennies into the modulus of pennies so I get the remainder. Then I use the same logic for nickels and then finally decrement quarters by 1.&lt;/p&gt;

&lt;p&gt;I revisited my first stumbling block and was able to do recursion without an object for some reason. It may be because my variable names were the same, which might have confused my program. Regardless, I made the program work without objects at the end.&lt;/p&gt;




&lt;p&gt;In my next post, I hope to talk about my progress on my calculator project and advancements in my group project for my master's class. Now that the semester is ending, that group project will soon be due and I will need web development skills to succeed. I'm currently learning Angular on YouTube hoping it'll give me a head start.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Palindrome Detector Overview</title>
      <dc:creator>KevinSarav</dc:creator>
      <pubDate>Thu, 28 Mar 2019 01:50:34 +0000</pubDate>
      <link>https://dev.to/kevinsarav/palindrome-detector-overview-3daa</link>
      <guid>https://dev.to/kevinsarav/palindrome-detector-overview-3daa</guid>
      <description>&lt;p&gt;Today, I will be discussing the challenges I faced making my Palindrome Detector that I mentioned in my last post.&lt;/p&gt;

&lt;p&gt;It turns out that the professor actually wanted us to implement the concept of a stack into this project. I couldn't simply work off of one String. That didn't make things too challenging because the professor gave us the outline for a Stack class that I just had to use.&lt;/p&gt;

&lt;p&gt;One challenge I faced was trying to put a file as a parameter so I can check to make sure it can be opened first before making a new Scanner. I wanted to do this in a separate method so as to keep my main method clean. I found a post online that showed how to do it using InputStream in the method's parameter and new FileInputStream in the call, but an error message popped up. I ended up putting my file checker in my main. I'm sure there has to be some way to do it, but I couldn't find any. If you guys have any advice, I would greatly appreciate it&lt;/p&gt;

&lt;p&gt;Another challenge I faced was when I was making my reverse stack method (makeReverStack). Initially, I decided I wanted to use the forward stack as one parameter since I already have it, anyway. I popped the values from it and pushed it to the reverse stack. However, an error message kept popping up saying I was going out of bounds of an array. I noticed through extensive debugging putting prints in different places and checking the values of variables that my top variable for my forward stack is -1. &lt;/p&gt;

&lt;p&gt;I first checked to see where the error was occurring. I checked to make sure both of my stacks were filled. I found out one wasn't. I then checked to see if they had what they needed in them. They did. I checked to see how many iterations were happening with the loops. There was the appropriate amount. I checked that each had something in it. They did. Except the isFull method said otherwise (tying back into that top variable). It seems this was the result of popping. I assumed I could just use the forward stack from the parameter since it's just a separate object from the main, but it seems not. I think the Java might have made both objects (the one in my method and the one in my main) point to the same reference so that what I do in the method to the stack affects the one in my main.&lt;/p&gt;

&lt;p&gt;To solve this, I decided to avoid using the forward stack and the pop method that affects the top variable. Instead, I just repeated the same thing I did with the forward stack method (makeLetterStack), except going backwards. I used the lettersOnly String instead of using the forward stack. I believe there is a way to circumvent this issue by using the .this operator from what I discovered online, but I don't have enough experience using it and I wanted to keep things simple since the forward stack method was already using the lettersOnly String.&lt;/p&gt;

&lt;p&gt;The last big challenge I faced was trying to find out why my program was saying every line is a palindrome. I knew this error had to be occurring in my last method (printIfPali) because that's where the checking happens between both stacks and the printing occurs. I checked to see what the value of my boolean variable was. When I saw the variable was behaving as it should be, I checked my last if statement. I played around with the equal sign and found that a double equal sign made my program work fine while one equal sign made it work incorrectly. I believe this is because the = sign is supposed to be used when making something equal to something else. However, in an if statement, you should be using == to compare values.&lt;/p&gt;




&lt;p&gt;In my next post, I plan to discuss my progress on my Calculator project and discuss any new things I've learned for my side group project and for my Software Engineering final project. I want to try learning some SQL, Angular and Apache.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
