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
Articles by Chandu yadav
Page 5 of 81
filter_list() function in PHP
The filter_list() function is used to list all supported filters.Syntaxfilter_list()ReturnThe filter_list() function returns an array of filters available. It returns an empty array if there are no filters.ExampleOutputThe following is the output.int257 boolean258 float259 validate_regexp272 validate_domain277 validate_url273 validate_email274 validate_ip275 validate_mac276 string513 stripped513 encoded514 special_chars515 full_special_chars522 unsafe_raw516 email517 url518 number_int519 number_float520 magic_quotes521 callback1024
Read MoreString Operations in Python\\n
In python, there is a standard library, called string. In the string module, there are different string related constants, methods, classes are available. To use these modules, we need to import the string module in our code. import string Some string constants and their corresponding values are as follows − Sr.No. String Constant & Values into it 1 string.ascii_lowercase'abcdefghijklmnopqrstuvwxyz' 2 string.ascii_uppercase'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 3 string.ascii_lettersConcatenation of asci_lowwecase and ascii_uppercase 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' 4 string.digits'0123456789' 5 string.hexdigits'0123456789abcdefABCDEF' 6 string.octdigits'01234567' 7 string.punctuation'!"#$%&'()*+, -./:;?@[\]^_`{|}~' ...
Read MoreFILTER_VALIDATE_BOOLEAN constant in PHP
The FILTER_VALIDATE_BOOLEAN constant validates value as a boolean option.ReturnThe FILTER_VALIDATE_BOOLEAN constant returns TRUE for "1", "true", "on" and "yes". It returns FALSE for "0", "false", "off" and "no" otherwise, NULL.ExampleOutputThe following is the output.bool(true)ExampleLet us see another example.OutputHere is the output.bool(false)
Read MoreSchedule a task for execution in Java
One of the methods in the Timer class is the void schedule(Timertask task, Date time) method. This method schedules the specified task for execution at the specified time. If the time is in the past, it schedules the task for immediate execution.Declaration −The java.util.Timer.schedule(Timertask task, Date time) is declared as follows −public void schedule(Timertask task, Date time)There are few exceptions thrown by the schedule(Timertask task, Date time) method. They are as follows −IllegalArgumentExceptionThis exception is thrown if time.getTime() is negativeIllegalStateExceptionThis exception is thrown if task was scheduled or cancelled beforehand, timer was cancelled, or timer thread terminated.NullPointerExceptionThis exception is thrown ...
Read MoreFILTER_VALIDATE_IP constant in PHP
The FILTER_VALIDATE_IP constant validates an IP address. Flags FILTER_FLAG_IPV4 − The value must be a valid IPv4 address FILTER_FLAG_IPV6 − The value must be a valid IPv6 address FILTER_FLAG_NO_PRIV_RANGE − The value must not be within a private range FILTER_FLAG_NO_RES_RANGE − The value must not be within a reserved range Return The FILTER_VALIDATE_IP constant does not return anything. Example The following is the output. Invalid IP address! Let us see another example. Here is the output. Valid IP address!
Read MoreComparing enum members in C#
To compare enum members, use the Enum.CompareTo() method.Firstly, set the values for students.enum StudentRank { Tom = 3, Henry = 2, Amit = 1 };Now use the compareTo() method to compare one enum value with another.Console.WriteLine( "{0}{1}", student1.CompareTo(student2) > 0 ? "Yes" : "No", Environment.NewLine );The following is the code to compare enum members in C#.Exampleusing System; public class Demo { enum StudentRank { Tom = 3, Henry = 2, Amit = 1 }; public static void Main() { StudentRank student1 = StudentRank.Tom; StudentRank student2 = StudentRank.Henry; StudentRank student3 ...
Read MoreC# Program to skip elements from a sequence as long as the specified condition is true
Use the SkipWhile() method to skip elements from a sequence as long as the specified condition is true.The following is the array −int[] marks = { 35, 42, 48, 88, 55, 90, 95, 85 };Here is the condition.s => s >= 50As long as the above condition is true, the elements above 50 are skipped as shown below −Exampleusing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] marks = { 35, 42, 48, 88, 55, 90, 95, 85 }; // skips elements above 50 IEnumerable selMarks = marks.AsQueryable().OrderByDescending(s => s).SkipWhile(s => s >= 50); // displays rest of the elements Console.WriteLine("Skipped marks > 60..."); foreach (int res in selMarks) { Console.WriteLine(res); } } }OutputSkipped marks > 60... 48 42 35
Read MoreSchedule a task for execution in Java after a given delay
One of the methods in the Timer class is the void schedule(Timertask task, long delay) method. This method schedules the specified task for execution after the specified delay.Declaration −The java.util.Timer.schedule(Timertask task, long delay) is declared as follows −public void schedule(Timertask task, long delay)There are few exceptions thrown by the schedule(Timertask task, long delay) method. They are as follows −IllegalArgumentExceptionThis exception is thrown if delay is negative, or delay + System.currentTimeMillis() is negative.IllegalStateExceptionThis exception is thrown if task was scheduled or cancelled beforehand, timer was cancelled, or timer thread terminated.NullPointerExceptionThis exception is thrown if the task is null.Let us see a ...
Read MoreSecure Hashes and Message Digest in Python
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 MoreFILTER_SANITIZE_ENCODED constant in PHP
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