Articles on Trending Technologies

Technical articles with clear explanations and examples

How to access images inside a public folder in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 33K+ Views

If you have an image stored in the public folder of Laravel, you can access or display it in the browser using various methods. In this article, we will learn some of these methods. Assume we have the image of a flower (flower.jpg) stored in the public/images folder as shown below ? Laravel Project Structure public/ images/ flower.jpg Now let us use the image to view inside the browser. Using url() Method The ...

Read More

Why do we assume strncpy insecure in C/C++?

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 714 Views

The strncpy() function is used to copy a specified number of characters from a source string to a destination string. While it might seem safer than strcpy() because it limits the number of characters copied, strncpy() has several security vulnerabilities that make it unsafe for general use. Syntax char *strncpy(char *destination, const char *source, size_t n); Parameters: destination: Pointer to the destination array where content is to be copied source: Pointer to the source string to be copied n: Maximum number of characters to be copied from source Why strncpy() is Insecure ...

Read More

Accessing array out of bounds in C/C++

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 2K+ Views

An array in C is a fixed-size sequential collection of elements of the same data type where all elements are stored in contiguous memory. When an array is accessed out of bounds, undefined behavior occurs in C, unlike higher-level languages that throw exceptions. Syntax type arrayName[size]; // Valid indices: 0 to (size-1) // Out of bounds: index < 0 or index >= size Accessing Out of Bounds Memory Accessing out-of-bounds memory means trying to access an array index outside its valid range (index < 0 or index >= array size). This returns garbage values ...

Read More

How to get the server IP with Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 7K+ Views

In Laravel, you can get the server IP address using the global $_SERVER['SERVER_ADDR'] variable or Laravel's built−in request methods. The server IP represents the IP address of the server hosting your application. The $_SERVER superglobal variable contains information about headers, paths, and script locations, including server details. Using $_SERVER['SERVER_ADDR'] The simplest method is to access the server IP directly from the $_SERVER superglobal ? 127.0.0.1 Using Laravel's Request Object Laravel provides the request() helper function with a server() method to access server variables ? ...

Read More

How to write long strings in Multi-lines C/C++?

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 15K+ Views

To write long strings in multi-lines, you can use the 'newline character' or 'string concatenation'. It increases the readability of the code, makes the code look clean, and you can avoid horizontal scrolling. In this article, we have a long string and our task is to write the long string in multi-lines in C. Syntax // Using newline character char str[] = "First lineSecond lineThird line"; // Using string concatenation char str[] = "First part of string " "Second part of string ...

Read More

How to check if a Laravel collection is empty?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 18K+ Views

Before checking if a Laravel collection is empty, let's understand what collections are in Laravel. Collection in Laravel is an API wrapper that helps you deal with different operations on arrays. It uses the class Illuminate\Support\Collection to handle arrays in Laravel. To create a collection from an array, use the collect() helper method that returns a collection instance. You can then chain methods like converting to lowercase and sorting on the collection. Installation: Make sure you have Laravel installed and create a controller using: php artisan make:controller UserController Using the isEmpty() Method The isEmpty() ...

Read More

Data Types we cannot use to create array in C

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 447 Views

In C programming, arrays can be created using most data types like int, char, float, double, etc. However, there are certain data types that cannot be used to create arrays. The most notable restriction is with the void data type. Syntax datatype array_name[size]; // Valid for most data types void array_name[size]; // Invalid - compilation error Data Types That Cannot Be Used for Arrays 1. Void Data Type The void data type represents "no type" and has no size. Since arrays need to know the size of ...

Read More

Difference between PHP and C

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 2K+ Views

PHP and C are two distinct programming languages that serve different purposes. PHP is a server−side scripting language primarily used for web development, while C is a low−level procedural programming language used for system programming. Understanding their differences helps developers choose the right tool for their projects. What is PHP? PHP (Hypertext Preprocessor) is a general−purpose programming language developed by Rasmus Lerdorf in 1994. It is primarily utilized for web development and runs on web servers to generate dynamic content. PHP code is processed by a PHP interpreter installed on web servers as a module, daemon, ...

Read More

How to pass a 2D array as a parameter in C?

George John
George John
Updated on 15-Mar-2026 1K+ Views

In C programming, a 2D array can be passed as a parameter to a function in several ways. The method depends on whether the array dimensions are known at compile time or need to be determined at runtime. Syntax // Method 1: Fixed dimensions (known at compile time) void function_name(int arr[ROWS][COLS]); // Method 2: Variable dimensions (C99 and later) void function_name(int rows, int cols, int arr[rows][cols]); // Method 3: Using pointer to array void function_name(int (*arr)[COLS]); Method 1: Using Fixed Dimensions When array dimensions are known at compile time, you can specify ...

Read More

PHP – grapheme_strlen() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 393 Views

A grapheme is the smallest functional unit of a writing system. Graphemes can be interpreted as the smallest units of writing that correspond with sounds. The grapheme_strlen() function in PHP is used to get the string length in grapheme units. This function does not get the byte or character's length but counts the actual displayed characters, making it useful for Unicode text with combining characters. The grapheme_strlen function is supported in PHP 5.3.0 and higher versions. Note: The Intl extension must be installed and enabled to use this function. Syntax int grapheme_strlen(string $input) ...

Read More
Showing 22041–22050 of 61,297 articles
Advertisements