Server Side Programming Articles

Page 2 of 2108

Difference between system level exception and Application level exception.

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 3K+ Views

An exception is an unwanted event that interrupts the normal flow of a program. In C#, exceptions are broadly categorized into System Level Exceptions (thrown by the CLR for fatal errors) and Application Level Exceptions (thrown by application code for recoverable errors). System Level Exception System level exceptions are derived from System.SystemException and are thrown by the .NET Common Language Runtime (CLR). They represent non-recoverable or fatal errors such as stack overflow, out of memory, null reference, or database crashes. These exceptions are generally not handled by application code. Common examples − NullReferenceException, StackOverflowException, OutOfMemoryException, IndexOutOfRangeException. ...

Read More

Difference between var and dynamic in C#

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 6K+ Views

In C#, var and dynamic are two ways to declare variables without explicitly specifying the type. The key difference is when the type is determined − var resolves the type at compile time, while dynamic resolves it at runtime. var (Implicitly Typed) var was introduced in C# 3.0. It is a statically typed variable whose data type is inferred by the compiler at compile time based on the value assigned during initialization. A var variable must be initialized at the time of declaration, otherwise the compiler throws an error. dynamic (Dynamically Typed) dynamic was introduced in ...

Read More

Difference between const char* p, char * const p, and const char * const p in C

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 13K+ Views

In C programming, *p represents the value stored at the address a pointer points to, and p represents the address itself. The const keyword can be applied to the char value, the pointer, or both. The thumb rule is to read declarations from right to left. The Three Declarations Declaration Read Right-to-Left Change Value (*p)? Change Pointer (p)? const char *p p is a pointer to a constant char No Yes char * const p p is a constant pointer to a char Yes No const char * const p ...

Read More

Difference between const int*, const int * const, and int const * in C

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 4K+ Views

In C programming, *p represents the value stored at the address a pointer points to, and p represents the address itself. The const keyword can be applied to either the pointer, the value it points to, or both, creating different levels of immutability. The thumb rule for reading these declarations is to read from right to left. The Three Declarations Declaration Read Right-to-Left Change Value (*p)? Change Pointer (p)? const int *p p is a pointer to a constant int No Yes int const *p p is a pointer to a ...

Read More

Difference between Python and PHP.

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 578 Views

Python and PHP are both popular programming languages but serve different primary purposes. Python is a general-purpose language used across many domains, while PHP is primarily a server-side scripting language designed for web development. Python Python is a high-level programming language with a large built-in standard library. It was developed by Guido van Rossum, with its first version released in 1990. Python emphasizes clean syntax and readability, making it suitable for a wide range of applications from web development to data science and AI. Example # Python: clean, concise syntax languages = ["Python", "PHP", "Java"] ...

Read More

Difference between Goroutine and Thread in Golang.

Mahesh Parahar
Mahesh Parahar
Updated on 14-Mar-2026 977 Views

Goroutines and threads are both mechanisms for concurrent execution, but they work at different levels. Goroutines are lightweight, user-space concurrency primitives managed by the Go runtime, while threads are OS-level constructs managed by the operating system kernel. Goroutine A goroutine is a function or method that executes independently and concurrently with other goroutines. Every concurrent activity in Go is typically implemented as a goroutine. Goroutines start with just a few kilobytes of stack space (which grows dynamically) and are multiplexed onto a small number of OS threads by the Go runtime scheduler. Example The following program launches two goroutines that ...

Read More

How to call a function with argument list in Python?

Sarika Singh
Sarika Singh
Updated on 13-Mar-2026 4K+ Views

The purpose of a function is to perform a specific task using code blocks. Functions save time by eliminating unnecessary copying and pasting of code. If you need to make a change, you only update the function in one place rather than searching through your entire program. This follows the DRY (Don't Repeat Yourself) principle in software development. Defining a Function in Python Python functions are created using the following syntax − def function_name(parameters): function body A function is defined using the def keyword followed by the function name and ...

Read More

How to expand tabs in string to multiple spaces in Python?

Sarika Singh
Sarika Singh
Updated on 13-Mar-2026 3K+ Views

In Python, handling white spaces between strings is easy. Sometimes, we may want to add space in a string, but we are not sure exactly how much. Python provides different ways to manage this, and one useful method is the expandtabs() method. Using the expandtabs() Method The expandtabs() method in Python is used to replace tab characters (\t) in a string with spaces. It returns a new string where each \t is replaced with the number of spaces needed to reach the next tab stop. You can control how many spaces are used by passing a tabsize value ...

Read More

How can I remove the ANSI escape sequences from a string in python?

Manogna
Manogna
Updated on 13-Mar-2026 9K+ Views

You can use regexes to remove the ANSI escape sequences from a string in Python. Simply substitute the escape sequences with an empty string using re.sub(). The regex you can use for removing ANSI escape sequences is: (\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]. Example Here's how to create a function to remove ANSI escape sequences − import re def escape_ansi(line): ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]') return ansi_escape.sub('', line) # Test with a string containing ANSI escape sequences test_string = '\t\u001b[0;35mSomeText\u001b[0m\u001b[0;36m172.18.0.2\u001b[0m' result = escape_ansi(test_string) print(repr(result)) The output of the above ...

Read More

How would you convert string to bytes in Python 3?

Yaswanth Varma
Yaswanth Varma
Updated on 13-Mar-2026 433 Views

In Python, strings and bytes are two different types of data, where the strings are the sequences of unicode characters used for text representation, while bytes are sequences of bytes used for binary data. Converting strings to bytes is used when we want to work with the raw binary data or perform low-level operations. This can be done by using the built-in encode() method or the bytes() constructor. Using Python encode() Method The Python encode() method is used to convert the string into bytes object using the specified encoding format. Syntax Following is the syntax ...

Read More
Showing 11–20 of 21,074 articles
Advertisements