Anvi Jain has Published 629 Articles

Detect current device with UIUserInterfaceIdiom in Swift

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

2K+ Views

To detect current device with iOS/Swift we can use UserInterfaceIdiom. It is an enum in swift, which tells which device is being used.The interface idiom provides multiple values in it’s enum which are.case unspecified @available(iOS 3.2, *) case phone // iPhone and iPod touch style UI @available(iOS 3.2, *) case ... Read More

Strip last two characters of a column in MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

2K+ Views

You can strip last two characters with the help of SUBSTRING() and CHAR_LENGTH() methods. The syntax is as follows −select yourColumnName, SUBSTRING(yourColumnName, 1, CHAR_LENGTH(yourColumnName) - 2) AS anyVariableName from yourTableName;To understand the above syntax, let us create a table −mysql> create table LastTwoCharacters −> ( ... Read More

How to resolve the error that occurs while using a reserved word as a table or column name in MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

995 Views

This error occurs when you try to use a reserved word as a table or column name. It can occur due to −Case 1: Whenever you use reserved word as a table name −mysql> create table insert −> ( −> Id int −> );The error is as follows −ERROR 1064 ... Read More

How to Add Live Camera Preview to UIView in Swift?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

634 Views

To add a live camera preview to our default UIView in swift we can either use AVFoundation framework of iOS SDK or native UIImagePickerController(). In this example we’ll be using ImagePicker as our aim is to present camera preview on the UIView and Imagepicker is suitable for that task. AVFoundation ... Read More

Delete more than one rows from a table using id in MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

904 Views

You can use IN statement to delete more than one rows from a table using id in MySQL. The syntax is as follows −delete from yourTableName where yourColumnName in(value1, value2, .....valueN);To understand the above syntax, let us create a table. The following is the query to create a table.mysql> create ... Read More

MYSQL select DISTINCT values from two columns?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

5K+ Views

To select distinct values in two columns, you can use least() and greatest() function from MySQL.Let us create a table with two columns −mysql> create table SelectDistinctTwoColumns    −> (    −> StudentId int,    −> EmployeeId int    −> ); Query OK, 0 rows affected (0.60 sec)Now you can ... Read More

How to make iPhone vibrate using Swift?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

1K+ Views

To make an iPhone vibrate using swift we’ll use two different methods. First create a new project and add Four different buttons to the main View controller.Now import the AudioToolbox framework in your view controller class.For the first button add an action and write the following code as shown below:@IBAction ... Read More

How to open and close a PDF file using Swift?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

531 Views

In this article we’ll see how to open a pdf file using swift in iOS. Here we’ll do it with an example of opening pdf in webView in iOS. Let’s create a project and add WKWebView to the storyboard.Connect it’s outlet to the ViewController class.Now we’ll see two different thingsOpening ... Read More

How to query between two dates in MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

17K+ Views

You can query between dates with the help of BETWEEN statement. The syntax is as follows −select *from yourTableName where yourColumnName between ‘yourStartingDate’ and curdate().Use curdate() or now(), both these functions will work. To understand the above syntax, let us create a table −mysql> create table BetweenDateDemo ... Read More

How to insert current date/ time using now() in a field with MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:24

649 Views

In MySQL, now() can be used to insert current date/time. The syntax is as follows −insert into yourTableName values(now());To understand the above concept of inserting current date/time in the table, let us first create a table −mysql> create table CurrentDateTimeDemo −> ( −> YourTime ... Read More

Advertisements