Trending November 2023 # Complete Guide To Docker Registry With Examples # Suggested December 2023 # Top 11 Popular

You are reading the article Complete Guide To Docker Registry With Examples updated in November 2023 on the website Hatcungthantuong.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested December 2023 Complete Guide To Docker Registry With Examples

Introduction to Docker Registry

Docker Registry is used to store Docker images i.e. read-only template. In other words, the Docker registry stores Docker repositories that hold Docker images in different tagged versions. It is an open-source, stateless, and highly scalable server-side application. It allows us to control where we want to store our Docker images, we fully own our image distribution pipeline and integrate it with in-house development workflow. Docker registry is only compatible with the Docker engine version 1.6.0 or higher. We can use default storage driver i.e. POSIX file system for development or small deployments however it is recommended to use supported cloud-based storage drivers like S3, Microsoft Azure, Openstack Swift, etc.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

How does Registry work in Docker?

We can run our own registry to integrate with our CI/CD pipeline. So, if there is any commit to source code, the SCM tool would trigger a build on our CI system and if the build is successful, it would push the new image to our registry. The Registry then sends the notification that would trigger a deployment on a staging environment. We can quickly deploy a new image over a large cluster of machines using the CI/CD model. We can share Docker images inside an isolated network using the Docker registry. It supports TLS and basic authentication for securing access to our hosted images.

We can a run private registry as a container using the below command:

Code:

$docker push localhost:5000/alpine

In the above example, we have started a registry container named ‘my-registry’ using ‘registry:2’ Docker image and it is listening on port 5000 and restart option is set to ‘always’ so if container stopped in any case, docker daemon will start it automatically.

Code:

$docker pull ubuntu

Output:

And when we try to push the ‘alpine’ Docker Image the same thing happens. Docker daemon automatically adds ‘docker.io/library/’ to the image and tries to push it to official Docker Hub however it requires authentication to push the image to official Docker Hub. We can create our Docker ID and push the Docker image to our Docker ID however we again re-tag the Docker Image with our Docker ID and Docker image name.

Code:

$docker push alpine

Output:

Code:

$docker push sarab303/alpine

Output:

We can pass additional options or modified options to change the basic configuration of the registry. For example, changing the default listening port, customize storage location, implement TLS for securing the registry, etc.

Let’s assume that we already have an application listening on port 5000 and we want to expose the registry on port 5003, we can do that as below:

Code:

$docker push localhost:5003/alpine

Output:

If we want to use different port other than default port on which registry listens within the container, we can change that as well by using environment variable REGISTRY_HTTP_ADDR as shown in the below command:

Code:

registry:2

Output:

We can customize the storage location to store the respositories of the registry persistently, we can accomplish this by mounting host location or volume to the container. Here, we run the registry container as below to bind mount the host directory ‘/mnt/registry’ into the registry container at ‘/var/lib/registry/’.

Code:

$docker pull localhost:5000/alpine

Output:

In the above example, started a new local registry named ‘my-registry’ and tagged the ‘alpine’ Docker image to ‘localhost:5000/alpine’ and pushed it to the local registry, then stopped the registry container and deleted it. Also removed locally available ‘alpine’ and ‘localhost:5000/alpine’ Docker images from the host. Now, again started a new registry container and mounted the same host directory to this container and tried to pull the earlier pushed Docker image i.e. ‘localhost:5000/alpine’ and it is successful.

However, the above implementation is only for testing purposes as there is no authentication mechanism is implemented. Let’s implement basic authentication for our private registry by generating an ‘htpasswd’ file and self-signed certificates using below commands.

Code:

-x509 -days 365 -out certs/domain.crt

In the above example, we have created a directory called ‘auth’ and ‘certs’ to store the htpasswd credentials and self signed certificates respectively. First, we have created the user ‘user1’ with the password ‘[email protected]’ and stored it in the ‘htpasswd’ file under ‘auth’ folder, then generated self signed certificates using openssl and stored the ‘domain.key’ and ‘domain.crt’ files in the ‘certs’ folder keeping all details blank except the common name of the server.

