AUTO_INCREMENT in MySQL can be signed by default?

Rama Giri
Updated on 30-Jul-2019 22:30:26
Yes, the AUTO_INCREMENT in MySQL will be signed (Positive and Negative Value both) by default.Let us first create a table −mysql> create table DemoTable    -> (    -> MyNumber int AUTO_INCREMENT PRIMARY KEY    -> ); Query OK, 0 rows affected (0.45 sec)Insert some records in the table using insert command. Here, we have set negative values as well for AUTO_INCREMENT column −mysql> insert into DemoTable values() ; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(-100); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(-300); Query OK, 1 row affected ... Read More

C++ Program for Smallest K digit number divisible by X?

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26
In this problem we will try to find smallest K-digit number, that will be divisible by X. To do this task we will take the smallest K digit number by this formula (10^(k-1)). Then check whether the number is divisible by X or not, if not, we will get the exact number by using this formula.(min+ 𝑋)−((min+ 𝑋) 𝑚𝑜𝑑 𝑋)One example is like a 5-digit number, that is divisible by 29. So the smallest 5-digit number is 10000. This is not divisible by 29. Now by applying the formula we will get −(10000+ 29)−((10000+29) 𝑚𝑜𝑑 29)=10029−24=10005The number 10005 is divisible ... Read More

HTML DOM Legend form Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26
The HTML DOM Legend form property returns the reference of enclosing form for Legend tag.SyntaxFollowing is the syntax −Returning reference to the form objectlegendObject.formExampleLet us see an example for Legend form property − Live Demo Legend form    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Legend-form Examination Week:    var divDisplay = document.getElementById("divDisplay");    var legendForm = document.getElementById("legendForm");    function showExamination() {       divDisplay.textContent = 'Examinations: '+legendForm.form.id;    } OutputThis will produce the following output −Before clicking ‘What exams are in this week?’ button −After checking ‘What exams are in this week?’ button −

How to convert string Stream to join them in Java?

Nancy Den
Updated on 30-Jul-2019 22:30:26
Let us create string Stream:Stream stream = Stream.of("Bing Bang Theory", "Vampire Diaries", "Game of Thrones", "Homecoming");Convert the above string stream and join them with Collectors:final String str = stream.collect(Collectors.joining(" "));The following is an example to convert string Stream to join them:Exampleimport java.util.stream.Collectors; import java.util.stream.Stream; public class Demo {    public static void main(String[] args) {       Stream stream = Stream.of("Bing Bang Theory", "Vampire Diaries", "Game of Thrones", "Homecoming");       final String str = stream.collect(Collectors.joining(" "));       System.out.println("Join result...\n"+str);    } }OutputJoin result... Bing Bang Theory Vampire Diaries Game of Thrones HomecomingRead More

What happens when JDialog is set with Modality type APPLICATION_MODAL

Krantik Chavan
Updated on 30-Jul-2019 22:30:26
The JDialog Modality type APPLICATION_MODAL blocks all top-level windows and it has restrictions. The following is an example to set JDialog with Modality type APPLICATION_MODAL:Exampleimport java.awt.Cursor; import java.awt.Dialog.ModalityType; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setSize(new Dimension(600, 400));       JDialog dialog = new JDialog(frame, "New", ModalityType.APPLICATION_MODAL);       dialog.setSize(300, 300);       frame.add(new JButton(new AbstractAction("Click to generate") {          @Override          public void ... Read More

How to start an activity when user clicks a notification in Android?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26
This example demonstrate about How to start an activity when user clicks a notification in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {   ... Read More

Write the importance of shift() method in javascript array?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26
 Shift() This method is used to remove the element from an array.Moreover it is different from pop() because shift() method removes the element at the starting of the array. Live DemoExample var a = [1,2,3,4,5]; var b = ["apple","mango","banana","guava","strawberry"] a.shift(); b.shift(); document.write(a); document.getElementById("shift").innerHTML = b; Outputmango,banana,guava,strawberry 2,3,4,5

What is Proxy Class in C++?

Chandu yadav
Updated on 30-Jul-2019 22:30:26
Here we will see what is the proxy class in C++. The Proxy class is basically the Proxy design pattern. In this pattern an object provides a modified interface for another class. Let us see one example.In this example, we want to make an array class, that can store only binary values [0, 1]. This is the first try.Example Codeclass BinArray {    int arr[10];    int & operator[](int i) {       //Put some code here    } };In this code, there is no condition checking. But we want the operator[] to complain if we put something like ... Read More

How to set Row Header View for JScrollPane in Java?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26
Set Row Header View using the setRowHeaderView() method. Let us first create a KScrollPane and set a list −List myList = new ArrayList(10); for (int index = 0; index < 20; index++) {    myList.add("List Item " + index); } final JList list = new JList(myList.toArray(new String[myList.size()])); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(list);Now, set the row header view −scrollPane.setRowHeaderView(new JLabel("All List Items "));The following is an example to set row header view for JScrollPane in Java −Examplepackage my; import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; public class SwingDemo {    public ... Read More

Add MD5 hash value to MongoDB collection?

Anvi Jain
Updated on 30-Jul-2019 22:30:26
To add MD5 hash value, use hex_md5(). Let us first create a collection with documents −>db.addMd5HashValueDemo.insertOne({"UserName":"Adam", "UserPassword":"Adam123456"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6a4c66d78f205348bc619") } >db.addMd5HashValueDemo.insertOne({"UserName":"Chris", "UserPassword":"Chris_121#"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6a4e46d78f205348bc61a") }Following is the query to display all documents from a collection with the help of find() method −> db.addMd5HashValueDemo.find();This will produce the following output −{ "_id" : ObjectId("5cd6a4c66d78f205348bc619"), "UserName" : "Adam", "UserPassword" : "Adam123456" } { "_id" : ObjectId("5cd6a4e46d78f205348bc61a"), "UserName" : "Chris", "UserPassword" : "Chris_121#" }Following is the query to add md5 hash value to mongo collection −> db.addMd5HashValueDemo.find().forEach( function(documentPass){    documentPass.Value ... Read More
Advertisements