Almost all the application uses location services, thus having complete understanding on location is necessary. In this post we will be seeing how to get current location’s latitude and longitude.For this we will be using CLLocationManager, you can read more about it herehttps://developer.apple.com/documentation/corelocation/cllocationmanagerWe will be developing a sample application where we will print user’s latitude and longitude on viewDidLoad method, alternatively you can print on tap of a button also on UILabel as per need.So let’s get started, Step 1 − Open Xcode → New Projecr → Single View Application → Let’s name it “Location”Step 2 − Open info.plist file ... Read More
You can use aggregate function MAX() and MIN() for this.Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Number1 int, Number2 int ); Query OK, 0 rows affected (0.89 sec)Insert records in the table using insert command −mysql> insert into DemoTable(Number1, Number2) values(67, 45); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(Number1, Number2) values(90, 40); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(Number1, Number2) values(80, 43); Query OK, 1 row affected (0.48 sec)Display all records from the table using select ... Read More
The getMaxIndexLength() method of the DatabaseMetaData interface is used to find out the maximum number of bytes that the underlying database allows for an index.This method returns an integer value, representing the maximum number of byes allowed in an index. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager ... Read More
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Value char(1) ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value) values('X'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Value) values('Y'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(Value) values('X'); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable(Value) values('X'); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable(Value) values('Y'); Query OK, 1 ... Read More
Here we will see how we transfer a block of data in reverse order using 8085.Problem StatementWrite 8085 program to transfer a block of N-bytes in reverse order. The block is stored at location 8001 onwards, the size of the block is stored at 8000. The block will be moved at location 9000 onwards.DiscussionTo solve this problem, we are taking the size of the block at first. The DE register pair is set to point at destination address 9000H. The HL pair is set to point to the last element of the block. If the block size is 0A, then ... Read More
Use REGEXP to return only the numeric rows. Let us first create a table −mysql> create table DemoTable -> ( -> StudentId varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John74747'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('8494575Carol'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('985755645'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Carol-9032'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('101'); ... Read More
The HTML DOM Input DatetimeLocal disabled property sets/returns whether Input DatetimeLocal is enabled or disabled.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDatetimeLocalObject.disabledSetting disabled to booleanValueinputDatetimeLocalObject.disabled = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the input datetimeLocal is disabled.falseIt defines that the input datetimeLocal is not disabled and it is also the default value.ExampleLet us see an example of Input DatetimeLocal disabled property − Live Demo Input DatetimeLocal Disabled form { width:70%; margin: 0 auto; text-align: center; } * { ... Read More
First, you need to know how many columns are present in a table. Following is the syntax to know the column names −show columns from yourTableName;Following is the syntax to concatenate all columns −select concat(yourColumnName1, yourColumnName2, yourColumnName3, ........N) from yourTableName;Let us first create a table −mysql> create table DemoTable ( CustomerId int, CustomerName varchar(20), CustomerAge int ); Query OK, 0 rows affected (0.66 sec)Following is the query to know the exact column −mysql> show columns from DemoTable;This will produce the following output −+--------------+-------------+------+-----+---------+-------+ | Field | Type | Null ... Read More
When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The insertRow is a special row of the ResultSet in JDBC, it is associated with the updatable ResultSet objects. In it you can construct a new Row calling the UpdateXXX() ... Read More
To allow multiple selection of nodes not necessarily contiguous, set the selection mode for tree to be DISCONTIGUOUS_TREE_SELECTION −tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);The following is an example to allow multiple selection of nodes, which are not necessarily contigous −Examplepackage my; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeSelectionModel; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Demo"); DefaultMutableTreeNode node = new DefaultMutableTreeNode("Products"); DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("Clothing"); DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("Electronics"); DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("Home Decor"); DefaultMutableTreeNode node4 = new DefaultMutableTreeNode("Furniture"); node.add(node1); node.add(node2); node.add(node3); node.add(node4); DefaultMutableTreeNode one = new DefaultMutableTreeNode("Shirt"); DefaultMutableTreeNode two = new DefaultMutableTreeNode("Trousers"); DefaultMutableTreeNode three = new DefaultMutableTreeNode("Jeans"); DefaultMutableTreeNode four = new DefaultMutableTreeNode("Mobiles"); ... Read More