Count boolean field values within a single MySQL query?

Samual Sam
Updated on 30-Jul-2019 22:30:25
To count boolean field values within a single query, you can use CASE statement. Let us create a demo table for our example −mysql> create table countBooleanFieldDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentFirstName varchar(20),    -> isPassed tinyint(1)    -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into countBooleanFieldDemo(StudentFirstName, isPassed) values('Larry', 0); Query OK, 1 row affected (0.12 sec) mysql> insert into countBooleanFieldDemo(StudentFirstName, isPassed) values('Mike', 1); Query OK, 1 row affected (0.17 sec) mysql> insert into ... Read More

C++ Program to Check if a Binary Tree is a BST

Samual Sam
Updated on 30-Jul-2019 22:30:25
Binary Search Tree is a binary tree data structure in which we have 3 properties −The left subtree of a binary search tree of a node contains only nodes with keys lesser than the node’s key.The right subtree of a binary search tree node contains only nodes with keys greater than the node’s key.The left and right of a subtree each must also be a binary search tree.AlgorithmBegin    function BSTUtill()       If node is equals to NULL then          Return 1.       If data of node is less than minimum or greater ... Read More

C++ Program to Implement Interval Tree

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
An interval tree is an ordered tree data structure to hold intervals. It specifically allows one to efficiently find all intervals that overlap with any given interval or point. Here is a C++ Program to implement an interval tree.AlgorithmBegin    function insert() is used to insert new nodes into the tree:       If Tree is empty, new node becomes root.          Get low value of interval at root.       If root's low value is smaller, then new interval goes to left subtree.       Else, new node goes to right subtree.   ... Read More

How to add dividers and spaces between items in RecyclerView?

Nitya Raut
Updated on 30-Jul-2019 22:30:25
This example demonstrate about How to add dividers and spaces between items in RecyclerViewStep 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 recycerview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import ... Read More

Insert an element to List using ListIterator in Java

Samual Sam
Updated on 30-Jul-2019 22:30:25
Let us first create an ArrayList −ArrayList < Integer > arrList = new ArrayList < Integer > (); arrList.add(100); arrList.add(200); arrList.add(300); arrList.add(400); arrList.add(500);Now, create a ListIterator from the above ArrayList and insert more elements −ListIterator < Integer > iterator = arrList.listIterator(); iterator.add(1000); iterator.add(2000); iterator.add(3000);Example Live Demoimport java.util.ArrayList; import java.util.ListIterator; public class Demo {    public static void main(String[] args) {       ArrayListarrList = new ArrayList();       arrList.add(100);       arrList.add(200);       arrList.add(300);       arrList.add(400);       arrList.add(500);       arrList.add(600);       arrList.add(700);       arrList.add(800);     ... Read More

Macros and Preprocessors in C

Anvi Jain
Updated on 30-Jul-2019 22:30:25
The C Preprocessor is not a part of the compiler, but is a separate step in the compilation process. In simple terms, a C Preprocessor is just a text substitution tool and it instructs the compiler to do required pre-processing before the actual compilation. We'll refer to the C Preprocessor as CPP.All preprocessor commands begin with a hash symbol (#). It must be the first nonblank character, and for readability, a preprocessor directive should begin in the first column. The following section lists down all the important preprocessor directives −Sr.NoDirectives & Descriptions1#defineSubstitutes a preprocessor macro.2#includeInserts a particular header from another ... Read More

How to initialize private static members in C++?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
Here we will see how to initialize the private static member variables initialization in C++. We can put static members (Functions or Variables) in C++ classes. For the static variables, we have to initialize them after defining the class.To initialize we have to use the class name then scope resolution operator (::), then the variable name. Now we can assign some value.The following code will illustrate the of static member initializing technique.Example#include using namespace std; class MyClass{    private:       static int st_var;    public:       MyClass(){          st_var++; //increase the value ... Read More

Is Flutter a stable platform to develop cross platform application?

Sashi K
Updated on 30-Jul-2019 22:30:25
Flutter is an open source mobile app development kit from Google. It works with the existing code and is an excellent SDK (Software Development Kit) to develop iOS and Android programs. It is cost effective and eases the complexity of developing iOS and Android apps. It is primarily used for creating an application in Google Fuchsia.The main advantage of Flutter is that a lot of code can be shared between platforms. Without writing platform-specific code, the developers can use it to develop applications for Android and iOS alike. Being an Open source SDK, it makes every application look like a ... Read More

Create Septet Tuple in Java

Samual Sam
Updated on 30-Jul-2019 22:30:25
To create a Septet Tuple in Java, use the with() method.Let us first see what we need to work with JavaTuples. To work with Septet class in JavaTuples, you need to import the following package −import org.javatuples.Septet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Septet Class in JavaTuples, then Right Click Project ->Properties ->Java Build Path ->Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Septet; public class Demo { public static void main(String[] args) { ... Read More

How to print julianday in Android sqlite?

Smita Kapse
Updated on 30-Jul-2019 22:30:25
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 demonstrate about How to print julianday in Android sqliteStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More
Advertisements