Now, we create a new container with additional options and mounting the certs and auth folders to it.

Code:

Output:

Code:

$docker push localhost:443/nginx

Output:

In the above snapshot, tagged the ‘nginx’ Docker image to ‘localhost:443/nginx’ and tried to push to the newly setup private registry however we can see that it is giving error that says ‘no basic auth credentials’. Logged into the private registry using the credentials of ‘user1’ and the image has been pushed to the private registry successfully.

Conclusion

Docker Registry is a great solution for hosting on-pre private registry, however, there are alternatives available for Docker Registry like Docker Hub which is free to use, hosted registry by Docker, need to pay for additional features though, and DTR i.e. Docker Trusted Registry is a commercially supported version of the registry, comes with Docker Enterprise Edition.

Recommended Articles

This is a guide to Docker Registry. Here we discuss the introduction to Docker Registry along with how registry work. You may also have a look at the following articles to learn more –

You're reading Complete Guide To Docker Registry With Examples

Excel Sparklines – A Complete Guide With Examples

Sparklines feature was introduced in Excel 2010.

In this article, you’ll learn all about Excel Sparklines and see some useful examples of it.

Sparklines are tiny charts that reside in a cell in Excel. These charts are used to show a trend over time or the variation in the dataset.

You can use these sparklines to make your bland data look better by adding this layer of visual analysis.

While Sparklines are tiny charts, they have limited functionality (as compared with regular charts in Excel). Despite that, Sparklines are great as you can create these easy to show a trend (and even outliers/high-low points) and make your reports and dashboard more reader-friendly.

Unlike regular charts, Sparklines are not objects. These reside in a cell as the background of that cell.

In Excel, there are three types of sparklines:

Line

Column

Win-loss

In the below image, I have created an example of all these three types of sparklines.

The first one in G2 is a line type sparkline, in G3 is a column type and in G4 is the win-loss type.

Here are a few important things to know about Excel Sparklines:

Sparklines are dynamic and are dependent on the underlying dataset. When the underlying dataset changes, the sparkline would automatically update. This makes it a useful tool to use when creating Excel dashboards.

Sparklines size is dependent on the size of the cell. If you change the cell height or width, the sparkline would adjust accordingly.

While you have sparkline in a cell, you can also enter a text in it.

You can customize these sparklines – such as change the color, add an axis, highlight maximum/minimum data points, etc. We will see how to do this for each sparkline type later in this tutorial.

Note: A Win-loss sparkline is just like a column sparkline, but it doesn’t show the magnitude of the value. It is better used in situations where the outcome is binary, such as Yes/No, True/False, Head/Tail, 1/-1, etc. For example, if you’re plotting whether it rained in the past 7 days or not, you can plot a win-loss with 1 for days when it rained and -1 for days when it didn’t. In this tutorial, everything covered for column sparklines can also be applied to the win-loss sparklines.

Now let’s cover each of these types of sparklines and all the customizations you can do with it.

Let’s say that you want to insert a line sparkline (as shown below).

Here are the steps to insert a line sparkline in Excel:

Select the cell in which you want the sparkline.

In the ‘Create Sparklines’ dialog box, select the data range (A2:F2 in this example).

This will insert a line sparkline in cell G2.

To insert a ‘Column’ or ‘Win-loss’ sparkline, you need to follow the same above steps, and select Columns or Win-loss instead of the Line (in step 3).

While the above steps insert a basic sparkline in the cell, you can do some customization to make it better.

When you select a cell that has a Sparkline, you’ll notice that a contextual tab – Sparkline Tools Design – becomes available. In this contextual tab, you’ll find all the customization option for the selected sparkline type.

Edit Group Location & Data: Use this when you have grouped multiple sparklines and you want to change the data for the entire group (grouping is covered later in this tutorial).

Edit Single Sparkline’s Data: Use this to change the data for the selected sparkline only.

When you create a line sparkline with a dataset that has an empty cell, you will notice that the sparkline shows a gap for that empty cell.

In the above dataset, the value for April is missing which creates a gap in the first sparkline.

