## Friday, 28 August 2020

### How To Switch To HTML Editor In Google Blogger

Blogger visual editor settings is now on the left hand side just under "Title" section. I had a bit of trouble changing from compose view to HTML view. It could have been a bit more prominent as people do toggle between normal blog composer view & HTML editor view. Anyways, please take a look at the screenshot below.

## Thursday, 27 August 2020

### Identify A Song Name By Its Tune

Sometimes you just stumble into some particular tune while surfing. Maybe somebody has used a particular music piece or song as a background sound for a video. And you want to listen to that whole song or music. But you don't know the name of it. In that case, https://www.watzatsong.com/en can help you. You just upload the tune, maybe be as short as few seconds or a minute. They have a good user community. Some of them will listen to the tune & they will reply back with the name if they know. And it generally doesn't take long, maybe few hours or a day to get a reply back. There are other quicker ways to find a song name from the tune. But if you are stuck, it can be a good option. I used it several years back. I just happened to open it today. Their community looks as good as it was back then.

## Saturday, 22 August 2020

### What Is The RSS Feed URL Of A Blogger Blog

Blogspot blogs do have a RSS feed url by default & you don't need to use FeedBurner type of feed management tool to create a new one. Previously Blogger blog used to have only atom feed. That format still exists. But Google Blogger also introduced RSS feed format that is readily available.
Just replace domain with your blogspot or custom domain name below & you will have your RSS feed.

## Friday, 21 August 2020

### How To Find Recurring Sequence In A Fraction

Suppose we have a decimal number. We need to check if the fraction part contains any non-ending repeating sequence or it ends normally.
Let's take an example. Numerator is 5 and denominator is 33.
5 / 33 = 0
5 % 33 = 5

So we need to get the fraction part.
5 * 10 = 50
50 / 33 = 1
Now we have 0.1

50 % 33 = 17
17 * 10 = 170
170 / 33 = 5
So now we have 0.15

170 % 33 = 5
5 * 10 = 50
But we have already done 50 / 33. So if you just think through, we have come back to a previous state where numerator & denominator are same. So we know if we do state transition, we will come back to this state again.
So this is the starting point of the recurring pattern which will continuously go on & never end. So our answer is (15).
Hope it helps in understanding the concept.

## Wednesday, 19 August 2020

### What is The Purpose Of Dash Inside Curly Braces In Helm Template

Helm's template internally uses Golang template language. In Go template, dash is used in curly braces to skip white-space around it.

Let's take an example. Suppose {{\$test}} evaluates to "ok".

1

{{\$test}}

2

will be rendered as

1

ok

2

1

{{- \$test}}

2

will be rendered as

1ok

2

1

{{\$test -}}

2

will be rendered as

1

ok2

1

{{- \$test -}}

2

will be rendered as

1ok2

## Sunday, 9 August 2020

### Solve "You haven't verified any sites." Error While Linking Google Analytics With Search Console

You already have a web property in Google Search Console. Now you try to link Google Analytics with that. But you are getting error "You haven't verified any sites.". Most likely the problem is that you have created a Domain Property in Google Search Console. And that is not currently supported to link to Google Analytics. You need to create a URL prefix property for your website & then link it to Analytics. You can keep existing Domain property as it is. There is no harm & you might use the extra data from Domain property in future. But if you want to clean up, you can check this post on how to delete a property from Search Console.

### How To Remove A Property From Google Search Console

To remove a Domain property or URL prefix property from Google Search Console, first select the property from admin panel. Then in left hand side menu, select "Settings" option. Click on that & you will see the option as shown in the screenshot below.

### How Many Images Can Be Uploaded In A Blogger Blog

Is there a limit on the number of images that you can upload & display in your Blogger blog? And also does Blogger has image storage limit? As of now, you can upload any number of images in your blogspot blog as long as the image size doesn't go beyond 2048 pixels in height or width. If the image exceeds the above criteria, then Google will store it as part of Google account storage. Generally you have 15GB of free space in your Google storage which is used by Gmail, Google Drive & Google Photos. So it will eat up space from there.
But 2048 pixel is a pretty good limit for a normal image. So you can keep on uploading thousands of images without a headache of running out of space. It is unlimited. Here is the link from Google support on that.

## Saturday, 8 August 2020

### Add Label To Existing Blogger Post

If you want to add a new label to your existing Blogger blog post, just check screenshot below. You need to go to Posts section of Blogger admin panel. And hover your mouse on the right side of the post you want to add a label to.

### Difference Between Linux Exec And Docker Exec Commands

This post is all about Linux exec vs Docker exec.

Let's take two examples. First, we will talk about what happens when you run "exec ls" in Linux terminal. In Linux, exec command is used to replace the current shell process with the command after exec, here it is "ls". If you run only "ls" command, shell process will start a new process & run "ls" program in it. Now the control is transferred to that process. When "ls" command is executed & list of files/directories have been displayed, control will return back to the shell process. But if you run "exec ls" command, "ls" program will take over the current process where shell program was running. So when "ls" command is executed, then there is no shell program to return to. And terminal will disappear. This is not a good use case for Linux exec command. But it clearly explains how it works.

So what about docker exec command? It has a different purpose. It basically starts a new process in a running Docker container & executes the command mentioned after it. If you execute "docker exec -it <container_name> /bin/bash" command, it will create a new process inside the running container & start a bash program in it. By the way, "-it" flag is used to create an interactive shell. Otherwise you bash will start & stop immediately as it is not interactive.

So I hope there is no more confusion regarding Linux exec & Docker exec commands.

## Friday, 7 August 2020

### Code Commit From Windows Eclipse Shows Whole File Changed in Git

