Ankith Reddy has Published 996 Articles

Concatenate strings from two fields into a third field in MongoDB?

Ankith Reddy

Ankith Reddy

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

1K+ Views

To concatenate strings from two fields into a third field, you can use the following syntaxdb.yourCollectionName.aggregate(    [       { $project: { "yourNewFieldName": { $concat: [ "$yourFieldName1", " yourDellimiterValue ", "$yourFieldName2" ] } } }    ] );Let us first create a collection with documents>db.concatenateStringsDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Doe"}); {   ... Read More

Create Ennead Tuple from an array in Java

Ankith Reddy

Ankith Reddy

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

126 Views

To create Ennead Tuple from an array, use the fromArray() method. Using this method, create an Ennead Tuple using arrays in Java.Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following package.import org.javatuples.Ennead;Note Download JavaTuples Jar ... Read More

Ternary Operator in Python?

Ankith Reddy

Ankith Reddy

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

11K+ Views

Many programming languages support ternary operator, which basically define a conditional expression.Similarly the ternary operator in python is used to return a value based on the result of a binary condition. It takes binary value(condition) as an input, so it looks similar to an “if-else” condition block. However, it also ... Read More

Order by a function of two columns in a single MySQL query

Ankith Reddy

Ankith Reddy

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

131 Views

Let us first create a tablemysql> create table orderByAFunctionDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstNumber int,    -> SecodNumber int    -> ); Query OK, 0 rows affected (0.44 sec)Insert some records in the table using insert command. The query is ... Read More

What do the id and scope attribute mean in the action elements in JSP?

Ankith Reddy

Ankith Reddy

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

455 Views

These are two attributes that are common to all Action elements: the id attribute and the scope attribute.Id attributeThe id attribute uniquely identifies the Action element and allows the action to be referenced inside the JSP page. If the Action creates an instance of an object, the id value can ... Read More

Counters in Python?

Ankith Reddy

Ankith Reddy

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

4K+ Views

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 ... Read More

8085 program to count the number of ones in contents of register B

Ankith Reddy

Ankith Reddy

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

3K+ Views

In this program, we will see how to count the number of 1’s in an 8-bit number stored in register B.Problem StatementWrite 8085 Assembly language program to count the number of 1s in 8-bit number stored in register B.DiscussionIn this program, we are using the rotate operation to count the ... Read More

8085 Program to Subtract two multi-Byte numbers

Ankith Reddy

Ankith Reddy

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

2K+ Views

Now let us see a program of Intel 8085 Microprocessor. This program is mainly for subtracting multi Byte numbers.Problem Statement:Write 8085 Assembly language program to add two multi-Byte numbers.Discussion:We are using 3-Byte numbers. The numbers are stored into the memory at location 8001H and 8004H. One additional information is stored ... Read More

MySQL select count by value?

Ankith Reddy

Ankith Reddy

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

137 Views

You can use COUNT() function for this. Let us first create a demo tablemysql> create table countValueDemo -> ( -> ShippingDatetime datetime, -> FirstValue int, -> SecondValue int -> ); Query OK, 0 rows affected ... Read More

C++ Program to Implement a Binary Search Algorithm for a Specific Search Sequence

Ankith Reddy

Ankith Reddy

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

521 Views

In this Program we need to implement binary search to find the existence of a search sequence in an array. The time complexity of Binary search is O(log(n)).Required steps and pseudocodesBegin    BinarySearch() function has ‘arr’ the array of data and ‘n’ the number of values, start and end index, ... Read More

Advertisements