MySQL Query to Fetch Date with Year and Month

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

360 Views

For year and month date fetching, you can use YEAR() and MONTH() function in MySQL. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime    ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ShippingDate) values('2019-01-31'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(ShippingDate) values('2018-12-01'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable(ShippingDate) values('2019-06-02'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable(ShippingDate) values('2019-11-18'); Query OK, 1 row ... Read More

Create Prufer Code for a Tree in C++

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

835 Views

Prufer code uniquely identifies a tree which is given by user as a graph representation with labels from 1 to p. This tree consist p(value is given by user) labels of node. It has sequence of p – 2 values.AlgorithmBegin    Declare i, j, ver, edg, minimum, p to the integer datatype.    Print “Enter the number of vertexes: ”.    Enter the value of ver.    Initialize edg = ver-1.    Declare EDG[edg][2], DG[ver+1] to the integer datatype.       Initialize DG[ver+1] = {0}.    Print “This tree has (value of edg) edges for (value of ver) vertexes”. ... Read More

HTML DOM Input Checkbox Type Property

Kumar Varma
Updated on 30-Jul-2019 22:30:26

168 Views

The Input Checkbox type property returns/sets type of Input Checkbox.SyntaxFollowing is the syntax −Returning string valueinputCheckboxObject.typeSetting type to string valueinputCheckboxObject.type = stringValueString ValuesHere, “stringValue” can be the following -stringValueDetailscheckboxIt defines that input type is checkboxradioIt defines that input type is radiotextIt defines that input type is textExampleLet us see an example of Input Checkbox type property − Live Demo Type Attribute of Checkbox Other: Change type of input    var typeOfInput = document.getElementById("formCheckbox");    var displayDiv = document.getElementById("displayDiv");    displayDiv.textContent = 'Type of Input: ' + typeOfInput.type function changeType(){       ... Read More

HTML DOM Input Text Size Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

213 Views

The HTML DOM Input Text size property returns/sets the size property for input text. If not defined this property returns ‘20’.SyntaxFollowing is the syntax −Returning size attributeinputTextObject.sizeSet size property to a numberinputTextObject.size = numberExampleLet us see an example of Input Text size property − Live Demo Input Text size    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Text-size ... Read More

Packing and Unpacking Arguments in Python

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

1K+ Views

If you have done little-bit of programming in python, you have seen the word “**args” and “**kwargs” in python functions. But what exactly they are?The * and ** operators did different operations which are complementary to each other depending on where we are using them.So when we are using them in method definition, like -def __init__(self, *args, **kwargs): passAbove operation is called ‘packing” as it pack all the arguments into one single variable that this method call receives into a tuple called args. We can use name other than args, but args is the most common and pythonic way of ... Read More

What are Orphan Blocks?

Prasanna Kotamraju
Updated on 30-Jul-2019 22:30:26

2K+ Views

Block Chain is the most important component of any cryptocurrency network. Cryptocurrency is based on distributed, transparent public ledger where all the transactions ever made on a cryptocurrency are noted in the blocks and added to the block chain. Miners get attractive rewards to verify and create a new block and add it successfully to the Block Chain.Here comes the twist. There will be some blocks which are created, but not accepted by the block chain network. There are called Orphan Blocks. Orphan blocks are verified and valid blocks, but not accepted by the block chain network due to a ... Read More

Get Android Notifications When App is Closed

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

634 Views

This example demonstrate about How to get android notifications when the app was closedStep 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/MainActivitypackage app.tutorialspoint.com.notifyme ; import android.content.Intent ; import android.os.Bundle ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ;       setContentView(R.layout. activity_main ) ... Read More

Must We Implement All Methods in a Class that Implements an Interface in Java

raja
Updated on 30-Jul-2019 22:30:26

9K+ Views

Yes, it is mandatory to implement all the methods in a class that implements an interface until and unless that class is declared as an abstract class.There are only two choices −Implement every method defined by the interface.Declare the class as an abstract class, as a result, forces you to subclass the class (and implement the missing methods) before you can create any objects.The only case the class do not need to implement all methods in the interface is when any class in its inheritance tree has already provided concrete (i.e. non-abstract) method implementations then the subclass is under no ... Read More

Move Horizontal Slider Right to Left in Java

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

221 Views

At first, let us create a horizontal slider −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55);Now, we will set it to move right-to-left using setInverted() −slider.setInverted(true);The following is an example to move the horizontal slider right-to-left −Examplepackage my; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.WindowConstants; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Frame with Slider");       JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55);       slider.setInverted(true);       slider.setMinorTickSpacing(10);       slider.setMajorTickSpacing(25);       slider.setPaintTicks(true);     ... Read More

MongoDB Regex to Display Records Whose First Five Letters Are Uppercase

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

989 Views

Let us first create a collection with documents −> db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"JOHN Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7edef1a844af18acdffb2") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"SAM Williams"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee011a844af18acdffb3") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"CAROL Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee101a844af18acdffb4") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"Bob Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee351a844af18acdffb5") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"DAVID Miller"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee451a844af18acdffb6") }Following is the query to display all documents from a collection with the help of find() method −> db.upperCaseFiveLetterDemo.find().pretty();This will produce the following output −{    "_id" : ... Read More

Advertisements