Here is an example where there is a missing data point in a column sparkline.

You can specify how you want these empty cells to be treated.

Here are the steps:

In the drop-down, select ‘Hidden & Empty Cells’ option.

In the dialog box that opens, select whether you want to show

Empty cells as gaps

Empty cells as zero

Connect the before and after data points with a line [this option is available for line sparklines only].

In case the data for the sparkline is in cells that are hidden, you can check the ‘Show data in hidden rows and columns’ to make sure the data form these cells is also plotted. If you don’t do this, data from hidden cells will be ignored.

Below is an example of all three options for a line sparkline:

Cell G2 is what happens when you choose to show a gap in the sparkline.

Cell G3 is what happens when you choose to show a zero instead.

Cell G2 is what happens when you choose to show a continuous line by connecting the data points.

You can do the same with column and win-loss sparklines as well (not the connecting data point option).

If you want to quickly change the sparkline type – from line to column or vice versa, you can do that using the following steps:

In the Type group, select the sparkline you want.

While a simple sparkline shows the trend over time, you can also use some markers and highlights to make it more meaningful.

For example, you can highlight the maximum and the minimum data points, first and the last data point, as well as all the negative data points.

Below is an example where I have highlighted the maximum and minimum data points in a line and column sparkline.

These options are available in the Sparkline Tools tab (in the show group).

Here are the different options available:

High/Low Point: You can use any one or both of these to highlight the maximum and/or the minimum data point.

First/Last Point: You can use any one or both of these to highlight the first and/or the last data point.

Negative Points: In case you have negative data points, you can use this option to highlight all of these at once.

Markers: This option is available only for line sparklines. It will highlight all the data points with a marker. You can change the color of the marker using the ‘Marker Color’ option.

You can change the way sparklines look using the style and color options.

It allows you to change the sparkline color (of lines or columns) as well as the markers.

Pro Tip: If you’re are using markers to highlight certain data points, it’s a good idea to choose a line color that is light in color and marker that is bright and dark (red works great in most cases).

When you create a sparkline, in its default form, it shows the lowest data point at the bottom and all the other data points are relative to it.

In some cases, you may not want this to be the case as it seems to show a huge variation.

In the below example, the variation is only 5 points (where the entire data set is between 95 and 100). But since the axis starts from the lowest point (which is 95), the variation looks huge.

This difference is a lot more prominent in a column sparkline:

In the above column sparkline, it may look like the Jan value is close to 0.

To adjust this, you can change the axis in the sparklines (make it start at a specific value).

Here is how to do this:

Select the cell with the sparkline(s).

In the drop-down, select Custom Value (in the Vertical Axis Minimum Value Options).

In the Sparkline Vertical Axis Settings dialog box, enter the value as 0.

This will give you the result as shown below.

By setting the customs value at 0, we have forced the sparkline to start at 0. This gives a true representation of the variation.

Note: In case you have negative numbers in your data set, it’s best to not set the axis. For example, if you set the axis to 0, the negative numbers would not be shown in the sparkline (as it begins from 0).

You can also make the axis visible by selecting the Show Axis option. This is useful only when you have numbers that cross the axis. For example, if you have the axis set at 0 and have both positive and negative numbers, then the axis would be visible.

If you have a number of sparklines in your report or dashboard, you can group some of these together. Doing this makes it easy to make changes to the whole group instead of doing it one by one.

To group Sparklines:

Select the ones that you want to group.

Now when you select any of the Sparkline that has been grouped, it will automatically select all the ones in that group.

You can ungroup these sparklines by using the Ungroup Option.

You can not delete a sparkline by selecting the cell and hitting the delete key.

To delete a sparkline, follow the steps below:

Select the cell that has the sparkline that you want to delete.

You May Also Like the Following Excel Tutorials:

How To Use $ In R: A Complete Guide (With 6 Examples)

To efficiently deal with dataframes and lists in R, you need to be able to access the columns or values in an easy and readable way. This is where you can use the dollar sign operator ($). This operator retrieves the value or column by a name after which you can easily read, modify, or remove the accessed objects.

