- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Updated on 30-Jul-2019 22:30:25
The boxed() method of the LongStream class returns a Stream consisting of the elements of this stream, each boxed to a Long.The syntax is as follows.Stream boxed()Here, Stream represents a sequence of elements. To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create an IntStream and add some elements in a range using the range() method.LongStream intStream = LongStream.range(20800L, 20805L);Now, use the boxed() methodStream s = intStream.boxed();The following is an example to implement LongStream boxed() method in Java.Example Live Demoimport java.util.stream.Stream; import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { LongStream intStream ... Read More 
Updated on 30-Jul-2019 22:30:25
You can use update() function to insert records in MongoDB if it does not exist. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.insertIfNotExistsDemo.insertOne({"StudentName":"Mike", "StudentAge":21}); { "acknowledged" : true, "insertedId" : ObjectId("5c7eec7b559dd2396bcfbfc2") } > db.insertIfNotExistsDemo.insertOne({"StudentName":"Sam", "StudentAge":22}); { "acknowledged" : true, "insertedId" : ObjectId("5c7eec97559dd2396bcfbfc3") }Display all documents from a collection with the help of find() method. The query is as follows −> db.insertIfNotExistsDemo.find().pretty(); The following is the output: { "_id" : ObjectId("5c7eec7b559dd2396bcfbfc2"), "StudentName" : "Mike", "StudentAge" : ... Read More 
Updated on 30-Jul-2019 22:30:25
To achieve this, the following is the syntaxselect date_format(from_unixtime(yourColumnName), '%b %d, %Y %l:%i %p PDT') from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table unixTimeStampFormatDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> MyTimeStampValue bigint -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into unixTimeStampFormatDemo(MyTimeStampValue) values(1334428200); Query OK, 1 row affected (0.20 sec) mysql> insert into unixTimeStampFormatDemo(MyTimeStampValue) values(1513881000); Query OK, 1 row affected (0.15 ... Read More 
Updated on 30-Jul-2019 22:30:25
This is a C++ program to append the content of one text file to another.Inputa.txt file contains “Tutorials” a1.txt file contains “point”OutputTutorialspointAlgorithmBegin Define a fstream class object as fin. Open a input file a.txt with input file stream class object fin. Open a output file a1.txt with output file stream class object fout in append mode. Check if the file is not existing then Print “File not found”. Else append content from fin to fout. Open the destination file in read mode. Display its content as output. End.Example ... Read More 
Updated on 30-Jul-2019 22:30:25
Here is a C++ Program to implement First Fit Decreasing for 1-D objects and M binsRequired functions and pseudocode:Begin function binPack() returns number of bins required. Initialize binC = 0 Initialize an array to store binVal. Place items one by one. function sort() to perform bubble sort in the descending order. EndExample Code#include using namespace std; void binPack(int *a, int s, int n) { int binC = 0; int binVal[n]; for (int i = 0; i < n; i++) binVal[i] = s; for (int i = 0; i < ... Read More 
Updated on 30-Jul-2019 22:30:25
This example demonstrate about How to create our own Listener interface 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. In the above code, we have taken text view to show listener data.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.TextView; public class MainActivity extends FragmentActivity implements sampleInterFace { sampleInterFace interFace; TextView textView; @Override public void onCreate(Bundle savedInstanceState) ... Read More 
Updated on 30-Jul-2019 22:30:25
Let us first create a string array −String[] arr = new String[] { "P", "Q", "R", "S", "T"};Now, calculate the length of the above array and create a new array with the same length −int len = arr.length; String[] arr2 = new String[len];Let us copy one array from another −System.arraycopy(arr, 0, arr2, 0, arr.length);Example Live Demopublic class Demo { public static void main(String[] args) { String[] arr = new String[] { "P", "Q", "R", "S", "T"}; System.out.println("Initial array..."); for (int i = 0; i < arr.length; i++) System.out.println(arr[i]); ... Read More 
Updated on 30-Jul-2019 22:30:25
Here we will see how to generate assembly language output from C or C++ source code using gcc.The gcc provides a great feature to get all intermediate outputs from a source code while executing. To get the assembler output we can use the option ‘-S’ for the gcc. This option shows the output after compiling, but before sending to the assembler. The syntax of this command is like below.gcc –S program.cppNow, let us see how to output will be look like. Here we are using a simple program. In this program two numbers are stored into the variables x and ... Read More 
Updated on 30-Jul-2019 22:30:25
A Counters is a container which keeps track to how many times equivalent values are added. Python counter class is a part of collections module and is a subclass of dictionary.Python CounterWe may think of counter as an unordered collection of items where items are stored as dictionary keys and their count as dictionary value.Counter items count can be positive, zero or negative integers. Though there is no restrict on its keys and values but generally values are intended to be numbers but we can store other object types too.InitializingCounter supports three forms of initialization. Its constructor can be called ... Read More 
Updated on 30-Jul-2019 22:30:25
All over the world, the Greenwich Mean Time (GMT) is followed as the standard time. The Greenwich Meridian which is the Prime Meridian or Longitude Zero degrees marks the starting point of every Time Zone of the time zone map.The clock time at the Royal Observatory in Greenwich, London, is followed as the Greenwich Mean Time or GMT all over the world. Greenwich which is considered as the Prime Meridian has the Sun at its highest point at 1200 noon, exactly above the Greenwich.There are 25 world time zones. If you consider GMT as 0, then each one calculated at ... Read More Advertisements