Get Possible Values for SET Field in MySQL

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

391 Views

To get possible values for set field, you can use below syntax −desc yourTableName yourSetColumnName;Let us first create a table −mysql> create table DemoTable    (    Game set('Chess','Pig Dice','29 Card')    ); Query OK, 0 rows affected (0.60 sec)Following is the query to get available values for set field −mysql> desc DemoTable Game;This will produce the following output −+-------+-----------------------------------+------+-----+---------+-------+ | Field | Type                              | Null | Key | Default | Extra | +-------+-----------------------------------+------+-----+---------+-------+ | Game  | set('Chess','Pig Dice','29 Card') | YES  |     | NULL    |       | +-------+-----------------------------------+------+-----+---------+-------+ 1 row in set (0.02 sec)

Check Active Notifications in iOS Status Bar

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

269 Views

To get the list of notifications which are active on your status bar tray we are going to use getdeliverednotifications, you can read more about it here.https://developer.apple.com/documentation/usernotifications/unusernotificationcenterhttps://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649520-getdeliverednotificationsWhile it is know that we cannot get the notifications from all apps as that would be a privacy violation, but we can get the notification for our applicationApple provide getDeliveredNotifications(completionHandler:)Which returns a list of the app’s notifications that are still displayed in Notification Center.You can write the following code depending upon your need.UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in    print(notifications) }Read More

Set Style for JTextPane in Java

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

1K+ Views

To set style for text in JTextPane, use setItalic() or setBold() that sets italic or bold style for font respectively.Following is our JTextPane component −JTextPane pane = new JTextPane();Now, use the StyleConstants class to set style for the JTextPane we created above. We have also set the background and foregound color −SimpleAttributeSet attributeSet = new SimpleAttributeSet(); StyleConstants.setItalic(attributeSet, true); StyleConstants.setForeground(attributeSet, Color.black); StyleConstants.setBackground(attributeSet, Color.orange); pane.setCharacterAttributes(attributeSet, true);The following is an example to set style for JTextPane −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; public class SwingDemo {    public static ... Read More

Check Android Phone Model Programmatically

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

2K+ Views

This example demonstrate about How to check Android Phone Model programmatically.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.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.sample ; import android.os.Build ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.widget.TextView ; public class MainActivity extends AppCompatActivity {    TextView textView ;    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ;       setContentView(R.layout. activity_main ... Read More

Update ID Field in MongoDB

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

361 Views

You can’t directly update _id field i.e. write some script to update. Let us first create a collection with documents −> db.updatingIdFieldDemo.insertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce271bb36e8b255a5eee949") }Following is the query to display all documents from a collection with the help of find() method −> db.updatingIdFieldDemo.find();This will produce the following output −{ "_id" : ObjectId("5ce271bb36e8b255a5eee949"), "StudentName" : "Chris" }Following is the query to update _id field in MongoDB −> var myDocument=db.updatingIdFieldDemo.findOne({StudentName:"Chris"}); > myDocument._id = 101; 101 > db.updatingIdFieldDemo.save(myDocument); WriteResult({ "nMatched" : 0, "nUpserted" : 1, "nModified" : 0, "_id" : 101 }) > db.updatingIdFieldDemo.remove({_id:ObjectId("5ce271bb36e8b255a5eee949")}); WriteResult({ ... Read More

Add Column and Index to Existing Table with ALTER in MySQL

Sharon Christine
Updated on 30-Jul-2019 22:30:26

459 Views

To add a new column to an existing table, use ADD. With that, to add a new index, use the ADD INDEX(). Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(100),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.69 sec)Let us check the description of the table −mysql> desc DemoTable;This will produce the following output −+-------+--------------+------+-----+---------+----------------+ | Field | Type         | Null | Key | Default | Extra          | +-------+--------------+------+-----+---------+----------------+ | Id ... Read More

HTML DOM Input URL ReadOnly Property

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

137 Views

The HTML DOM Input URL readOnly property sets/returns whether Input URL can be modified or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputURLObject.readOnlySetting readOnly to booleanValueinputURLObject.readOnly = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailsTrueIt defines that the input url field is readOnly.FalseIt defines that the input url field is not readOnly and can be modified.ExampleLet us see an example of Input URL readOnly property − Live Demo Input URL readOnly    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: ... Read More

Memory Representation of C Variables

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

577 Views

Here we will see how to print the memory representation of C variables. Here we will show integers, floats, and pointers.To solve this problem, we have to follow these steps −Get the address and the size of the variableTypecast the address to the character pointer to get byte addressNow loop for the size of the variable and print the value of typecasted pointer.Example#include typedef unsigned char *byte_pointer; //create byte pointer using char* void disp_bytes(byte_pointer ptr, int len) {     //this will take byte pointer, and print memory content    int i;    for (i = 0; i < ... Read More

Set Bounds for JProgressBar in Java Swing

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

403 Views

Use the setBounds() method to set Bounds for JProgressBar in Java Swing −JProgressBar progressBar; progressBar.setBounds(70, 50, 120, 30);The following is an example to set bounds for JProgressBar −Examplepackage my; import javax.swing.*; public class SwingDemo extends JFrame {    JProgressBar progressBar;    int i = 0;    SwingDemo() {       progressBar = new JProgressBar(0, 1000);       progressBar.setBounds(70, 50, 120, 30);       progressBar.setValue(0);       progressBar.setStringPainted(true);       add(progressBar);       setSize(550, 150);       setLayout(null);    }    public void inc() {       while (i

Insert Multiple Sets of Values in a Single Statement with MySQL

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

325 Views

Let us first create a table −mysql> create table DemoTable ( UserId int, UserName varchar(20), UserAge int ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(UserId,UserName,UserAge) values(100,'John',25),(101,'Larry',24),(102,'Chris',22),(103,'Carol',27); Query OK, 4 rows affected (0.16 sec) Records: 4 Duplicates: 0 Warnings: 0Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------+----------+---------+ | UserId | UserName | UserAge | +--------+----------+---------+ | 100 | John | 25 | | 101 | Larry | 24 | | 102 | Chris | 22 | | 103 | Carol | 27 | +--------+----------+---------+ 4 rows in set (0.00 sec)

Advertisements