This is a comprehensive guide to using the dollar sign operator $ in R. You will learn what the $ operator does and what are its main use cases for both lists and dataframes.

What Is $ in R?

In R, one of the fundamental operators is the dollar sign operator ($). With the $ operator, you can access a specific part of data. The most notable use cases for the $ operator are related to lists and dataframes:

With lists, you can use the $ operator to access a particular variable of the list.

With dataframes, you can use the $ operator to access a specific column.

The $ operator in R gives you easy access to a subset of data. This makes it easy to access, modify, and remove parts of your data.

Let’s take a look at the most common use cases and examples for the $ operator.

6 Use Cases for $ in R

The main use cases for the $ in R are associated with lists and dataframes. This section is split into two parts:

Using the $ operator with lists

Select a variable from a list

Add a new variable to a list

Select a variable with white spaces

Using the $ operator with dataframes

Select a column in a dataframe

Add a new column to a dataframe

Remove a column from a dataframe

Let’s jump into it!

Using $ on Lists

Lists are a common data type in R. You can use the $ operator to access, modify, and remove list values.

1. Select a Variable on a List

The most basic usage of the $ operator in R is to access a variable in a list. To do this, add a $ after the list name and specify the variable name you’re interested in.

list$Variable

For example, given a list of names associated with ages, let’s access the age of “Bob”:

ages <- list('Alice'=30, 'Bob'=25) ages$Bob

Output:

[1] 25 2. Add New Variable to a List

In the previous section, you learned how to access a variable in a list using the $ operator.

Adding a new variable to a list happens in a similar fashion. But instead of accessing a variable, you need to specify the name of the new variable after the dollar sign.

For example, let’s add a new variable Charlie=32 to the list of names and ages:

ages <- list('Alice'=30, 'Bob'=25) ages$Charlie <- 32 ages

Output:

$Alice [1] 30 $Bob [1] 25 $Charlie [1] 32

Now there are three names each associated with age in the list.

Notice that you can also update an existing value in a list with the $ operator.

For example, let’s update the age of “Alice”:

ages <- list('Alice'=30, 'Bob'=25) ages$Alice <- 60 ages

Output:

$Alice [1] 60 $Bob [1] 25 3. Select an Object with White Spaces

Accessing a list variable with names that contain blank spaces is a bit trickier. This is because blank spaces are a no-go in R (similar to other programming languages) as they mess up the compiler.

For example:

ages <- list('Alice Smith'=30, 'Bob Jones'=25) ages$Bob Jones

Output:

[1] Error: unexpected symbol in "ages$Bob Jones" Execution halted

Here the blank space between Bob Jones caused the R compiler to think that Jones is an invalid and unrelated symbol that is there by accident.

But because the list has a variable with the name Bob Jones, this is not a mistake. To fix the issue with variables that have blank spaces, wrap the name around backticks after the $ operator.

For example:

ages <- list('Alice Smith'=30, 'Bob Jones'=25) ages$`Bob Jones`

Output:

[1] 25

Now the compiler successfully knows that it should look for a multi-part variable name in the list.

Notice that a better approach is to name the columns of the table so that there would be no blank spaces! If your table has columns with blank spaces, to begin with, you can replace the blank spaces with something else, such as underscores.

Using $ on Dataframes

Another main use case for the $ operator is when dealing with dataframes. Similar to lists, the $ operator makes it easy to access, modify, and remove columns in the dataframe.

This section shows you how to use the $ operator on data frames.

In the following sections, you are going to work with the following data frame:

shopping_list = data.frame(PRODUCT_GROUP = c("Fruit","Fruit","Fruit","Fruit","Fruit","Vegetable","Vegetable","Vegetable","Vegetable","Dairy","Dairy"), PRODUCT_NAME = c("Banana","Apple","Mango","Orange","Papaya","Carrot","Potato","Cucumber","Tomato","Milk","Yogurt"), Price = c(1,0.8,0.7,0.9,0.7,0.6,0.8,0.75,0.15,0.3,1.1), Tax = c(NA,NA,24,3,20,30,NA,10,NA,12,15))

