Articles on Trending Technologies

Technical articles with clear explanations and examples

Golang program to show promoted methods

Akhil Sharma
Akhil Sharma
Updated on 04-Apr-2023 607 Views

In golang, Promoted methods are the methods created under those structs which are embedded inside another struct, now the struct in which it is embedded can access its methods and fields. In this article we are going to explain how to show promoted methods using various structs like Rectangle and Square, Vehicle and car. Algorithm Step 1 − Create a package main and declare fmt(format package) package in the program where main produces executable codes and fmt helps in formatting input and Output. Step 2 − Create a Rectangle struct with two fields width and height of type float ...

Read More

Golang program to depict use of promoted fields

Akhil Sharma
Akhil Sharma
Updated on 04-Apr-2023 567 Views

In golang, promoted fields are the structs that are embedded inside another structs and their fields can also be accessed the structs in which they are embedded. In this article we are going to understand three different approaches to depict use of promoted filed with and without the help of pointers. Using Pointers In this illustration, we will make use of pointers to show the promoted fields. The field names will be set with the help of pointers and information will be printed using dot notation. Algorithm Step 1 − Create a package main and declare fmt(format package) package ...

Read More

Golang program to show use of rand package

Akhil Sharma
Akhil Sharma
Updated on 04-Apr-2023 502 Views

In golang, a rand package is used to generate random numbers/characters. Firstly, it seeds with the current time to get the different random Output each time then perform any operation. Syntax rand.Seed(value) Rand.Seed() function is used to generate random numbers. It takes a user input as argument which is the upper limit for generating random numbers. func Now() Time The Now() function is defined in time package. This function generates the current local time. To use this function, we have to first impot the time package in our program. func (t Time) UnixNano() int64 The UnixNano() function ...

Read More

Golang program to print struct variables

Akhil Sharma
Akhil Sharma
Updated on 04-Apr-2023 1K+ Views

In this Golang article, we will write programs to print struct variables. Here, there is no concept of classes, instead of that structs are used to represent a collection of related fields or properties. Using Name of the Field and Shorthand Declaration in the Main Function In this method, we will create a child struct and further create two fields name and age in it. The field values are set by creating the instance of the struct. In the second example, the field values of the Child struct are set in the instance using shorthand declaration and the field ...

Read More

Explain Class Methods in Coffeescript

Prabhdeep Singh
Prabhdeep Singh
Updated on 04-Apr-2023 239 Views

To understand the class methods in CoffeeScript first we need to understand what it is CoffeeScript. CoffeeScript is a lightweight programming language, and this language compiles in JavaScript and is also inspired by languages like JavaScript, python, ruby, Haskell, etc. Further, we will discuss it in detail after that we are going to discuss class methods in CoffeeScript with its syntax of it an example with a full explanation and in the end, we conclude it. Introduction of CoffeeScript As we discussed above it is a lightweight programming language that compiles in JavaScript. It is basically an effort to make ...

Read More

How can I encode a string to Base64 in Swift?

Nitin Aggarwal
Nitin Aggarwal
Updated on 04-Apr-2023 7K+ Views

In Swift, you can use the built-in Data type and its method base64EncodedString() to encode a string to Base64. In the iOS applications, you might need to encode a string to base64 mostly in networking requests and responses. Mostly, you will need to encode a string to base64 and vice versa. Let's learn how to encode a string to Base64 using Swift. Example In this example, we will use the following steps to encode a string to base64 − Step 1 − In this step, we will convert the string to a Data object using the data(using: .utf8) method. ...

Read More

Why Ignoring Digital Marketing Will Cost You Time and Sales?

Shivam Jadoun
Shivam Jadoun
Updated on 04-Apr-2023 237 Views

You may believe that your business can survive without advertising. After all, word of mouth can help you attract more customers, right? Unfortunately, not marketing can actually cost you a lot of money and time. Content marketing has become a buzzword in the small business community, with many believing that putting content online will result in customers streaming in. If you don’t understand how marketing works, don’t assume that it will automatically produce results. Even though it’s incredibly effective, it takes a lot of planning and strategy to get the most out of it. Let’s find out more about trends ...

Read More

Why Do You Really Need Performance Marketing?

Shivam Jadoun
Shivam Jadoun
Updated on 04-Apr-2023 502 Views

In the ideal world, you would pay for what you get. However, due to the varying variables that affect the effectiveness of marketing, the cost of ad spend can vary. For instance, while it is important to spend the majority of your marketing budget on advertising, it is also important to consider the quality of the leads that you are generating. If you are still spending a lot of money on clicks and impressions, but are not seeing the results that you want, then performance marketing might be the best option for you. One of the most important factors that ...

Read More

What Is Video Content Marketing and Why Is It Important?

Shivam Jadoun
Shivam Jadoun
Updated on 04-Apr-2023 462 Views

The rise of video content has made it clear that it's the most preferred medium for content marketing. It's also apparent that many content marketers recognize the many advantages of including it in their marketing efforts. Video content can help boost engagement with customers, improve brand awareness, and increase sales. Due to the rise of social media platforms such as YouTube, Facebook, and Instagram, the demand for video content marketing has increased. This new marketing concept requires that marketers pay attention to various factors, such as the number of viewers, the rank of their videos, and the number of people ...

Read More

How do I make an enum decodable in Swift?

Nitin Aggarwal
Nitin Aggarwal
Updated on 04-Apr-2023 2K+ Views

In Swift, you can use the Codable protocol to make an enum decodable as well. In Swift, the Codable protocol is a very powerful concept to provide flexibility to decode and encode any type of value. Also, you can make an enum decodable as well. You have to just define an enum in your custom type. In order to make an enum decodable, the enum must conform to the Codable protocol. In this article, we will learn how to use the Codable protocol to make an enum decodable in Swift What is the JSONDecoder Class? The JSONDecoder class is then ...

Read More
Showing 39051–39060 of 61,299 articles
Advertisements