Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to Add Elements to the End of an Array in PHP
Arrays are linear data structures used to handle data in programming. Sometimes while dealing with arrays we need to add new elements to an existing array. In this article, we will discuss several methods to add elements to the end of an array in PHP, complete with code examples and outputs. Following are different approaches to adding elements to an array − Using Square Brackets [] The simplest way to add an element to the end of an array in PHP is by using square brackets []. This syntax is suitable when you want to add only ...
Read MoreWhat does it mean when a numeric constant in C/C++ is prefixed with a 0?
When a numeric constant in C is prefixed with a 0, it indicates that the number is an octal number (base 8). Octal literals must start with 0 to distinguish them from decimal numbers. For example, the octal number 25 is written as 025 in C. Syntax 0octal_digits Where octal_digits are valid octal digits (0-7). Example: Octal Number Conversion The following program demonstrates how octal literals are converted to decimal values − #include int main() { int a = 025; /* Octal ...
Read MoreHow can I force PHP to use strings for array keys?
In PHP, array keys are automatically converted to integers if they contain numeric values. To force PHP to use strings for array keys, you can use several approaches that ensure all keys remain as strings regardless of their content. Understanding PHP Array Key Behavior By default, PHP automatically converts numeric string keys to integers ? array(3) { [0]=> int(1) [1]=> int(2) [2]=> string(4) "name" } Method 1: Using array_combine() The array_combine() function creates an array using one ...
Read Morewprintf() and wscanf in C Library
In C programming, wprintf() and wscanf() are wide character equivalents of printf() and scanf() functions. These functions handle wide characters and wide strings, making them essential for internationalization and Unicode text processing. Both functions are declared in the wchar.h header file. wprintf() Syntax int wprintf(const wchar_t* format, ...); Parameters format − A pointer to a null-terminated wide string containing format specifiers starting with % ... − Additional arguments corresponding to the format specifiers Return Value Returns the number of wide characters printed on success, or a negative value on failure. ...
Read MoreHow to use PHP in HTML?
To use PHP in HTML, you must enclose the PHP code with PHP start tag . PHP is a server-side scripting language that allows you to embed dynamic content into your HTML pages. PHP (Hypertext Preprocessor) is a popular server-side scripting language used for web development. It allows you to embed dynamic content into your HTML by processing code on the server before delivering the page to the client. Requirements: To run PHP code, you need a web server with PHP installed (like XAMPP, WAMP, or LAMP) since PHP is processed server-side. Basic Syntax ...
Read MoreProgram for Christmas Tree in C
In C programming, creating a Christmas tree pattern involves printing pyramids of various sizes stacked one beneath another. This creates a festive tree-like structure with decorative characters that can simulate twinkling lights through randomization. Syntax void tree_triangle(int start, int end, int total_height); void display_tree(int height); void display_log(int height); Example: Static Christmas Tree Let's start with a basic Christmas tree that displays once − #include #include #include void display_random_leaf() { char type_of_leaves[5] = { '.', '*', '+', 'o', 'O' }; int ...
Read MorePerforming DataBase Operations in XAMPP
Navigating through database operations in XAMPP can be challenging, particularly for beginners. Realizing this complexity, over 15 million active monthly users have turned to XAMPP for its ease of use and flexibility. This article offers a step−by−step guide on performing basic database operations in XAMPP, from data insertion to deletion. Let's take the first stride towards mastering your XAMPP database management skills together! Basic Database Operations in XAMPP Basic Database Operations in XAMPP include performing CRUD operations such as select, insert, update, and delete statements on a MySQL database using PHP. ...
Read MoreWhy strict aliasing is required in C?
Strict aliasing is a critical concept in C that helps prevent undefined behavior when accessing the same memory location through pointers of different types. Understanding why it's required helps write safer and more predictable C code. What is Strict Aliasing? Strict aliasing is a rule that states an object can only be accessed through pointers of compatible types. When this rule is violated, the behavior becomes undefined, leading to unpredictable results. Example: Strict Aliasing Violation Here's an example demonstrating what happens when strict aliasing rules are violated − #include int temp = ...
Read MoreLinear search using Multi-threading in C
Linear search using multi-threading in C involves dividing an array into multiple segments and assigning each segment to a separate thread for searching. This parallel approach can improve search performance on multi-core systems by utilizing multiple CPU cores simultaneously. Syntax pthread_create(&thread_id, NULL, search_function, thread_data); pthread_join(thread_id, NULL); Example To compile and run this program, you need to link with the pthread library using: gcc filename.c -lpthread Here's how to implement multi-threaded linear search where each thread searches a specific portion of the array − #include #include #include ...
Read MoreSetting Up Nginx with MariaDB and PHP/PHP-FPM on Fedora 24 Server and Workstation
Hosting websites and online applications requires setting up a web server infrastructure. In this article, we'll understand how to set up Nginx on Fedora 24 Server and Workstation using MariaDB and PHP/PHP-FPM. This combination creates a powerful LEMP stack for managing databases and serving dynamic content. Note: Fedora 24 is an older version that no longer receives security updates. For production environments, consider using a current Fedora version or other long-term support distributions. Installation Prerequisites Before starting, ensure your system is updated and you have root privileges. We'll install the LEMP stack components step by ...
Read More