Java ResultSetMetaData isAutoIncrement() method with example

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

186 Views

The is AutoIncrement() method of the ResultSetMetaData (interface) determines whether a particular column in the current ResultSet object is automatically numbered.This method accepts an integer value representing the index of a column and, returns a boolean value which is −True, if the specified column is automatically numbered.False, if the specified column is not automatically numbered.To get the ResultSetMetaData object, you need to −Register the Driver: Select the required database register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by ... Read More

Iterate a cursor and print a document in MongoDB?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

211 Views

For this, use printjson. Let us first create a collection with documents −> db.cursorDemo.insertOne({"StudentFullName":"John Smith", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc7f0d08f9e6ff3eb0ce442") } > db.cursorDemo.insertOne({"StudentFullName":"John Doe", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc7f0df8f9e6ff3eb0ce443") } > db.cursorDemo.insertOne({"StudentFullName":"Carol Taylor", "StudentAge":20}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc7f0eb8f9e6ff3eb0ce444") } > db.cursorDemo.insertOne({"StudentFullName":"Chris Brown", "StudentAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc7f0f88f9e6ff3eb0ce445") }Following is the query to display all documents from a collection with the help of find() method −> db.cursorDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cc7f0d08f9e6ff3eb0ce442"),    "StudentFullName" : "John ... Read More

Listing modified, old and newly created files on Linux using C++

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

195 Views

Here we will see how to list the modified files and old and newly created files on Linux platform using C++ program.The task is very simple. We can use the Linux shell command to get the files in desired order. The ls –l command is used to get all of the files in long listing format. Here we will add more options to sort them based on time. (Ascending and Descending). The –t command is used to sort based on time, and –r can be added to reverse the sequence.The command will be like below:ls –lt ls –ltrWe will use ... Read More

Calculate the average value in a MongoDB document grouping by null?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

250 Views

You can use $group operator with _id: null. Following is the syntax −db.yourCollectionName.aggregate([{$group: {_id:null, "anyFieldName": {$avg:"$yourFieldName"} } }]);Let us first create a collection with documents −> db.caculateTheAverageValueDemo.insertOne({"Population":100}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68a197924bb85b3f4895f") } > db.caculateTheAverageValueDemo.insertOne({"Population":500}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68a1c7924bb85b3f48960") } > db.caculateTheAverageValueDemo.insertOne({"Population":200}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68a237924bb85b3f48961") } > db.caculateTheAverageValueDemo.insertOne({"Population":100}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68a297924bb85b3f48962") } > db.caculateTheAverageValueDemo.insertOne({"Population":100}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68a2e7924bb85b3f48963") }Following is the query to display all documents from a collection with the help of find() ... Read More

HTML Tag

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

138 Views

The tag in HTML is used to set a part of text as italic. The usage of tag should only be considered if you do not have the following semantic elements − ,, , etc.Let us now see an example to implement the tag −Example Live Demo HTML i tag           Products        The products includes Clothing, Accessories and Furniture to be delivered by FDX couriers. OutputIn the above example, we have used a tag to add content −The products includes Clothing, Accessories and Furniture to be delivered by FDX couriers.We have set the tag above −FDX

What is variable shadowing in java?

Venkata Sai
Updated on 30-Jul-2019 22:30:26

4K+ Views

In Java you can declare three types of variables namely, instance variables, static variables and, local variables.Local variables − Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and the variable will be destroyed when the method has completed.Instance variables − Instance variables are variables within a class but outside any method. These variables are initialized when the class is instantiated. Instance variables can be accessed from inside any method, constructor or blocks of that particular class.Class (static) variables − Class variables are variables declared within a class, ... Read More

HTML DOM Input Email size Property

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

58 Views

The HTML DOM Input Email size property returns/sets the size property for input Email. If not defined, this property returns ‘20’.SyntaxFollowing is the syntax −Returning size attributeinputEmailObject.sizeSet size property to a numberinputEmailObject.size = numberExampleLet us see an example of Input Email size property − Live Demo Input Email size    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } ... Read More

Print a number 100 times without using loop, recursion and macro expansion in C

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

374 Views

In this section we will see how to print a number 100 times in C. There are some constraints. We cannot use loops, recursions or macro expansions.To solve this problem we will use the setjump and longjump in C. The setjump() and longjump() is located at setjmp.h library. The syntax of these two functions are like below.Example#include #include jmp_buf buf; main() {    int x = 1;    setjmp(buf); //set the jump position using buf    printf("5"); // Prints a number    x++;    if (x

Can we get the supported image types in Java

Krantik Chavan
Updated on 30-Jul-2019 22:30:26

65 Views

Yes, we can get the supported image types with ImageIO class in Java. The following is an example to get supported image types in Java:Examplepackage my; import javax.imageio.ImageIO; public class SwingDemo {    public static void main(String[] args) throws Exception {       String[] imgTypes = ImageIO.getReaderFileSuffixes();       System.out.print("Supported Image Types = ");       for (String type : imgTypes) {          System.out.print("" + type);       }    } }OutputSupported Image Types = jpg tif tiff bmp gif png wbmp jpeg

Custom Notification Sounds for Android Oreo and Beyond?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about Custom Notification Sounds for Android Oreo and BeyondStep 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 a sound into raw folderStep 4 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.content.ContentResolver ; import android.content.Context ; import android.graphics.Color ; import android.media.AudioAttributes ; import android.net.Uri ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; ... Read More

Advertisements