This dataframe is a table of products that looks like this when printed out:

PRODUCT_GROUP PRODUCT_NAME Price Tax 1 Fruit Banana 1.00 NA 2 Fruit Apple 0.80 NA 3 Fruit Mango 0.70 24 4 Fruit Orange 0.90 3 5 Fruit Papaya 0.70 20 6 Vegetable Carrot 0.60 30 7 Vegetable Potato 0.80 NA 8 Vegetable Cucumber 0.75 10 9 Vegetable Tomato 0.15 NA 10 Dairy Milk 0.30 12 11 Dairy Yogurt 1.10 15

Let’s jump into it!

4. Select a Column

Selecting a particular column in a dataframe is easy with the $ operator. All you need to do is specify the name of the dataframe, followed by the $ operator and the name of the specific column you’d like to access.

For example, let’s access the PRODUCT_NAME column in the shopping_list dataframe:

shopping_list$PRODUCT_NAME

Output:

[1] "Banana" "Apple" "Mango" "Orange" "Papaya" "Carrot" [7] "Potato" "Cucumber" "Tomato" "Milk" "Yogurt"

The result is the names of the individual products.

Notice how the idea of accessing a column in a dataframe is exactly the same as accessing a variable in a list.

5. Add a New Column to a Dataframe

To add a new column to a dataframe, use the $ operator as an accessing operator by specifying the new column name to it.

The idea is the same as adding a new variable to a list with the $ operator.

For example, let’s add a new column, “Available” to the shopping_list and make it default to the value “Yes“.

shopping_list$Available <- rep('Yes', length(shopping_list$PRODUCT_GROUP)) shopping_list

Output:

PRODUCT_GROUP PRODUCT_NAME Price Tax Available 1 Fruit Banana 1.00 NA Yes 2 Fruit Apple 0.80 NA Yes 3 Fruit Mango 0.70 24 Yes 4 Fruit Orange 0.90 3 Yes 5 Fruit Papaya 0.70 20 Yes 6 Vegetable Carrot 0.60 30 Yes 7 Vegetable Potato 0.80 NA Yes 8 Vegetable Cucumber 0.75 10 Yes 9 Vegetable Tomato 0.15 NA Yes 10 Dairy Milk 0.30 12 Yes 11 Dairy Yogurt 1.10 15 Yes

If you’re wondering what this part does: rep(‘Yes’, length(shopping_list$PRODUCT_GROUP)), it’s just to make the new column as long as the PRODUCT_GROUP column in the table.

6. Delete a Column

Deleting a specific column from a dataframe is possible by using the $ operator and the NULL object. To remove a column, access it with the $ operator and assign a NULL value to it.

For example, let’s remove the “Tax” column from the shopping_list table:

shopping_list$Tax <- NULL shopping_list

Output:

PRODUCT_GROUP PRODUCT_NAME Price 1 Fruit Banana 1.00 2 Fruit Apple 0.80 3 Fruit Mango 0.70 4 Fruit Orange 0.90 5 Fruit Papaya 0.70 6 Vegetable Carrot 0.60 7 Vegetable Potato 0.80 8 Vegetable Cucumber 0.75 9 Vegetable Tomato 0.15 10 Dairy Milk 0.30 11 Dairy Yogurt 1.10 Summary

Today you learned how to use the $ operator in R.

To recap, you can use the $ operator in R to access columns of dataframes or variables of a list. The $ operator makes it easy to access, modify, and delete values from dataframes and lists.

Thanks for reading. Happy coding!

Read Also

Javascript Call() Vs Apply(): A Complete Guide (Examples)

In JavaScript, the call() and apply() methods are both used to borrow and call a function on another object. The only difference between them is the way they accept arguments:

The call() method takes the arguments as traditional function arguments separated by commas.

The apply() method takes the arguments as an array.

Both methods are useful when borrowing functionality. To call a function of one object on another object you can use call() or apply().

