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

342 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

440 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

115 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

551 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

378 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

309 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)

Create Circular Progress Bar in iOS

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

3K+ Views

It is very important to know how to create a circular progress bar for iOS developers, almost every application have this.This is mainly used in showing the downloading status, loading status or any other progress related thing.Creating Circular Progress bar may become very tedious for new programmers and they might struggle working with it.There are multiple way one can create circular progress bar. In this post we will be seeing one of the simplest and easiest way to create circular progress bar.So let’s get startedStep 1 − Open Xcode, Single View Application, name it CircularProgress.So we will be creating an ... Read More

Add Components with Relative X and Y Coordinates in Java

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

572 Views

To add components with relative X and Y coordinates, you need to set both the gridx and gridy components −GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = GridBagConstraints.RELATIVE; constraints.gridx = GridBagConstraints.RELATIVE;The following is an example to add components with relative X and Y Coordinates −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JPanel panel = new JPanel();       panel.setLayout(new GridBagLayout());       GridBagConstraints constraints = new GridBagConstraints();   ... Read More

Set Default Font Family for Entire Android App

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

3K+ Views

This example demonstrate about How to set default font family for entire Android App.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.support.v7.app.AppCompatActivity ; import android.os.Bundle ; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ;       setContentView(R.layout. activity_main ) ;    } }Step 4 − ... Read More

Advertisements