JUnit Example


UPDATE – I received a separate email message from a fellow software developer. He is interested in providing a text file and creating a new test method to process it. The idea is to provide a text file with the number of triangles to test followed by the triangle sides and associated type so we would be able to test them all at once. This new test was NOT part of the initial HackerRank challenge.

UPDATE – I received an email message from a fellow software developer. Went back (about three years) and located the code for this post in one of my older work-spaces. I updated the format of the post so it is easier to follow. I also added the code to my GitHub repository (see below).

:::: :::: :::: :::: ::::

After the post on unit testing I received a request to produce and explain sample code using JUnit. This is what I came up after searching the web using Google. I decided to use Eclipse for this example. Continue reading “JUnit Example”


canakitIt’s a gloomy Sunday morning in the Twin Cities of Minneapolis and St. Paul. I believe it will stop raining mid morning. Have a three hour on-line class to attend at 10:00 AM CDT. While I wait for the start of the class I decided to check out my CanaKit™ Raspberry Pi B+ Ultimate Starter Kit (Black Case) RSP-BP-C2-BLK which I purchase from Amazon.com about a year ago (have been experimenting with Arduino). I have noticed that the price of the kit has almost doubled since I purchased mine. Continue reading “CanaKit”

Raspberry Pi

computer_class_childrenFor decades I have been interested in education at all levels and for all ages.  Some time ago my oldest got a Raspberry Pi (from now on Pi for short) kit and worked on a couple projects. Lately my youngest (I have two sons) purchased a Pi to experiment with Linux. As far as I can remember I have been experimenting with different hardware for different applications. My parents promoted such type of learning and I have carried on with my sons and hopefully will continue with new and future generations. This set of blog entries are aimed at describing my steps experimenting, learning and having fun with the Pi. Continue reading “Raspberry Pi”

Unit Testing

apple_pieI will provide additional details on this question towards the end of this blog entry. That said; write a piece of code that would perform the following task:

Using a counter from 0 to 50 print the word “Apple” when the counter is divisible by 3. Print the word “Pie” when the counter is divisible by 7. Print the words “Apple Pie” when the counter is divisible by 3 and 7. Continue reading “Unit Testing”

Design Patterns

never_memorize_quoteA couple days ago I was involved in a conversation regarding the use of references (i.e., books, Internet, magazines, etc) when looking for approaches to solve technical issues that architects, designers, and developers may face on their day to day operations. It seems like some people have the idea that using a reference to refresh a known concept that, due to lack of use, needs some dusting, indicates lack of ability and knowledge. It all depends on how references are used and what is the individual looking for. Continue reading “Design Patterns”

No Prefix Set

weekend_on_line_classAs I have mentioned in a previous blog I am currently taking a weekend on-line course on Spring Framework. Last Wednesday my computer received a Windows update labeled “Cumulative Update for Windows 10 Version 1511 for x64-based Systems (KB3185614)”. For some reason the update failed to install on Thursday. After rebooting my machine the installation process continued. A few minutes later it indicated a failure and the system was being restored. The entire process took over one hour. Continue reading “No Prefix Set”

Contacts without a Trie

trie_diagramThis entry touches on the use of a Trie to look up complete or partial words from a specified set. In general Tries are typically used to look up completion words for a prefix (perhaps there are simpler and faster ways to implement such task). To learn more about the challenge please take a look at the following link: https://www.hackerrank.com/challenges/contacts.

Before we get into the code, I have copied and annotated part of the text from the following link: Continue reading “Contacts without a Trie”

Contacts with Trie

trieHave been somewhat busy in the past couple weeks. To add to it, last weekend I started an on-line “Spring” course. Classes run for three hours Saturdays and Sundays for one month. Need to get the assignments done in the next couple days.

A couple weeks ago I was talking with a manager about prefix searches. At the time I mentioned that I always take a quick look on the Internet to get a general idea on what to do. I did so and Tries came up as an initial candidate. I wrote a blog about it. I tend to be quite passionate with my work and computer science in general. I went and spent some time solving a challenge All Domains -> Data Structures- > Trie -> Contacts on HackerRank (https://www.hackerrank.com/challenges/contacts). Continue reading “Contacts with Trie”


trie_diagramYesterday evening I was talking with a software manager about an algorithm to autocomplete words. The idea was to build a data structure that could help (hint) users with the available words that would match what has been entered so far. For example, if someone would be looking for my phone number in a company directory application and would have entered “can” then the autocomplete feature could display “cane” and “canessa”. Continue reading “Autocomplete”

Binary Heap or Priority Queue

binary_heapIt is a beautiful Sunday morning in Minneapolis, MN part of a long Labor Day weekend. Spent some time in the past couple days working on solving a HackerRank problem named QHEAP1. I want to discuss my approach and the reason I solved the problem twice. No, it was not get double points solving the same problem. I do not believe you can do that. Once a problem is solved it is flagged.

I always tend to refresh my knowledge (in this case) or learn about a new topic in order to better understand it before attempting to design a solution. You would be surprised how many people just looks for a solution on-line and never understand what they did or the ramifications if it is not just a standalone problem (i.e., HackerRank) but it is part of an application or system. Continue reading “Binary Heap or Priority Queue”