Print Characters Without Using Format Specifiers in C

George John
Updated on 30-Jul-2019 22:30:25

809 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.Example Code#include main () { printf("\x41 "); //41 is ASCII of A in Hex printf("\x52 "); //41 is ASCII of A in Hex printf("\x69 ... Read More

Extract Tuples with Specified Common Values in Another Column in MySQL

Samual Sam
Updated on 30-Jul-2019 22:30:25

463 Views

To extract tuples with specified common values, use the following syntax −SELECT DISTINCT aliasName.yourColumnName1, aliasName.yourColumnName2, aliasName1.yourColumnName 1, aliasName1.yourColumnName2 FROM yourTableName aliasName INNER JOIN yourTableName aliasName1 ON aliasName.yourColumnName1 = aliasName1.yourColumnName1 WHERE aliasName.yourColumnName2 = 'value1' AND aliasName1.yourColumnName2 = 'value2';To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table extractTuples    -> (    -> Id int,    -> Name varchar(20),    -> Comments text    -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into ... Read More

Difference Between GET and POST Method in HTTP Protocol

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

579 Views

GET methodThe GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character as follows −http://www.test.com/hello?key1=value1&key2=value2The GET method is the default method to pass information from the browser to the web server and it produces a long string that appears in your browser's Location:box. It is recommended that the GET method is better not used. if you have a password or other sensitive information to pass to the server.The GET method has size limitation: only 1024 characters can be in a request string.This information is passed using ... Read More

Switch Statement in JSP for XPath Expression

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

441 Views

The tag works like a Java switch statement. With this, you can choose between a number of alternatives. Where the switch statement has the case statements, the tag has the tags. In a similar way, a switch statement has the default clause to specify a default action and the tag has the tag as the default clause.AttributeThe tag does not have any attribute.The tag has one attributes which is listed below.The tag does not have any attribute.The tag has the following attributes −AttributeDescriptionRequiredDefaultselectCondition to evaluateYesNoneExample         ... Read More

LocalTime.from() Method in Java

Daniol Thomas
Updated on 30-Jul-2019 22:30:25

80 Views

An instance of a LocalTime object can be obtained from a Temporal object using the from() method in the LocalTime class in Java. This method requires a single parameter i.e. the Temporal object and it returns the LocalTime object that is obtained from the Temporal object.A program that demonstrates this is given as follows:import java.time.*; public class Main {    public static void main(String[] args) {       LocalTime lt = LocalTime.from(ZonedDateTime.now());       System.out.println("The LocalTime is: " + lt);    } }The output of the above program is as follows:The LocalTime is: 10:09:29.696Now let us understand the ... Read More

The isEmpty Method of Java AbstractCollection Class

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

309 Views

The isEmpty() method of the AbstractCollection class checks whether the collection is empty or not i.e. whether it has zero elements. It returns if the Collectionn has no elements.The syntax is as follows −public boolean isEmpty()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is an example to implement AbstractCollection isEmpty() method in Java −Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo {    public static void main(String[] args) {       AbstractCollection absCollection = new ArrayList();       absCollection.add("Laptop");       absCollection.add("Tablet");       absCollection.add("Mobile");       absCollection.add("E-Book ... Read More

Count from Multiple Tables in MySQL

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

13K+ Views

To achieve this for multiple tables, use the UNION ALL.The syntax is as followsselect sum(variableName.aliasName) from    (    select count(*) as yourAliasName from yourTableName1    UNION ALL    select count(*) as yourAliasName from yourTableName2    ) yourVariableName;Let us implement the above syntax. Here, I am using the sample database which has more tables.The two tables we are using areuserdemowheredemoHere is the query to display all records of both the tables. The query is as follows to display records from table ‘userdemo’.mysql> select *from userdemo;The following is the output+--------+----------+------------------+ | UserId | UserName | RegisteredCourse | +--------+----------+------------------+ | 1   ... Read More

Declare Syntax Error in MySQL Workbench

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

3K+ Views

The DECLARE syntax must between BEGIN and END. The syntax is as follows −BEGIN DECLARE yourVariableName1 dataType, DECLARE yourVariableName2 dataType, . . . . ENDHere is the query to avoid DECLARE syntax error in MySQL −mysql> DELIMITER // mysql> create procedure declare_Demo()    -> BEGIN    -> DECLARE Name varchar(100);    -> SET Name: ='John';    -> SELECT Name;    -> END    -> // Query OK, 0 rows affected (0.17 sec) mysql> DELIMITER ;Call the stored procedure with the help of CALL command. The syntax is as follows −CALL yourStoredProcedureName();The query is as follows −mysql> call declare_Demo();The following is ... Read More

Match Max Size Function in C++ STL

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

115 Views

The match max_size() function in C++ STL returns the maximum number of elements in the match_results object that can be held by the match container.This function does not accept a parameter.Example Code Live Demo#include #include using namespace std; int main() {    match_results m;    cout

Query a Key Having Space in Its Name with MongoDB

George John
Updated on 30-Jul-2019 22:30:25

2K+ Views

To query a key having space in its name, you can use dot(.) notation.Step 1: First, you need to create a set in which a key has space in its name. Following is the query:> myValues["Details"] = {} { } > myValues["Details"]["Student Name"]="John"; John > myValues["Details"]["StudentAge"]=26; 26Step 2: Now you need to create a collection and store the above set as a document. Following is the query> db.keyHavingSpaceDemo.insertOne( myValues); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca27e3b6304881c5ce84ba4") }Following is the query to display all documents from a collection with the help of find() method> db.keyHavingSpaceDemo.find().pretty();This will produce the following ... Read More

Advertisements