- 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
To change the password in MongoDB for existing user, you can use changeUserPassword(). Following is the syntaxdb.changeUserPassword("yourExistingUserName", "yourPassword");Let us first switch the database to admin. Following is the syntax> use adminThis will produce the following outputswitched to db adminNow, display users from the database. Following is the query> db.getUsers();This will produce the following output[
{
"_id" : "admin.John",
"user" : "John",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
],
"mechanisms" : [
"SCRAM-SHA-1",
"SCRAM-SHA-256"
]
}
]Following is the query to change the password for user “John”> db.changeUserPassword("John", "123456");Now the password has been changed with value “123456”.
Updated on 30-Jul-2019 22:30:25
At first, create a character array −static char num[] = { '0', '1', '2', '3', '4', '5' };Now, let’s say you want to a string with length. Create a StringBuilder and use append() to create random numbers string out of it −int len = 5; StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < len; i++) { strBuilder.append(randomNum()); }Above, we created a randomNum() function that returns the random numbers string −public static char randomNum() { return num[(int) Math.floor(Math.random() * 5)]; }Example Live Demopublic class Demo { static char num[] = { '0', '1', '2', '3', ... Read More 
Updated on 30-Jul-2019 22:30:25
Let us see, what is the scanset in C. The scanset is basically a specifier supported by scanf family functions. It is represented by %[]. Inside scanset we can specify only one character or a set of characters (Case Sensitive). When the scanset is processed, the scanf() can process only those characters which are mentioned in the scanset.Example#include int main() { char str[50]; printf("Enter something: "); scanf("%[A-Z]s", str); printf("Given String: %s", str); }OutputEnter something: HElloWorld Given String: HEIt ignores the characters which are written in lowercase letters. The ‘W’ is also ignored because there are some ... Read More 
Updated on 30-Jul-2019 22:30:25
Here we will see what is the reentrant function in C or C++. One function is said to be a reentrant function if there is a provision to interrupt that function in the course of execution, then service the ISR (Interrupt Service Routine) and then resume the task. This type of functions is used in different cases like, recursions, hardware interrupt handling.For a reentrant function there should be some properties. These are listed below −This type of function will not use any global or static variable. There are no restrictions, but it is generally not advised. This is because the ... Read More 
Updated on 30-Jul-2019 22:30:25
You can search between dates stored as varchar using STR_TO_DATE(). The syntax is as follows −select *from yourTableName where STR_TO_DATE(LEFT(yourColumnName, LOCATE('', yourColumnName)), '%m/%d/%Y') BETWEEN 'yourDateValue1' AND 'yourDateValue2’;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table SearchDateAsVarchar -> ( -> Id int NOT NULL AUTO_INCREMENT, -> ShippingDate varchar(100), -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.99 sec)Insert some records in the table using INSERT command. The query is as follows −mysql> insert into SearchDateAsVarchar(ShippingDate) values('6/28/2011 9:58 AM'); Query OK, 1 ... Read More 
Updated on 30-Jul-2019 22:30:25
IR (Instruction Register) is a special purpose register, which is used to receive the 8-bit opcode portion of an instruction. It is not accessible to the programmer. What it means is that there are no instructions by which the programmer can load it with values of his choice. For example, instructions like ‘MOV IR, D’ or ‘MVI IR, 45H’ are not present in the instruction set of 8085. Thus, IR register is not shown in the programmer's view of 8085.Let us consider one example. First of all, PC is loaded with the value 8000H. This is done by typing the ... Read More 
Updated on 30-Jul-2019 22:30:25
This example demonstrate about How to Add One Side Left Border to TextView in Android using XML.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 above code we have taken textview and linear layout. In Linear layout we have added background as text_style. So create a file called text_style.xml in drawable as shown below – ... Read More 
Updated on 30-Jul-2019 22:30:25
To drop a collection in MongoDB, you need to use drop() command. The syntax is as follows:db.yourCollectionName.drop();The above syntax returns true or false. It returns true if the collection is dropped successfully otherwise false.Let us first display all collection names from MongoDB. Here, we have a database ‘sample’ that contains some collections. First you need to switch to the ‘sample’ database. The query is as follows:> use sample; switched to db sampleNow display all collection names with the help of show command. The query is as follows:> show collections;The following is the output:bookInformation userInformationAbove, you can see we have the ... Read More 
Updated on 30-Jul-2019 22:30:25
For this, you need to use an INSERT SELECT statement. The syntax is as followsINSERT INTO yourDatabaseName1.yourTableName1(yourColumnName1, yourColumnName2, ....N) SELECT yourColumnName1, yourColumnName2, ....N FROM yourdatabaseName2.yourTableName2;Here, I am using the following two databasessampletestLet us create the first table in the “test” databasemysql> use test; Database changed mysql> create table send -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20) -> ); Query OK, 0 rows affected (1.19 sec)Insert some records in the first table using insert command. The query is as followsmysql> insert into send(Name) values('John'); Query OK, 1 row affected ... Read More 
Updated on 30-Jul-2019 22:30:25
The tag has similar attributes as that of the tag except for one additional attribute delims which specifies characters to use as delimiters.AttributeDescriptionRequiredDefaultdelimsCharacters to use as delimitersYesNoneExample for
Tag Example
The above code will generate the following result −Zara
nuha
roshyAdvertisements