How MongoDB Indexes Arrays

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

185 Views

MongoDB indexes every value of an array so that you can query for single elements.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.indexingForArrayElementDemo.insertOne({"StudentFavouriteSubject":["MongoDB", "MySQL"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8acdca6cea1f28b7aa0816") }Display all documents from a collection with the help of find() method. The query is as follows −> db.indexingForArrayElementDemo.find().pretty();The following is the output −{    "_id" : ObjectId("5c8acdca6cea1f28b7aa0816"),    "StudentFavouriteSubject" : [       "MongoDB",       "MySQL"    ] }Here is the query by which MongoDB index ... Read More

Webcam Motion Detector Program in Python

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

395 Views

In this we are going to write python program which is going to analyse the images taken from the webcam and try to detect the movement and store the time-interval of the webcam video in a csv file.Required LibraryWe are going to use the OpenCV & pandas library for that. If it’s not already installed, you can install it using pip, with something like:$pip install opencv2, pandasExample Code#Import required libraries import cv2 import pandas as pd import time from datetime import datetime #Initialise variables stillImage = None motionImage = [ None, None ] time = [] # Initializing ... Read More

Implement Hash Tables with Linear Probing in C++

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

10K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.Linear probing is a collision resolving technique in Open Addressed Hash tables. In this method, each cell of a hash table stores a single key–value pair. If a collision is occurred by mapping a new key to a cell of the hash table that is already occupied by another key. This method searches the table for the following closest free location and inserts the ... Read More

Scroll to Top in RecyclerView with LinearLayoutManager

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

167 Views

Before getting into example, we should know what is Recycler view in android. Recycler view is more advanced version of list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrate about how to Scroll top in RecyclerView with LinearLayoutManager by creating a beautiful student records app that displays student name with age.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 − Open build.gradle and add Recycler view & ... Read More

Send Data to Previous Activity in Android

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

2K+ Views

This example demonstrate about How to send data to previous activity 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 com.example.myapplication; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    private final static int MY_REQUEST_CODE = 1;    TextView textView;   ... Read More

Get Device Make and Model on iOS

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

3K+ Views

When we talk about the device make, we refer to the Phone manufacturer (e.g. Apple, Samsung, Nokia and so on) and device model is generally the specific product such as iPhone, iPad/TAB etc.Any mobile devices will be categorized using make and model only.Now let’s understand how do I get device make and model in iOS?There are two ways to get make and model the first way is to directly open your iOS device, navigate to setting, tap on general and in the about section you can find the details of your iOS deviceThe second way is getting make and model ... Read More

Display Message from a Stored Procedure

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

6K+ Views

To display message from stored procedure on the basis of conditions, let us use IF-ELSE condition −mysql> DELIMITER // mysql> CREATE PROCEDURE showMessage(value int, Name varchar(20))    BEGIN       IF(value > 100) then          SELECT CONCAT("HELLO", " ", Name);       ELSE          SELECT CONCAT("BYE", " ", Name);       END IF;       END       // Query OK, 0 rows affected (0.18 sec) mysql> DELIMITER ;Case 1 − Call the stored procedure using CALL command, when value is more than 100 −call showMessage(200, 'John');This will produce ... Read More

Run Entire 8085 Program in a Single Operation

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

349 Views

In a single operation, we can run the entire program of 8085. We run the entire program in this mode so that we can get the accurate results. If the process is unsuccessful a single-stepping by the entire program is attempted.We type ‘G’ at the prompt ‘>’. By noticing the absence of change of address after G. The prompting of the system are as follows:The address of starting is: xxxx - yy/where the memory address is xxxx and the content of the memory location is yy. Which allows the user for responding with the desired address of starting. If ... Read More

Action Taken by 8085 When INTR Pin is Activated

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

335 Views

We have assumed that the interrupt system gets enabled by using the EI instruction, and the signals which have higher priority are not in active state.In the penultimate clock cycle of the last machine cycle of every instruction, the 8085 senses all the internal interrupt signals.If the INTR internal signal which is at logic 1, the 8085 enters to a machine cycle which is called interrupt acknowledge (INA) machine cycle.The interrupts from the Input Output port gets acknowledged by the 8085 by the activation of INTA* pin in the T2 state of the machine cycle INA where INTA* is a ... Read More

Drop Table in Android SQLite

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

2K+ Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrates How to drop table in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a ... Read More

Advertisements