regex_error in C++

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

159 Views

The regex library has different methods and features related to regular expressions. Here we will see some regex_errors. These are also present at regex library. During executing some regular expressions, we get some errors. That errors are mentioned here.FlagsErrorserror_collateIn the Regex, the names having invalid collation.error_ctypeIn the Regex, there is an invalid character class name.error_stackNot enough memory to determine regex can be matched or not.error_spaceConvert into Finite State Machine, when memory is insufficienterror_badrepeatThe string has repeat specifier ( *?+{) that was not preceded by a valid regular expression.error_complexityThe complexity of an attempted match against a regex exceeded a pre-set levelerror_rangeContaining ... Read More

How to write your own header file in C?\

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

14K+ Views

Here we will see how to create own header file using C. To make a header file, we have to create one file with a name, and extension should be (*.h). In that function there will be no main() function. In that file, we can put some variables, some functions etc.To use that header file, it should be present at the same directory, where the program is located. Now using #include we have to put the header file name. The name will be inside double quotes. Include syntax will be look like this.#include”header_file.h”Let us see one program to get the ... Read More

Java Connection getAutoCommit() method with example

Rishi Raj
Updated on 30-Jul-2019 22:30:26

488 Views

If you commit a database, it saves all the changes that have been done till that particular point. By default, some databases commits/saves the changes done automatically. You can turn off/on the auto-commit using the setAutoCommit() method of the Connection interface.The getAutocommit() method of the Connection interface is used to get the current value of the auto-commit in this connection.To get the auto-commit value −Register the driver using the registerDriver() method of the DriverManager class as −//Registering the Driver DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get the connection using the getConnection() method of the DriverManager class as −//Getting the connection String url = "jdbc:mysql://localhost/mydatabase"; Connection con ... Read More

Query MongoDB collection starting with _?

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

121 Views

For MongoDB collection beginning with_, following is the syntax −db.createCollection(‘_yourCollectionName’);Insert query using below syntax −db.getCollection('_yourCollectionName').insertOne({"yourFieldName1":"yourValue1", "yourFieldName2":yourValue2, ............N});Let us first create a collection with documents −> db.createCollection('_testUnderscoreCollectionDemo'); { "ok" : 1 } >db.getCollection('_testUnderscoreCollectionDemo').insertOne({"StudentFirstName":"John", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccfb4a6140b992277dae0e4") } >db.getCollection('_testUnderscoreCollectionDemo').insertOne({"StudentFirstName":"Carol", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccfb4af140b992277dae0e5") }Following is the query to display all documents from a collection with the help of find() method −> db.getCollection('_testUnderscoreCollectionDemo').find().pretty();This will produce the following output −{    "_id" : ObjectId("5ccfb4a6140b992277dae0e4"),    "StudentFirstName" : "John",    "StudentAge" : 23 } {    "_id" : ObjectId("5ccfb4af140b992277dae0e5"),   ... Read More

What are the differences between an Exception class and an Error class in Java?\

raja
Updated on 30-Jul-2019 22:30:26

551 Views

Both an Exception class and an Error class are subclasses of java.lang.Throwable class, we can able to handle the exceptions at runtime but the errors we cannot handle.Exceptions are the objects representing the logical errors that occur at the run time and makes JVM enters into the state of "ambiguity".The objects which are automatically created by the JVM for representing these run time errors are known as an Exception. An Error is a subclass of Throwable class that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.If an exception occurs we ... Read More

Set the location of component in a GridBagLayout with Java

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

356 Views

To set the location of component, use the GridBagConstraints. Here, we have two components −GridBagConstraints gbc = new GridBagConstraints(); JLabel label = new JLabel("Email-Id − "); JTextArea text = new JTextArea(); text.setText("Add id here...");Set the location with gridx and gridy −gbc.gridx = 0; gbc.gridy = 0; layout.setConstraints(label, gbc); panel.add(label);The following is an example to set the location of component in a GridBagLayout −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Demo Frame");     ... Read More

Can we update a row with the highest ID in a single MySQL query?

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

167 Views

Yes, we can do that. Let us first create a table −mysql> create table DemoTable    (    ID int,    GameScore int    ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(15, 848747); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(13, 909049); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(34, 98474646); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(31, 948474); Query OK, 1 row affected (0.27 sec)Display all records from the table using select statement ... Read More

How to Create and Assign Lists in Python?

Sri
Sri
Updated on 30-Jul-2019 22:30:26

2K+ Views

We can Create and Assign List by Insert, Append Length, Index, Remove and Extend, etc.. Lists are mutable and the changeble object is enclosed within the square brackets i.e [ ], Lists in python is easy.Examplelist =["Tutorials ", "Point", "Pvt", "Ltd"] listOutput['Tutorials ', 'Point', 'Pvt', 'Ltd'] Assign Values in Lists To assign values in lists, use square bracketsExamplelist1 = ['physics', 'chemistry', 1997, 2000]; list2 = [1, 2, 3, 4, 5, 6, 7 ]; print ("list1[0]: ", list1[0]) print ("list2[1:5]: ", list2[1:5])When the above code is executed, Following is the preceding outputOutputlist1[0]: physics list2[1:5]: [2, 3, 4, 5]append() and extend() in python append add ... Read More

C++ tricks for competitive programming (for C++ 11)?

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

210 Views

Here we will see some good tricks of C++ programming language that can help us in different area. Like if we want to participate in some competitive programming events, then these tricks will help us to reduce the time for writing codes. Let us see some of these examples one by one.Checking whether a number is odd or even without using % operator. This trick is simple. We can perform bitwise AND operation with the number and 1. If the result is non-zero then this is odd, otherwise this is even. The logic is too simple. All odd numbers have ... Read More

What does buffer flush means in C++ ?

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

1K+ Views

The buffer flush is used to transfer of computer data from one temporary storage area to computers permanent memory. If we change anything in some file, the changes we see on the screen are stored temporarily in a buffer.In C++, we can explicitly have flushed to force the buffer to be written. If we use std::endl, it adds one new line character, and also flush it. If this is not used, we can explicitly use flush. In the following program at first no flush is used. Here we are trying to print the numbers, and wait for one seconds. For ... Read More

Advertisements