Articles on Trending Technologies

Technical articles with clear explanations and examples

Explain the stream architecture in .NET

Akshay Khot
Akshay Khot
Updated on 11-Mar-2026 680 Views

The .NET streams architecture provides a consistent programming interface for reading and writing across different I/O types. It includes classes for manipulating files and directories on disk, as well as specialized streams for compression, named pipes, and memory-mapped files.The streaming architecture in .NET relies on a backing store and adapters.Backing StoreIt represents a store of data, such as a file or a network connection. It can act as either a source from which bytes can be read sequentially or a destination to which bytes can be written sequentially.The Stream class in .NET exposes the backing store to programmers. It exposes ...

Read More

__tostring element in Lua Programming

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 3K+ Views

The _tostring element in Lua receives an argument of any type and converts it to a string in a reasonable format.If the metatable of e has a "__tostring" field, then tostring calls the corresponding value with e as argument, and uses the result of the call as its result.The __tostring element method is a part of the metatables that Lua library provides us and is used to modify the behaviour of the table that we get as an output.The __tostring element method is used to modify the behavior of the output table.Examplecurrtable = setmetatable({ 10, 20, 30 }, {   ...

Read More

Golang Program to create a Class that can perform basic Calculator Operations

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 1K+ Views

To create a class that can perform basic calculator operations, we can take following StepsWe can define a Calculator class with two numbers, a and b.Define a member method to calculate the addition of two numbers.Define a member method to calculate the multiplication of two numbers.Define a member method to calculate the division of two numbers.Define a member method to calculate the subtraction of two numbers.In the main method, declare two variables, a and b.Get an instance of Calculator.Initialize a choice variable, based on which mathematical operations could be performed.Examplepackage main import (    "fmt" ) type Calculator struct { ...

Read More

Golang Program to Calculate the Average of Numbers in a Given List

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 1K+ Views

Input array is: [2, 4, 1, 6, 5]Sum = 2 + 4 + 1 + 6 + 5 => 18Average = 18/5 => 3.6 ~ 3To calculate the average of numbers in a given list, we can take following steps −Let's take an input list of numbers.Find the sum of numbers using sum() method.The sum method calculates the sum of numbers by iterating the given list.Print the average by dividing the sum with the length of the given list.Examplepackage main import (    "fmt" ) func sum(arr []int) int{    result := 0    for _, i :=range arr { ...

Read More

Difference between . and : in Lua programming

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 6K+ Views

The .(dot) operator in Lua is used to invoke the method of an object, and it is a widely used operator in Lua.The :(colon) operator in Lua is used when you want to pass an invisible parameter to the method of an object that you are calling.Let’s consider an example where we will have an object in which two functions are present and we will try to access these functions, first by making use of the dot operator and secondly by making use of the colon operator.ExampleConsider the example shown below −returnX = {foo = function(x, y) return x end, ...

Read More

How to Convert Perl Compatible Regular Expressions (PCRE) into Lua

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 687 Views

A regular expression is a special text string that is used to describe a search pattern.PCRE (Perl Compatible Regular Expressions) is a C library implementing regex. It was written in 1997 when Perl was the de-facto choice for complex text processing tasks. The syntax for patterns used in PCRE closely resembles Perl. If you want to learn about PERL and its use cases, you should visit this link.Now, let's take an example to see how to convert a PCRE into Lua and then print it.ExampleConsider the code shown below −"\002\003\004\005\006\007\008\009\010\011\012\”The above string acts as a PCRE and we will convert ...

Read More

How to create a Sandbox in Lua?

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 840 Views

In order to create a sandbox and to be able to use it we must first understand what a sandbox is and why we need it. A sandbox is term that is used in different fields of computer science, like in case we are talking about the software testing domain, then a sandbox is a testing environment that isolates untested code changes and outright experimentation from the production environment and if we talk about cybersecurity, then a sandbox is an environment that is an isolated virtual machine in which potentially unsafe software code can execute.Sandboxing is basically all about isolating ...

Read More

Golang Program to Read a Number (n) and Compute (n+nn+nnn)

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 402 Views

Let's read a number, n=5Then, nn=55 and then nnn=555res = 5 + 55 + 555 => 615To read a number (n) and compute (n+nn+nnn), we can take the followingStepsDefine a variable, n.Print a statement to get the number, n.Take user input for variable, n.Make an expression for (n + nn + nnn).Convert the expression into numbers.Compute the sum of the expression.Examplepackage main import (    "fmt"    "strconv" ) func main(){    var n int    fmt.Print("Enter value of n: ")    fmt.Scanf("%d", &n)    t1 := fmt.Sprintf("%d", n)    t2 := fmt.Sprintf("+%d%d", n, n)    t3 := fmt.Sprintf("+%d%d%d", n, ...

Read More

Golang Program to read the marks of subjects and display the Grade

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 639 Views

Let's enter the marks: 89 56 90 67 99Sum of the marks is: 89+56+90+67+99 => 401Avg. = 401/5 = 80.1The steps are as follows:Define variables for 5 subjects.Enter marks for 5 subjects.Find average of the marks to find grade.Use if else block to print grade.Examplepackage main import "fmt" func main(){    var sub1, sub2, sub3, sub4, sub5 int    fmt.Println("Enter marks of the five subjects:")    fmt.Scanf("%d", &sub1)    fmt.Scanf("%d", &sub2)    fmt.Scanf("%d", &sub3)    fmt.Scanf("%d", &sub4)    fmt.Scanf("%d", &sub5)    avg:=(sub1+sub2+sub3+sub4+sub5)/5    if avg>=90{       print("Grade: A")    }else if avg>=80 && avg=70 && avg=60 && avg

Read More

Golang Program to Read Two Numbers and Print their Quotient and Remainder

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 402 Views

To print the Quotient and Remainder of two numbers, we can use the division operator and the modulo operator.Let's take an Example:a = 15 and b = 2Quotient is 15/2 = 7Remainder is 15 % 2 = 1StepsDefine the variables, a and b.Use print statement for the first number.Use print statement for the second number.Find the division of the numbers, a and b.Find the remainder of the numbers, a and b.Print the calculated division.Print the calculated remainder.Examplepackage main import "fmt" func main(){    var a, b int    fmt.Print("Enter first number: ")    fmt.Scanf("%d", &a)    fmt.Print("Enter second number: ") ...

Read More
Showing 25051–25060 of 61,297 articles
Advertisements