Days in Month – Java

In this post we will compute the number of hours in the specified month and year. This could be used to determine the cost for a feature if enabled every day for a specified month and year.

If one rounds up all months to have a fixed set of days, the result would not be correct. For example, a year has 12 months. Most months have a fixed set of days e.g., Jan, Mar, May, Jul, Aug, Oct, and Dec always have 31 days while Apr, Jun, Aug and Nov always have 30 days. This is not the case with Feb which on regular years it holds 28 days but on leap years it holds 29 days. Continue reading “Days in Month – Java”

DOP Underscore

If you tried accessing my post last week you were not able to do so. Sorry about that. I use WordPress and apparently it had a problem with the JetPack plugin. I started using WordPress on a different blog about a decade ago. Since then I have changed my main computer three times. It seems that each time you get a new computer some stuff is left behind. In my case I lost some connection information which prevented me from accessing the site hosting the WordPress blog and addressing it.

That said; it seems that when an issue is detected in a WordPress site that prevents a blog from functioning, the admin receives a daily message with instructions to help mitigate the problem. With the help of my son who was kind enough to retrieve credentials for this blog, I was able to mitigate the issue and get the blog up and running. Sorry about the inconvenience. Continue reading “DOP Underscore”

Interval HashMap

A couple weeks ago, during a meeting, someone mentioned an interval hashmap. I decided to check if Java had a class implementing a version of an interval hashmap. As you can imagine, it does and is called NavigableMap.

In this post I explored some of the features available in the NavigableMap interface.

If interested, I would suggest to first take a look at the Interface NavigableMap<K, V> in the Oracle Java documentation which can be found here.

After reading the Oracle documentation and some articles in GeeksforGeeks and StackOverflow I decided to start experimenting. Continue reading “Interval HashMap”

Notes on JVM Garbage Collectors

Good morning! Woke up this morning to an outside temperature of 28F. In about a week from now the morning temperatures will be a few degrees lower. This is normal in the Twin Cities of Minneapolis and St. Paul. There is always hope. In about six months the temperature will be warm enough to go outdoors in comfort. In the meantime there are always early weekend walks in the Mall of America.

Earlier today my wife and I had dentist appointments. We thought all was set so at 08:30 AM we drove to the dentist office. When we arrived we sent a text as instructed. The receptionist highlighted some issues that we were under the impression that they all had been taken care of. One thing and the other and we cancelled the appointments on the spot and drove back home. We know the dentist outside his practice. My wife will be contacting him to clear the misunderstanding. Continue reading “Notes on JVM Garbage Collectors”

Java Date and Time

It is a sunny day in the Twin Cities of Minneapolis and St. Paul.

Earlier today I read an article on Medium that described how bad are the crypto currencies and which actors are making money of it. I missed to bookmark the article. While writing this post, in an attempt to locate the article, I did a Google search using the following string: “medium crypto currency”. It returned several articles. I did not spend the time looking for it. That said; if you are investing on crypto currencies, perhaps it would be a good idea to read some of the articles that have reasons why you should stop doing so. That said, I have invested a few dollars on crypto currencies. My reasoning was to better understand what Bitcoin, among other crypto currencies is all about.

Today is the birthday of the wife of one of my wife brothers. We are invited later this afternoon. Hopefully the weather will hold. It is nice to attend a BBQ on a sunny day.

Today and for a few more days, I will attempt to solve some problems in HackerRank. In the past couple years I have concentrated on solving problems from LeetCode. Continue reading “Java Date and Time”

Design HashMap – 4 of 4

Today is the last Wednesday of 2020. New year 2021 will be here this Friday. My best wishes for the New Year. It seems that most of us will be receiving the COVID-19 vaccine in 2021 so we should be able to reach worldwide heard immunity. We need to learn and understand how the pandemic started and make sure we do not allow this to repeat. Millions human beings have died due to COVID-19 and the economies of the world have been severely impacted. Let’s make sure we work together to make it happen. Continue reading “Design HashMap – 4 of 4”

