Articles on Trending Technologies

Technical articles with clear explanations and examples

How to access the public directory in Laravel?

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

In Laravel, you can access files in the public directory using the File facade or PHP's built−in functions. The public directory is where Laravel stores assets like images, CSS, and JavaScript files that need to be directly accessible via web URLs. Make sure to import the File facade in your controller: use Illuminate\Support\Facades\File; Laravel Public Directory Structure public/ images/ css/ ...

Read More

C Program to validate an IP address

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 9K+ Views

In this program we will see how to validate an IP address using C. The IPv4 addresses are represented in dot-decimal notation. There are four decimal numbers (all are ranging from 0 to 255). These four numbers are separated by three dots. An example of a valid IP is: 192.168.4.1 Syntax int validate_ip(char *ip); Validation Steps To validate the IP address we should follow these steps − Tokenize the string (IP address) using the dot "." delimiter If the sub strings are containing ...

Read More

How to Use OrderBy for Multiple Columns in Laravel?

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

In Laravel, you can sort query results by multiple columns using the orderBy() method chained together. This allows you to create complex sorting logic where records are first sorted by one column, then by another column for records with identical values in the first column. Syntax The basic syntax for ordering by multiple columns in Laravel is − Model::orderBy('column1', 'ASC/DESC') ->orderBy('column2', 'ASC/DESC') ->get(); Note: To run the examples below, ensure you have Laravel installed with a configured database connection and a Student model ...

Read More

C program to print characters without using format specifiers

George John
George John
Updated on 15-Mar-2026 900 Views

In this article we will see how we can print some characters without using any kind of format specifiers. The format specifiers in C are %d, %f, %c etc. These are used to print characters and numbers in C using the printf() function. Here we will see another way to print characters without using %c format specifier. This can be done by putting ASCII values directly in hexadecimal form using escape sequences. Syntax printf("\xHH"); // HH is hexadecimal ASCII value Method 1: Using Hexadecimal Escape Sequences The \x escape sequence allows us ...

Read More

Write a C program that does not terminate when Ctrl+C is pressed

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 2K+ Views

In C, we can create a program that does not terminate when Ctrl+C is pressed by using signal handling. The Ctrl+C key combination generates the SIGINT (Signal Interrupt) signal, which normally terminates a running process. However, we can intercept this signal using the signal() function and define custom behavior instead. Syntax #include void (*signal(int sig, void (*func)(int)))(int); Where sig is the signal number and func is the handler function to be called when the signal is received. Common Signal Types Signal Description SIGABRT Indicates Abnormal ...

Read More

What is Fillable Attribute in a Laravel model?

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

The fillable attribute in Laravel models is a security feature that defines which database fields can be safely mass−assigned. It protects against mass assignment vulnerabilities by explicitly specifying which fields can be updated through methods like create() or update(). What is Mass Assignment? Mass assignment occurs when you pass an array of data directly to model methods. Without proper protection, malicious users could potentially modify unintended fields by adding extra parameters to HTTP requests. Setting Up Fillable Attributes First, create a model using Artisan command ? Run the following command to create a Student ...

Read More

Does Ternary operation exist in MySQL just like C or C++?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 192 Views

Yes, ternary operation exists in MySQL using the CASE WHEN statement, which provides similar conditional logic to the ternary operator in C/C++. Let us first examine how the ternary operator works in C and then see its MySQL equivalent. Syntax C Ternary Operator: condition ? value_if_true : value_if_false MySQL Equivalent: CASE WHEN condition THEN value_if_true ELSE value_if_false END Example: C Ternary Operator Here is a complete C program demonstrating the ternary operator − #include int main() { int X = 5; ...

Read More

How to validate an array in Laravel?

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

In Laravel, you can validate array data using the built−in Validator class. This is essential for ensuring data integrity before processing user input or form submissions. To use Laravel's validation features, ensure you have Laravel installed and include the Validator facade in your controller. use Illuminate\Support\Facades\Validator; Validating Associative Arrays When working with associative arrays, you define validation rules for each key. Here's how to validate an array with firstname, lastname, and address fields ? Array Validation is Successful Missing Required Fields If a ...

Read More

Why array index starts from zero in C/C++ ?

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

An array arr[i] is interpreted as *(arr+i). Here, arr denotes the address of the first array element or the 0th index element. So *(arr+i) means the element is at i distance from the first element of the array. Therefore, array index starts from 0 as initially i is 0 which means the first element of the array. In this article, we will see examples of C code to understand the reason why an array starts from index 0. Syntax data_type array_name[array_size]; // Accessing element: array_name[index] where index starts from 0 Why Array Index Starts ...

Read More

How to add a new column to an existing table of Laravel in a migration?

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

Laravel migrations provide a convenient way to modify your database schema over time. The make:migration Artisan command enables you to add new columns to existing tables without affecting existing data. Creating an Initial Table First, let's create a basic table using the migration command. The syntax for creating a new table is ? php artisan make:migration create_students_table This generates a migration file in the database/migrations directory ?

Read More
Showing 22031–22040 of 61,297 articles
Advertisements