Skip to main content

Posts

Showing posts with the label Ziggy Rafiq

Why HTML5 is Essential in Web Development

  HTML5 is the latest version of the Hypertext Markup Language that is widely used to create and design web pages. It's a highly dynamic and versatile language that enables web developers to create visually appealing and highly functional websites. As a web developer myself, I recently created a YouTube video on why HTML5 is essential in web development. In this video, I discuss the key features of HTML5 and how it has changed the way we design and develop websites. I also highlight some of the key benefits of using HTML5 in web development, including its ability to deliver a seamless and highly interactive user experience, its support for multimedia content, and its enhanced semantic markup capabilities. One of the key advantages of using HTML5 is its ability to support rich multimedia content such as audio and video, without requiring any additional plugins. This means that users can access multimedia content on a wide range of devices, including desktops, laptops, tablets, and s...

C# Security: Best Practices for Secure Coding

Overview  C# is a widely used programming language that is known for its ease of use and versatility. However, with the increasing number of cyber-attacks and security breaches, it is essential to ensure that the code we write in C# is secure. In this article, we will discuss some of the best practices for secure coding in C#. Avoid Using Plain Text Passwords When working with passwords, it is essential to store them securely. Storing passwords in plain text is a significant security vulnerability, and it is essential to avoid doing so. Instead, use a secure password hashing algorithm such as PBKDF2 or bcrypt to store the password. Input Validation Input validation is crucial when working with user input, as it helps prevent injection attacks such as SQL injection and cross-site scripting. Always validate user input and use parameterized queries when working with databases. Use Parameterized SQL Queries As mentioned earlier, parameterized queries are a powerful way to preve...

A Complete Guide to Using GUIDs in C# with Code Examples

  Overview In this post, we are looking at GUIDs (Globally Unique Identifiers), which are widely used in C# for generating unique identifiers for objects, entities, and resources in a system. In this post, we'll explore the basics of GUIDs in C#, their advantages, and how to convert strings to GUIDs. In this post, we have used Guid Generator to create the GUID from the following URL Address https://guidgenerator.com/ What is GUID GUID (Globally Unique Identifier) in C# is a 128-bit value that is used to identify objects, entities, or resources in a unique manner across different systems and applications. It is also known as UUID (Universally Unique Identifier) in some other programming languages.   GUIDs are generated using a combination of unique factors such as the MAC address of the network adapter, the current time and date, and a random number. The resulting GUID is a string of 32 hexadecimal digits separated by hyphens, such as "b86f2096-237a-4059-8329-1bbcea72769b...

How to Split a String using Backslash as Delimiter in C# with Code Examples

  Overview This post will discuss splitting strings in C# using a built-in method named String.Split. It is used to create an array of substrings from a string based on a delimiter.   You can use a string or a character as the delimiter.   Split returns an array with substrings. Each substring is separated using the delimiter specified.   To avoid the delimiter being misinterpreted as an escape sequence, it must be escaped using another backslash.   This post will show you how to split strings using the backslash character as the delimiter. It also includes code examples. String.Split Method The code example below shows that a string input contains multiple backslashes.   This string is called the Split method, and it uses a single backslash to delimit the input.   C#'s Split method splits strings into substrings depending on the delimiter that you have specified.   To use a Backslash to split two strings that have been separated by a Backslash,...

How to Truncate String in C#

  Overview In today’s post, I am writing about one of the fundamental aspects of C# and as programmers, we should use this approach I have realised throughout my life as a software engineer that not everyone knows the most basic approaches or how to use them efficiently. Truncating a string in C# means reducing the length of a string to a specified number of characters, typically by removing characters from the end of the string. This is often done when a string is too long to be displayed or used in a specific context and needs to be shortened to fit. Ley says if we have a string that is 100 characters long, but we only want to display the first 50 characters, we will truncate the string to a length of 50. There are several ways to truncate a string in C#, including using the Substring method, StringBuilder, and LINQ. A simple example of this is below, we're creating a longString variable with a long string value. We're also defining a maxLength variable with a value of 20...

Primitives Data Types and None-Primitives Data Types in C# with Code Examples

  Overview I wrote this post to provide an explanation of primitive and non-primitive data types in C#. C# is a strongly typed programming language, where each variable and expression must have a specific data type. C# data types are categorized into two primary groups: primitive data types and non-primitive data types. Primitive data types are the simplest data types available in programming languages. They are typically pre-defined data types and can represent a single value, such as a boolean value, character, or integer. Examples of primitive data types include int, char, float, double, and boolean, which are common in programming languages like C++, C, and Java. Non-primitive data types are also referred to as composite data types or reference data types. They are constructed from primitive data types and are more complex than primitive data types. Non-primitive data types can hold multiple values and allow for the creation of more intricate data structures like tables, li...