This is a comprehensive guide to understanding what are the call() and apply() methods in JavaScript and how they differ from one another. Chances are you aren’t quite familiar with either method so let’s take a quick look at the call() and apply() methods separately before discussing the differences.

The call() Method on JavaScript

In JavaScript, the call() method is used to call a function with a specified this value and arguments provided individually. It is a method that is available on all functions in JavaScript, and it can be used to invoke the function and specify the value of this inside the function.

Let’s see a couple of examples to support your understanding.

Example 1

For example, let’s call add() function on two numbers.

function add(a, b) { return a + b; } console.log(add.call(null, 1, 2));

Output:

3

In the example above, the call() method calls the add() function and specifies null as the value of this into the add() function.

The call() method also takes arguments 1 and 2 as a comma-separated list. This produces a result of 3, which is the sum of 1 and 2 – nothing too fancy, is it?

At this point, you may wonder why such a hassle for calling a function. Why couldn’t you call the function directly instead of doing it via the call() method?

The call() method is often used in JavaScript when you want to borrow a method from one object and use it on another object.

Notice that the above example is essentially the same as directly calling the add() function.

function add(a, b) { return a + b; } console.log(add(1, 2));

Let me show you another example that illustrates the function-borrowing aspect.

Example 2

For example, suppose you have two objects, obj1 and obj2, and you want to use the add() method from obj1 on obj2.

You could do this using the call() method, like this:

const obj1 = {name: "Alice"} const obj2 = {name: "Bob"} obj1.add = function(a, b) { console.log(this.name) return a + b; } console.log(obj1.add.call(obj2, 1, 2));

Output:

Bob 3

In this example, the add() method is borrowed from obj1 and used on obj2. Here, the call() method specifies the value of this within the function add() which in this case is the obj2. Besides, we pass the arguments to the function to perform the addition operation on.

Notice how the output says “Bob” even though initially the method belongs to obj1 whose name is “Alice“. This is because the this value is obj2 in the add() method when using the call() method the way we did above, if that makes sense.

The apply() Method on JavaScript

In JavaScript, the apply() method is almost identical method to the call() method. It’s used to call a function with a specified this value and arguments provided as an array. The apply() is a method that is available on all functions in JavaScript.

Let’s also see a couple of examples to better understand how this method works, although it’s very similar to the call() method.

Example 1

For example, let’s add two numbers with add() function via apply() method:

function add(a, b) { return a + b; } console.log(add.apply(null, [1, 2]));

Output:

3

In the example above, the apply() method invokes the add() function (and for the sake of simplicity, it specifies null as the value of this within the function).

The apply() method takes the arguments as an array. This produces the result of 3, which is the sum of 1 and 2 that are given in the array.

Similar to the call() method, the apply() method is useful when you want to borrow a method from one object to another.

Example 2

For example, suppose you have two objects, obj1 and obj2, and you want to use the add() method from obj1 on obj2.

You could do this using the apply() method, like this:

const obj1 = {name: "Alice"} const obj2 = {name: "Bob"} obj1.add = function(a, b) { console.log(this.name) return a + b; } console.log(obj1.add.apply(obj2, [1, 2]));

Output:

Bob 3

In this example, the add() method is borrowed from obj1 and used on obj2. The apply() method sets the this value for the function. In this case, this refers to obj2 inside the add() function. So far it’s exactly how the call() method works. The only difference being in that the arguments are given as an array.

call() vs apply()

In the previous sections, you learned what the call() and apply() methods are and how they work.

The key difference between call() and apply() is very subtle.

The call() method takes arguments as traditional function arguments separated by commas. The apply() method takes the function arguments as an array of an arbitrary number of arguments.

Here’s an example that illustrates the small difference between the methods:

function add(a, b) { return a + b; } console.log(add.call(null, 1, 2)); console.log(add.apply(null, [1, 2]));

Output:

3 3

All in all, the call() and apply() methods are used to borrow a method from one object to another.

The call() method is used when you know the exact number and types of arguments that the function expects, while the apply() method is useful when you don’t know the exact number or types of arguments that the function expects, or when you want to pass the arguments as an array.

