George John has Published 1167 Articles

Dynamically change TableView Cell height in Swift

George John

George John

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

6K+ Views

To change the height of tableView cell in ios dynamically, i.e resizing the cell according to the content available, we’ll need to make use of automatic dimension property. We’ll see this with the help of an sample project.Create an empty project and go to it’s viewController class, conform it to ... Read More

IntStream min() method in Java

George John

George John

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

359 Views

The IntStream min() method in the Java IntStream class is used to get the minimum element from the stream. It returns an OptionalInt describing the minimum element of this stream, or an empty optional if this stream is empty.The syntax is as followsOptionalInt min()Here, OptionalInt is a container object which ... Read More

Clearing items in a nested MongoDB array?

George John

George John

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

84 Views

To clear items in a nested array, use the $set operator. Let us first create a collection. Following is the query to create a collection with documents> db.clearingItemsInNestedArrayDemo.insertOne( { ... ...    "StudentName" : "John", ...    "StudentDetails" : [ ...       { ...         ... Read More

Calculate total time duration (add time) in MySQL?

George John

George John

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

1K+ Views

To calculate the total time duration in MySQL, you need to use SEC_TO_TIME(). Let us see an example by creating a tablemysql> create table AddTotalTimeDemo - > ( - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > LoginTime time ... Read More

IntStream average() method in Java

George John

George John

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

10K+ Views

The average() method of the IntStream class in Java returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty. It gets the average of the elements of the stream.The syntax is as followsOptionalDouble average()Here, OptionalDouble is a container object ... Read More

The set() method of CopyOnWriteArrayList in Java

George John

George John

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

75 Views

The set() method of the CopyOnWriteArrayList class is used to replace the element at the specified position in this list with the specified element. It returns the element that gets replaced.The syntax is as followspublic E set(int index, E ele)Here, the parameter index is the index of the element to ... Read More

How to get default phone IMEI in android?

George John

George John

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

435 Views

This example demonstrate about How to get default phone IMEI in android.Step 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.     In the ... Read More

How to create an index with MongoDB?

George John

George John

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

123 Views

To create an index in MongoDB, use the ensureIndex() method. Let us first create a collection using following query> db.createCollection(&qu/ot;creatingUniqueIndexDemo"); { "ok" : 1 }Following is the query to create an index on the above collection:> db.creatingUniqueIndexDemo.ensureIndex({"UserCountryName":1}, {unique:true}); {    "createdCollectionAutomatically" : false,    "numIndexesBefore" : 1,    "numIndexesAfter" : ... Read More

Add a positive integer constraint to an integer column in MySQL?

George John

George John

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

1K+ Views

You need to use unsigned for this because it won’t allow you to enter a negative number.The syntax is as followsCREATE TABLE yourTableName ( yourColumnName INT UNSIGNED );To understand the concept, let us create a table. The query to create a table is as followsmysql> create table ... Read More

C++ Program to Implement Binary Heap

George John

George John

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

4K+ Views

A Binary Heap is a complete binary tree which is either Min Heap or Max Heap. In a Max Binary Heap, the key at root must be maximum among all keys present in Binary Heap. This property must be recursively true for all nodes in that Binary Tree. Min Binary ... Read More

Advertisements