Server Side Programming Articles

Page 990 of 2109

How to pass a CSRF token with an Ajax request in Laravel?

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

CSRF stands for Cross-Site Request Forgeries. CSRF is a malicious activity performed by unauthorized users acting to be authorized. Laravel protects such malicious activity by generating a csrf token for each active user session that must be included with Ajax requests. Generating CSRF Token You can get the token in two ways − By using $request→session()→token() By using the csrf_token() method directly Example Output The output for above is − 13K625e8mnDna1oxm9rqjfAPfugtTlYdndBoNR4d 13K625e8mnDna1oxm9rqjfAPfugtTlYdndBoNR4d CSRF Token in Blade Template Inside blade template you can make ...

Read More

How to compare two encrypted (bcrypt) passwords in Laravel?

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

In Laravel, you can use the Hash facade to securely work with passwords using bcrypt encryption. The Hash facade provides methods to hash passwords and verify plain text against hashed passwords. Note: This tutorial requires Laravel framework setup. Install Laravel using composer create-project laravel/laravel myapp and configure your environment. Hash Facade Setup To work with the Hash facade, import it in your controller − use Illuminate\Support\Facades\Hash; The hashing configuration is available in config/hashing.php where bcrypt is set as the default driver. Hashing Passwords Use the make() method to hash ...

Read More

Printing Heart Pattern in C

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

In this program we will see how to print heart shaped pattern in C. The heart shape pattern consists of two rounded peaks at the top and an inverted triangle forming the base. *** *** ***** ***** *********** ********* ******* ***** *** * Now if we analyze this pattern, we can find different sections. The base of the heart is an inverted triangle; ...

Read More

fork() in C

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 4K+ Views

In this section we will see what is the fork system call in C. This fork system call is used to create a new process. This newly created process is known as child process. The current process which is creating another child process is called the parent process. A child process uses the same program counter, CPU register, same files that are used by the parent process. Syntax #include #include pid_t fork(void); Return Value The fork() does not take any parameter, it returns integer values. It may return three types ...

Read More

Assertions in C/C++

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 656 Views

An assertion in C is a debugging tool that checks if a condition is true during program execution. When an assertion fails, the program displays an error message and terminates immediately. This helps catch programming errors early in the development process. In C programming, assertions are implemented using the assert() macro defined in the header file. The macro evaluates an expression and aborts the program if the expression is false. Syntax #include assert(expression); Parameters: expression − A condition that should be true. If it evaluates to false (0), the program terminates ...

Read More

How to define a route differently if a parameter is not an integer?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 699 Views

In Laravel routing, you can validate route parameters to ensure they meet specific criteria, such as ensuring a parameter is not an integer. This is accomplished using Laravel's built-in route parameter validation methods. Basic Route Parameters Route parameters are defined within curly braces and can contain alphanumeric characters and underscores ? Route::get('/user/{myid}', function ($myid) { // }); You can also define multiple parameters in a single route ? Route::get('/students/{post}/feedbacks/{feedback}', function ($postId, $feedbackId) { // }); Using where() Method The where() method ...

Read More

Print \"Hello World\" in C/C++ without using header files

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 15-Mar-2026 2K+ Views

In C/C++, we typically use header files to access standard library functions. The printf() function is declared in the "stdio.h" header file and is used to print data to the console. However, it's possible to print "Hello World" without including any header files by declaring the function prototype ourselves. Syntax int printf(const char *format, ...); Method 1: Using printf() Declaration in C In C, we can declare the printf() function prototype directly in our program without including stdio.h. The compiler will link to the standard library automatically − int printf(const char *format, ...

Read More

How to insert raw data in MySQL database in Laravel?

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

In Laravel, you can insert raw data into MySQL database tables using the Query Builder tool. This requires including the Illuminate\Support\Facades\DB facade or adding use DB; at the top of your controller. Prerequisites: Ensure Laravel is installed and a MySQL database connection is configured in your .env file. Assume we have created a table named students using the CREATE statement as shown below − CREATE TABLE students( id INTEGER NOT NULL PRIMARY KEY, ...

Read More

Implement your own itoa() in C

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 2K+ Views

In C programming, the itoa() function converts an integer to a string representation. However, itoa() is not part of the C standard library. Here we'll implement our own version using both the sprintf() approach and a manual conversion method. Syntax char* itoa(int value, char* str, int base); Method 1: Using sprintf() The sprintf() function formats and stores data in a string buffer instead of printing to console − #include #include char* my_itoa_sprintf(int number, char* str) { sprintf(str, "%d", number); return str; ...

Read More

Heap overflow and Stack overflow in C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 6K+ Views

In C programming, memory management involves two primary areas: the heap and the stack. Both can experience overflow conditions that lead to program crashes or undefined behavior. Understanding these overflows is crucial for writing robust C programs. Heap Overflow The heap is a region of memory used for dynamic allocation. Functions like malloc(), calloc(), and realloc() allocate memory from the heap at runtime. Heap overflow occurs when the program exhausts available heap memory. This typically happens in two scenarios − Allocating Excessive Memory Attempting to allocate extremely large amounts of memory can cause heap overflow ...

Read More
Showing 9891–9900 of 21,090 articles
« Prev 1 988 989 990 991 992 2109 Next »
Advertisements