Kiran Kumar Panigrahi has Published 425 Articles

How to handle signals in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 07:21:04

1K+ Views

Before discussing signals and how to handle them, let's talk about a common scenario of creating a signal. A signal can be passed from the terminal, by either terminating the program with the help of CTRL+C or we can by default call the Exit() function that the os package provides ... Read More

How to use Timeouts in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 07:16:42

3K+ Views

Timeouts play an important role when we don't want to wait for the output for some goroutines that are taking more time than what they should take. It should be noted that Go directly doesn't support timeouts, but we can implement them without any difficulty.Let's suppose we have a case ... Read More

Empty Slice vs. Nil Slice in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 07:10:52

918 Views

In this article, we will see the differences and similarities that are there between a slice that is declared as an empty and a nil slice.Slices in Golang are used to store a sequence of elements. Slices can be expanded at any time and they are declared in the same ... Read More

Functions vs Methods in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 07:08:11

5K+ Views

In this article, we will learn what similarities and differences are there between functions and methods in Golang. We will start with each of them separately, and then we will see an example where both of them will be used.Let's start with functions and see what they are and how ... Read More

Channel synchronization in Golang

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:51:24

1K+ Views

We can make use of channels if we want to synchronize goroutines. By synchronizing, we want to make the goroutines work in a defined manner, for example, not starting the next goroutine until the previous one has finished its execution.The channels help in achieving that, as they can be used ... Read More

How to get the Response status code in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:47:20

12K+ Views

Response status codes are the numbers that we get in response that signify what type of response we received from the server when we asked for something from it.There are different status codes that one gets from the response, and these are mainly divided into five categories.Generally, the status codes ... Read More

How to detect the content type of a file in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:39:05

6K+ Views

Consider a case where we want to get the content type of a file in Golang for whatever reasons. In order to do that, we must first know how to open the file and read some of its bytes into a buffer slice which we will then pass to a ... Read More

How to decode JSON into objects in Golang?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 01-Nov-2021 06:30:03

1K+ Views

Suppose we have a JSON that looks like this.{ "name":"Mukul Latiyan", "age":10, "sports":[ "football", "tennis", "cricket" ] }Now, we want ... Read More

How to insert a temporary text in a tkinter Entry widget?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:43:03

20K+ Views

To insert a temporary text in a tkinter Entry widget, we will bind the event with the Entry widget and call a user-defined function to delete the text inside the Entry widget.Steps −Import the tkinter library and create an instance of tkinter frame.Set the size of the frame using ... Read More

How to update a Button widget in Tkinter?

Kiran Kumar Panigrahi

Kiran Kumar Panigrahi

Updated on 26-Oct-2021 14:39:35

2K+ Views

We can update a Button widget in Tkinter in various ways, for example, we can change its size, change its background color, or remove its border, etc. In the following example, we will create three Button widgets and each of the buttons, upon clicking, will call a different function to ... Read More

Advertisements