Request Location Permission at Runtime on iOS

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

1K+ Views

To request location Permission we will be using Apple’s CLLocationManager class. You use instances of this class to configure, start, and stop the Core Location services.You can read more about CLLocationManager class here. https://developer.apple.com/documentation/corelocation/cllocationmanageriOS apps can support one of two levels of location access.While using the app − The app can access the device’s location when the app is in use. This is also known as “when-in-use authorization.”Always − The app can access the device’s location either when app is in use or in the background.Here we will be using when-in-use authorization: Request authorization to use location services only when your ... Read More

Align Views at the Bottom of the Screen in Android

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

6K+ Views

This example demonstrate about How to align views at the bottom of the screen in Android.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.java     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.sample ; import android.os.Bundle ; import android.support.v7.app.AppCompatActivity ; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ;       setContentView(R.layout. activity_main ) ;    } }Step 4 − Add the following code to androidManifest.xml                       ... Read More

Select and Display Specific Field from MongoDB Document

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

2K+ Views

Let us first create a collection with documents −> db.querySelectDemo.insertOne({UserId:100, UserName:"Chris", UserAge:25}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce90eb478f00858fb12e90e") } > db.querySelectDemo.insertOne({UserId:101, UserName:"Robert", UserAge:26}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce90ec578f00858fb12e90f") } > db.querySelectDemo.insertOne({UserId:103, UserName:"David", UserAge:27}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce90ed478f00858fb12e910") }Following is the query to display all documents from a collection with the help of find() method −> db.querySelectDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5ce90eb478f00858fb12e90e"),    "UserId" : 100,    "UserName" : "Chris",    "UserAge" : 25 } {    "_id" : ObjectId("5ce90ec578f00858fb12e90f"),    "UserId" : 101, ... Read More

Transient Variables in Java Explained

Venkata Sai
Updated on 30-Jul-2019 22:30:26

399 Views

In Java, serialization is a concept using which we can write the state of an object into a byte stream so that we can transfer it over the network (using technologies like JPA and RMI).While serializing an object of a class, if you want JVM to neglect a particular instance variable you need can declare it transient.public transient int limit = 55; // will not persist public int b; // will persistIn the following java program, the class Student has two instance variables name and age where, age is declared transient. In another class named EampleSerialize we are trying to ... Read More

Why MySQL Evaluates True or True AND False to True

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

236 Views

MySQL evaluates “TRUE or TRUE and FALSE” to true because AND has the highest priority than OR i.e. AND is evaluated before OR.The MySQL evaluates the above statement like this. The AND operator gets evaluated first −(TRUE or (TRUE AND FALSE))The statement (TRUE AND FALSE) gives the result FALSE. Then the second statement evaluates like this −(TRUE or FALSE)The above statement gives the result TRUE.Let us implement one by one −mysql> select (TRUE AND FALSE); +------------------+ | (TRUE AND FALSE) | +------------------+ | 0 | ... Read More

HTML DOM Input Week Autofocus Property

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

120 Views

The Input Week autofocus property sets/returns whether Input Week is focused upon initial page load.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputWeekObject.autofocusSetting autofocus to booleanValueinputWeekObject.autofocus = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailsTrueIt defines that input will be autofocused on page load.FalseIt is the default value and input is not autofocused.ExampleLet us see an example for Input Week autofocus property − Live Demo Input Week autofocus    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;     ... Read More

Add Titled Border to Panel in Swing

Krantik Chavan
Updated on 30-Jul-2019 22:30:26

271 Views

To set Titled Border to Panel, let us first create a Panel for our Java Swing Application:JPanel panel = new Jpanel(new BorderLayout());Now, set the titled border:panel.setBorder(new TitledBorder("Displaying Titled Border"));The following is an example to add Titled Border to Panel in Swing:Exampleimport java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.TitledBorder; public class SwingDemo {    public static void main(String[] args) {       JPanel panel = new JPanel(new BorderLayout());       panel.setBorder(new TitledBorder("Displaying Titled Border"));       panel.add(new JButton("Demo Button"), BorderLayout.SOUTH);       JOptionPane.showMessageDialog(null, panel);    } }OutputRead More

MySQL Data Types for Storing Negative Numbers

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

2K+ Views

You can use TINYINT data type in MySQL to store negative number. Following is the syntax −CREATE TABLE yourTableName ( yourColumnName TINYINT . . . . N );Let us first create a table with a column set as type TINYINT −mysql> create table DemoTable ( Number tinyint ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command −mysql> insert ... Read More

What is Weekday Method in Python

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

195 Views

The weekday() method is used to returns the particular day of the week.Exampleimport datetime import calendar #defining function named called findweekDay def findWeekDay(date): i = datetime.datetime.strptime(date, '%d %m %Y').weekday() return (calendar.day_name[i]) date = '24 05 2019' print(findWeekDay(date))Outputfriday

Define Underlined Text in Android Layout XML

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

2K+ Views

This example demonstrate about How can I define underlined text in an Android layout xml file.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.java     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.sample ; import android.os.Bundle ; import android.support.v7.app.AppCompatActivity ; import android.text.SpannableString ; import android.text.style.UnderlineSpan ; import android.widget.TextView ; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ;   ... Read More

Advertisements