Articles on Trending Technologies

Technical articles with clear explanations and examples

C# Console.WindowHeight Property

Samual Sam
Samual Sam
Updated on 11-Mar-2026 262 Views

The WindowHeight property gets or sets the height of the console window.Declare a variable.int height;Now, get the height of the current window.height = Console.WindowHeight;The following is the complete example −Exampleusing System; using System.Numerics; using System.Globalization; class Demo {    static void Main() {       int height;       height = Console.WindowHeight;       Console.WriteLine("Current window height = "+height);    } }OutputCurrent window height = 0

Read More

Secure Hashes and Message Digest in Python

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 2K+ Views

For the secure hash and message digest process, we should use the hashlib module. This module implements a common interface for different secure hash algorithm like SHA1, SHA224, SHA256, SHA512 etc. Also the RSA’s MD5 algorithm. Older algorithms are known as the Message Digest and the new methods are called Secure Hash. To use this module, we need to import the hashlib module in the python code. import hashlib In this method, there are some predefined algorithms like md5, sha1, sha224, sha256, sha512 are present. We can add additional algorithms from the OpenSSL library. Some methods, constants of ...

Read More

FILTER_SANITIZE_ENCODED constant in PHP

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 320 Views

The FILTER_SANITIZE_ENCODED constant encodes special characters.Flags and OptionsFILTER_FLAG_STRIP_LOW − Remove characters with ASCII value less than 32FILTER_FLAG_STRIP_HIGH − Remove characters with ASCII value greater than 127FILTER_FLAG_ENCODE_LOW − Encode characters with ASCII value less than 32FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value greater than 127ReturnThe FILTER_SANITIZE_ENCODED constant does not return anything.ExampleThe following is an example that use FILTER_FLAG_ENCODE_HIGH flag to encode characters with ASCII value > 127ExampleOutputThe following is the output.www.example.comLet us see another example.ExampleOutputHere is the output.example.com

Read More

Left pad a string in Java

Sharon Christine
Sharon Christine
Updated on 11-Mar-2026 925 Views

To left pad a string, use the String.format and set the spaces.String.format("|%20s|", "demotext")If you add 30 above, it will display the first string after 30 spaces from the beginning.String.format("|%30s|", "demotext")Examplepublic class Demo {    public static void main(String []args) {       System.out.print(String.format("|%20s|", "demotext"));       System.out.println("Left padded!");    } }Output| demotext|Left padded

Read More

How to schedule tasks in Java to run for repeated fixed-delay execution, beginning at the specified time

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 679 Views

One of the methods in the Timer class is the void schedule(TimerTask task, Date firstTime, long period) method. This method schedules tasks for repeated fixed-delay execution, beginning at the specified time.In fixed-delay execution, each execution is scheduled with respect to the original execution time of the preceding execution. If an execution is delayed for a particular reason (case in point, garbage collection), the subsequent executions will be delayed as well.Declaration −The java.util.Timer.schedule(TimerTask task, Date firstTime, long period) is declared as follows −public void schedule(TimerTask task, Date firstTime, long period)Here, task is the task to be scheduled, firstTime is the first ...

Read More

C# Program to get the difference between two dates in seconds

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 7K+ Views

Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25);Now calculate the difference between two dates.TimeSpan ts = date2 - date1;Move further and calculate the difference in seconds.ts.TotalSecondsLet us see the complete code.Exampleusing System; using System.Linq; public class Demo {    public static void Main() {       DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20);       DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25);       TimeSpan ts = date2 - date1;       Console.WriteLine("No. of Seconds (Difference) = {0}", ts.TotalSeconds);    } }OutputNo. of Seconds (Difference) = 10745

Read More

strcat() vs strncat() in C++

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 817 Views

Both strcat() and strncat() are predefined string functions in C++. Details about these are given as follows.strcat()This function is used for concatenation. It appends a copy of the source string at the end of the destination string and returns a pointer to the destination string. The syntax of strcat() is given as follows.char *strcat(char *dest, const char *src)A program that demonstrates strcat() is given as follows.Example#include #include using namespace std; int main() {    char str1[20] = "Mangoes are ";    char str2[20] = "yellow";    strcat(str1, str2);    cout

Read More

Parsing and Formatting a Byte Array into Binary in Java

Samual Sam
Samual Sam
Updated on 11-Mar-2026 4K+ Views

Set a BigInteger object.BigInteger one;Now, create a ByteArray.byte byteArr[] = new byte[] { 0x1, 0x00, 0x00 }; one = new BigInteger(byteArr);For Binary, we have used 2 as the toString() method parameter.String strResult = one.toString(2);The following is an example −Exampleimport java.math.*; public class Demo {    public static void main(String[] args) {       // BigInteger object       BigInteger one;       byte byteArr[] = new byte[] { 0x1, 0x00, 0x00 };       one = new BigInteger(byteArr);       String strResult = one.toString(2);       System.out.println("ByteArray to Binary = "+strResult);    } }OutputByteArray to Binary = 10000000000000000

Read More

Declare static variables and methods in an abstract class in Java

Rishi Rathor
Rishi Rathor
Updated on 11-Mar-2026 7K+ Views

If a method is declared as static, it is a member of a class rather than belonging to the object of the class. It can be called without creating an object of the class. A static method also has the power to access static data members of the class.A static variable is a class variable. A single copy of the static variable is created for all instances of the class. It can be directly accessed in a static method.An abstract class in Java is a class that cannot be instantiated. It is mostly used as the base for subclasses to ...

Read More

Calculate minutes between two dates in C#

George John
George John
Updated on 11-Mar-2026 21K+ Views

Firstly, set the two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, calculate the difference between two dates.TimeSpan ts = date2 - date1;To calculate minutes.ts.TotalMinutesLet us see the complete code.Exampleusing System; using System.Linq; public class Demo {    public static void Main() {       DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20);       DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);       TimeSpan ts = date2 - date1;       Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes);    } }OutputNo. of Minutes (Difference) = 47699.0833333333

Read More
Showing 9131–9140 of 61,248 articles
« Prev 1 912 913 914 915 916 6125 Next »
Advertisements