You might face this issue if you are coding in Windows Eclipse. And you check in code from there while most in your team use Linux or Mac. Now you commit few lines in Git from Eclipse & your team mates are seeing you have changed the whole file. This is a classic End Of Line format issue. When you press Enter to go to next line, Windows generally adds Carriage Return character & one Line feed character. But Linux or MacOS will only add a Line Feed character. Because of this new line separator issue, Git will show that whole file has been changed instead of the few lines that you actually changed.

So how do you solve this whitespace issue in Windows Eclipse? You need to change new line text delimiter option & set it to Unix format. Just check the screenshot. At bottom right, you can see that I have set it to Unix. And that will fix the issue. This is a good way to solve the issue without tempering default value of "core.autocrlf" feature in Git.

## Saturday, 1 August 2020

### Direct Conversion From Any Number Base To Another Base Explained

Let's consider that we need to convert a base 4 number to base 8 number.
Base 4 digits: 0 1 2 3
Base 8 digits: 0 1 2 3 4 5 6 7
We should build a chart to map all digits in base 8 to its equivalent number in base 4. That will come in handy.
So how do we do that? Looks like we need to do conversion from base 8 to base 4 first.
So here are the steps to follow:
1. Divide the number to be converted (base 8) by the value of other base (4).
2. Get the remainder. That is the least significant digit.
3. Divide the quotient with the same value (4).
4. Add the remainder as next least significant digit.
Keep doing steps 3 & 4 repeatedly till quotient becomes zero.  Now let's understand it with the example.
We need to convert 4, 5, 6, 7 to its equivalent base 4 number.

For 4:
4 % 4 = 0, 4 / 4 = 1,
1 % 4 = 1, 1 / 4 = 0
So base 4 equivalent of 4 (base 8) is 10

For 5:
5 % 4 = 1, 5 / 4 = 1
1 % 4 = 1, 1 / 4 = 0
So base 4 equivalent of 5 (base 8) is 11

For 6:
6 % 4 = 2, 6 / 4 = 1
1 % 4 = 1, 1 / 4 = 0
So base 4 equivalent of 6 (base 8) is 12

For 7:
7 % 4 = 3, 7 / 4 = 1
1 % 4 = 1, 1 / 4 = 0
So base 4 equivalent of 7 (base 8) is 13

Actually now you have learnt how to directly convert upper base numbers (base 8) to lower base numbers (base 4).
So what's the difference when we convert lower base (base 4) numbers to upper base (base 8)?
Just to remind, we were doing arithmetic operations in base 8 number system. As all digits of base 4 are already present in base 8 number system, we didn't have to do any extra step.
To convert from base 4 to base 8, we will be doing operations in base 4 number system. We need to divide the base 4 number by 8 which is the value of base we are converting to. But 8 is not present in base 4 system. And possible remainders can be 4, 5, 6, 7. So we need to find equivalent values for these numbers in base 4 system.
For 4, 5, 6, 7 we have already done that above.

Let's find equivalent of 8 (base 10) in base 4 system.
8 % 4 = 0, 8 / 4 = 2,
2 % 4 = 2, 2 / 4 = 0
So base 4 equivalent of number 8 (base 10) is 20.

Now we will convert 3211 in base 4 to its equivalent in base 8. Here is the hard part. We need to do the calculation in base 4 system.

Multiplication table:
1 * 20 = 20
2 * 20 = 20 + 20 = 100
3 * 20 = 100 + 20 = 120

__130__________
20 | 3211
20______
121
120______
11

quotient: 130
remainder: 11 (base 8 equivalent is 5)

__3______________
20 | 130
120_____
10

quotient: 3
remainder: 10 (base 8 equivalent is 4)

__0________
20 | 3

quotient: 0
remainder: 3

So in the end we are left with 345. So 3211 in base 4 has been converted to 345 in base 8.

Do note that when we did base 8 to base 4 conversion above, I didn't create multiplication table. That was because I didn't want to confuse you in the beginning. It was handled implicitly as we were converting to higher base & that base was less than 10. But we were actually doing  arithmetic in base 8 system. So whenever you are doing direct conversion from one number base to another, make sure you have created the proper multiplication table first.

### Difference Between Voluntary And Involuntary Context Switches

So I assume that you know what context switching is. Suppose you are running an OS in a dual core processor. And at some point, your application is running four threads. Operating system kernel needs to divide the CPU time among them. You are running four threads in two cores after all. This is the job of process scheduler which runs as a function in kernel. When invoked, it will look into a queue & select next thread which will get CPU time. This switching between threads can happen in two ways.
A thread can give up control of CPU as it will generally wait on I/O, user input. Or it might be sleeping. So another thread can be selected to start running on the same CPU core. This is called voluntary context switch.
But sometimes the thread is doing some CPU intensive task & runs out of CPU time scheduled for it. Then process scheduler will take the thread out & add it back to the queue. It will then put next thread on the CPU. This is called involuntary context switch.
Hope this clarifies the difference in simple terms. I might write some more on involuntary context switches later.

### Solve Google Chrome Sound Issue In Windows

Just last week I solved this problem. In my Windows 10 laptop sound was fine. I was able to hear people in video chat. Even Microsoft Edge which is built-in browser for Windows was also working fine. But I was not getting any sound from Google Chrome. There can be various issues. But if there is no sound only in Chrome, then just check the below steps.

What happened in my case was that Chrome sound settings got disabled in Volume Mixer. So you need to right click on speaker icon on the task bar & then open Volume Mixer from the menu. There you should check if Google Chrome volume button is muted or not.

### Java Program To Solve Maximum Size Rectangle In Binary Matrix

Given a binary matrix, find max rectangle with all 1's. A : [ 1 1 1 0 0 1 1 0 1 1 1 0 ] Output : 6 Dynamic programmi...