Design HashMap – Third approach

Good day and hopefully you had a nice long weekend.

It seems that COVID-19 vaccines have been inoculated to about two million people in the USA. Apparently the vaccine is being well received by recipients. The issue at this point seems to be able to determine the efficacy against different virus mutations and how long our bodies will maintain resistance to it. In my humble opinion these two factors will take time to determine and must be backed up the actual (non edited) and unbiased data.

My sister sent me a link to the article “History isn’t just for patriots” by Daniel Immerwahr published by The Washington Post. I enjoy reading (mostly computer science related books, papers and articles) but also enjoy reading different subjects in order to understand the world which is inhabited by humans. In general we are extremely complex and hard to understand.

Reading the article I detected a taste of political bias. If you are interested I encourage you to read the article and form your own opinion.

At some point the author makes a comparison between history and geometry, in specific to the Pythagorean Theorem. I asked my wife when was the last time she recalls using it, if any, and for what purpose. She had no recollection of ever using it outside the geometry class while attending middle school. On the other hand, I use it often due that I design and develop software and have interest in algorithms and data structures among other computer science subjects.

On the other hand, we both have read several history books from different countries and at different times. To me unbiased history, which is very hard to find, provides facts that we can process and formulate an idea of what had happened in a certain part of the world during a specific period in time. With that information I hope to be able to better understand opinions from others. It is a fact that the winners write history.

Now a day we have a different type of influence. It comes in different forms and sources. For example I read the article in question that was published by The Washington Post and was sent to me by my sister who currently is living and teaching in China. After understanding the sources I need to read the article in an unbiased manner attempting to understand the set of points the author is providing and to understand the logic behind them. I have made my opinion and hopefully if you have a chance to read the article, you will also be able to generate your own educated opinion. Continue reading “Design HashMap – Third approach”

Design HashMap – Second approach

Today is Christmas Eve Day 2020 and we woke up with -3 F. In addition snow and wind started yesterday afternoon. Looks like a perfect day to stay in and roast a turkey.

As a matter of fact, my wife and I prepared the turkey early this morning and put it in the oven. The raw turkey came in at 24 lbs. It had giblets and a bag of liquid for basting. We disposed of those items. Next time we roast a turkey will get a smaller one (about 11 lbs.) and from a different brand (not Jennie-O). The breast of this turkey is not in proportion to the weight. Will see how the sandwiches on ciabatta bread turned out later this afternoon. Continue reading “Design HashMap – Second approach”

Design HashMap

It seems like I lost track of time this week. It is early morning on Wednesday December 23, 2020 and the weather forecast calls for 8 inches of fresh snow and a low of -1 F. This would be the first time this season that we experience subzero temperatures in the city where I live.

We always should look at the positive side of things. With the snow less people will be out and about which is good for restraining new COVID-19 infections. In addition, the days are starting to get longer. We will not be able to notice it for a few weeks, but it is happening.

I brought in from the refrigerator we keep in the garage, a 24 lbs. turkey, which we will roast tomorrow morning and will consume it mostly as sandwiches. Given that it will be my wife and I consuming this bird, it will last for several weeks. We will freeze most of it and consume it as needed. Continue reading “Design HashMap”

Java Functional Programming – 2 of n

Today I woke up a little earlier than usual. I have my alarm set for 06:00 AM, but I was up around 04:45 AM. Read for a while, prepared breakfast and woke up my wife. After breakfast showered and was in my home office by 06:00 AM. I typically work in 2-hour blocks. Break for about 15 minutes and then repeat. For lunch I break for about an hour depending if I need to help my wife with lunch. Typically I help grilling on the deck, but the temperature has dropped and there is snow so I think there will be no more outdoor cooking until next spring.

I have a lot of things planned for the workday. Hopefully I will be able to get most of them done by 06:00 PM. Continue reading “Java Functional Programming – 2 of n”