Summary

Overall, the main difference between the call() and apply() methods is the way they pass arguments to the function. The call() method takes the arguments as a comma-separated list, while the apply() method takes the arguments as an array. Both methods are useful in different situations, and which one you should use will depend on the specific needs of your code.

Thanks for reading. Happy coding!

Read Also

JavaScript Interview Questions

Complete Guide To Golden Handshake With Working

What is Golden Handshake?

Start Your Free Investment Banking Course

Download Corporate Valuation, Investment Banking, Accounting, CFA Calculator & others

Explanation

Normally employment contracts contain a clause of severance package to be given to the employees by the employer when they lose out on their active jobs due to professional negligence or due to lay-offs or due to voluntary retirement. The severance package is offered to the employees who are either engaged in a high-risk job or they are employed as a top executive in the organization. This is primarily done to protect employee interests when they hold top executive posts. The severance package is the collection of the benefits offered by the employer to the employee when the services of the employees are ended abruptly or they are laid off from the organization. Normally, the employer and employee have to sign the severance agreement or contract. The total amount of the money receivable to the employee depends upon the tenure’s length they stay in the organization. Such payments may also include unutilized vacations or sick leaves and business expenses that are yet to be reimbursed.

How does it work?

Whenever a business feels that the top employee has attained an age where he could be asked to retire or whenever business reaches the point that they have to cut down the costs of the employees, they initiate the golden handshake clause as per the contract. They communicate with the employees who hold the top executive positions in the organization. In such a scenario, it is not the mistake of the employees and yet their services are being terminated. The severance package under the golden handshake clause mitigates the imminent financial risk resulting from an abrupt termination of services. The scenarios where a golden handshake is prominently applied are when the employee is closed to his retirement age or either the business is looking towards the reduction in costs of operations.

Examples of Golden Handshake Reasons for Golden Handshake

In the business lifecycle, there comes a point beyond which if the business continues to undertake the rising costs of operations, this could result in imminent failures for the business. The business may shut down eventually and this would end up affecting the employees who are at the bottom-most level or tier in the organization. Therefore, as a defense mechanism and to protect the interests of all employees, the top executives are asked to take up voluntarily retirement or they are laid off by the business which then helps the business to curb their rising costs. Since the employees who held the top-level positions in the organizations were not at any fault, the business offers them a golden handshake which helps the laid-off employees to mitigate their financial risk.

Golden Handshake vs Golden Parachute

The golden parachute is termed as a package that the employee receives if the business has been taken over by the other company and the services of the employee are terminated as the result of the merger. The golden parachute is also given to key and top executives employed in the business. The package under the golden parachute may be composed of severance pay, stock options and cash bonuses. The golden parachute can be regarded as a poison pill which undertaken by the target business in the form of employee exodus to discourage the attempts of a hostile takeover by the acquiring business.  On the other hand, the golden handshake can be compared to as golden boot offered by the organization to offered with the intent of initiating their voluntary retirement from the organization. The golden handshake is nowhere related to mergers and takeovers.

Advantages

Normally top-level executives or employees are engaged in a high-risk job. Taking the nature of risk into the account, the employer agrees to offer a hefty package in the form of a golden handshake. This motivates the employee to work diligently for the employer.

Normally when top-level executives change jobs, they take into account the level of severance package offered by the employer along with the salary offered.

The golden handshakes take care of the financial security of the employee when he or she faces unemployment and job loss.

It helps employees to seek out better alternatives and opportunities as they won’t have to worry on the account of immediate money requirements or funding needs.

The golden handshake offered to the employee is often not performance-based. The employment contract does not add the stipulation or clause that the employee has to perform throughout his employment tenure. Therefore, when employees are fired under the ground of non-performance, the employees would still be eligible for the severance package.

The organization may induce early retirements for the employees deliberately to tone down the costs of increasing operations.

They could further initiate it to cut down on their labor force to meet the demand of an ever-changing business environment or to cope up with a takeover.

If the top executives take up a golden handshake then they have to accept the non-compete clause under the severance package.

