karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 134 of 143

Get the type of a variable in MySQL?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 1K+ Views

You cannot get the type of variable in MySQL. Cast the type of variable into another using CAST operator. The syntax is as follows −SET @yourVariableName:=’anyValue’Use the CAST operator to cast to another type. The syntax is as follows −SELECT CAST( @yourVariableName AS SIGNED);To understand the above syntax, let us cast to another type.Case 1: String to unsigned −mysql> set @StringToInt:='12345'; Query OK, 0 rows affected (0.00 sec)The query is as follows to another type −mysql> select CAST(@StringToInt as UNSIGNED);The following is the output −+--------------------------------+ | CAST(@StringToInt as UNSIGNED) | +--------------------------------+ | 12345               ...

Read More

Implementation of Dynamic Array in Python

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 14K+ Views

Dynamic ArrayIn python, a list, set and dictionary are mutable objects. While number, string, and tuple are immutable objects. Mutable objects mean that we add/delete items from the list, set or dictionary however, that is not true in case of immutable objects like tuple or strings.In python, a list is a dynamic array. Let's try to create a dynamic list −>>> #Create an empty list, named list1 >>> list1 = [] >>> type (list1) Add some items onto our empty list, list1 −>>> # Add items >>> list1 =[2, 4, 6] >>> list1 [2, 4, 6] >>> # Another way ...

Read More

Python program to print all the numbers divisible by 3 and 5 for a given number

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 20K+ Views

This is a python program to print all the numbers which are divisible by 3 and 5 from a given interger N. There are numerous ways we can write this program except that we need to check if the number is fully divisble by both 3 and 5.Below is my code to write a python program to print all the numbers divisible by 3 and 5 −lower = int(input("Enter lower range limit:")) upper = int(input("Enter upper range limit:")) for i in range(lower, upper+1):    if((i%3==0) & (i%5==0)):       print(i)OutputEnter lower range limit:0 Enter upper range limit:99 0 15 ...

Read More

Why is “LIMIT 0” even allowed in MySQL SELECT statements?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 1K+ Views

As you know if you use LIMIT 0 in MySQL SELECT statement, it returns an empty set.The LIMIT can be used when you want a specified number of rows from a result rather than the entire rows. If you use any MySQL API, then the job of LIMIT is to acquire the type of result columns.LIMIT 0 can be used to check the validity of a query. For more details use the following link −https://dev.mysql.com/doc/refman/8.0/en/limit-optimization.htmlHere is the demo of LIMIT 0. The query to create a table is as follows −mysql> create table Limit0Demo    -> (    -> Id ...

Read More

MySQL update query to remove spaces?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 2K+ Views

You can use TRIM() function to remove spaces. The syntax is as follows −UPDATE yourTableName SET yourColumnName=TRIM(yourColumnName);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table removeSpaceDemo -> ( -> Id int NOT NULL AUTO_INCREMENT, -> UserId varchar(20), -> UserName varchar(10), -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into removeSpaceDemo(UserId, ...

Read More

MySQL query to group data in the form of user login time per hour and get the records of the users logged in the recent hour?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 359 Views

You can use a subquery with JOIN condition for this. The syntax is as follows −SELECT yourTablevariableName.* FROM ( SELECT MAX(UNIX_TIMESTAMP(yourDateTimeColumnName)) AS anyAliasName FROM getLatestHour GROUP BY HOUR(UserLoginDateTime) ) yourOuterVariableName JOIN yourTableName yourTablevariableName ON UNIX_TIMESTAMP(yourDateTimeColumnName) = yourOuterVariableName.yourAliasName WHERE DATE(yourDateTimeColumnName) = 'yourDateValue';To understand the above syntax and the result to be achieved, let us create a table. The query to create a table is as follows −mysql> create table getLatestHour -> ( -> UserId int, -> UserName varchar(20), -> UserLoginDateTime ...

Read More

How to set target and action for UIBarButtonItem at runtime?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 1K+ Views

To create a bar button action at run time we’ll need to go through a few steps. First of all let’s start by creating a new project.Once you have created the project, go to it’s storyboard directly, select the ViewController and Embed it into a navigation controller.Now go to the respective View controller class and inside it, we’ll perform some steps that will add a button to the navigation bar on run time.Create an objc function that should be called when the button is pressed.@objc func barButtonAction() {    print("Button pressed") }Now add the viewWillLayoutSubviews method to your class.First, we’ll ...

Read More

Can I change the size of UIActivityIndicator in Swift?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 841 Views

It is possible to change the size of UIActivityIndicator in swift using some tricks but it’s not recommended to change the size. To change the size of activity indicator let’s first add an indicator on an empty screen and see how it looks. For this example, I’ll also change the color to red.Let’s see how it looks when we run it without changing the size of the indicator.Now, we’ll create an outlet of activity indicator in our view controller and in the viewDidLoad method of this class we’ll add the code below.We’ll use CGAffineTransform to change the scale of our ...

Read More

Why is python best suited for Competitive Coding

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 316 Views

Competitive programming is generally referred to coding to make use of efficient algorithms using an appropriate data structure. They test the skills of programmers on many levels.With the help of algorithms and data structures, you have to solve a hypothetical programming problem posed to you by applying different logics. You not only have to solve the problem but you have to come up with a very efficient solution, which is having a good time and space complexity.Example of a problem statement for what is called competitive programming might be −You are given a string s of length n consisting only ...

Read More

Convert one base number system to another base system in MySQL

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 199 Views

The CONV() function can be used to convert one base number system to another base system.For Example, The 16 is one base system and 10 is another base system. The 16 base system is hexadecimal and 10 is a decimal.The syntax is as follows −SELECT CAST(CONV('yourColumnName', 16, 10) AS UNSIGNED INTEGER) as anyAliasName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table castTypeToBigIntDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Value varchar(100),    -> PRIMARY KEY(Id)    -> ); Query OK, ...

Read More
Showing 1331–1340 of 1,421 articles
« Prev 1 132 133 134 135 136 143 Next »
Advertisements