A non-compete clause states that the top executive would be allowed to open any rival business for predefined tenure once terminated from the organization.

Conclusion

The golden handshake is one of the clauses in the employment contract of the employee who holds top executive or management level position in the organization. The golden handshake offers a severance package which helps employee mitigate their financial risk.

Recommended Articles

Complete Guide To What Is Laravel Artisan With Example

Introduction to Laravel Artisan

Web development, programming languages, Software testing & others

What is Laravel Artisan?

Laravel Artisan is one of the three command line interfaces found in the Laravel framework.

It is a helpful command line interface, assisting developers into developing applications though the numerous easy to read commands. One can also create custom codes in order to increase the efficiency of the applications.

But the efficacy of Artisan does not end here.

Developers can generate migrations, publish assets of packages and many similar tasks. Artisan has a whole lot of built in command which are a boon to the developer.

Though a whole lot generally work on custom commands, there are many who prefer the inbuilt ones.

php artisan list

This query will give a list of commands which certainly increases the efficiency of the entire process and saves a whole lot of time.

With these commands one can go ahead and create a plethora of functions, namely, controller, migration, create, mail, et al.

Laravel 3.7 was the initial offering from PHP and it was quite basic in its code structure. Though in spite of that, it had some excellent features to boot.

With the release of Laravel 5.7, added on to the newer sets of commands, some existing packages too are available.

Laravel 4, is primarily dependent on the Symfony framework.

How does Laravel Artisan work?

The Laravel Artisan serve command helps run application on the PHP Development Server.

A developer has the option to use Laravel Artisan serve for a variety of roles.

There are other two functions that the Laravel Artisan serve support. The change of application address by using the host and port.

The application’s port can be changed by using the port option.

The Laravel Artisan works in two ways, through the inbuilt commands and custom commands.

The Laravel Artisan has a robust set of inbuilt commands that can help one create a variety of functions.

On the other hand, developers also have the option of creating their custom made commands.

Example of Laravel Artisan

Example which will exemplify how a custom command can be created:

Create the custom command:

Execute the command on the terminal:

php artisan make:command CreateEmployeeName

A file is now created in the directory: app/console/Commands

The name of the file would be: CreateEmployeeName

The complete code would be:

<?php namespace AppConsoleCommands; use IlluminateConsoleCommand; class CreateEmployeeName extends Command { /** * The name and signature of the console command. * * @var string */ protected $user = 'command:name'; /** * The console command description. * * @var string */ protected $description = 'Command description'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { } }

The immediate next step is to go ahead and update the Laravel command which we have just created.

While doing that a few queries have to defined for the command structure to properly function:

$user: Create admin

$description: Create the account of the user which would be having admin role.

The role field which is located in the user table also needs to be updated.

protected $commands = [ CommandsCreateEmployeeName::class, ];

Once the chúng tôi has been updated, the custom command can now be run since it has become a part of the list. You can check the same by using the list command. However, if you still think this will work, you are wrong. It won’t. Commands work on logic, which has to be built.

Once the migration table is created update the model array:

protected $fillable = [ 'name', 'email', 'password', 'role' ];

Now you can go ahead and update the handle() as per your wish:

Few quick examples to look at:

1. To begin a Laravel Artisan project

Code:

php artisan serve

Output:

2. To enable the caching mechanism

Code:

php artisan route:cache

3. To view help, options and arguments

Code:

php artisan help serve

4. Generating a new command class

Code:

php artisan make:console GoCommand Conclusion

PHP Artisan has all the elements which will help the developer build a complete application. And as we have discussed, it is not simply limited to building of applications. One can do a host of other activities taking the help of the list of commands, that PHP Artisan holds. Also, with custom coding, the example of which we encountered above, this entire process of development becomes a lot more customized and personal. Needless to say, there is a rapid increase in the efficiency level too.

Recommended Articles

We hope that this EDUCBA information on “Laravel Artisan” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Update the detailed information about Complete Guide To Docker Registry With Examples on the Hatcungthantuong.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!