karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 135 of 143

How to use Swift to detect when AVPlayer video ends playing?

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

To detect the end of a video in swift we’ll need to create a video player, then use notifications to detect when the video stops playing. We’ll do this with help of an example in swift.Let’s create a project and drag and drop any video with extension “mp4”, select copy resource if required and add to the target of our project.Now we’ll programmatically first create a Video Player, then we’ll create url of the video in our project, and then we’ll play the video.var videoPlayer: AVPlayer!Now, in the viewDidAppear add the following code.override func viewDidAppear(_ animated: Bool) {    super.viewDidAppear(animated) ...

Read More

Using “WHERE binary” in SQL?

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

The binary keyword can be used after WHERE clause to compare a value with exact case sensitive match.The following is an example −Case 1 − Case insensitive matchThe query is as follows −mysql> select 'joHN'='JOHN' as Result;The following is the output −+--------+ | Result | +--------+ | 1 | +--------+ 1 row in set (0.00 sec)In the above sample output, the result is true while we know joHN and JOHN are two different words. This is not a case sensitive match.Case 2 − If you want case sensitive match, use the binary keyword.The query is ...

Read More

Replacing strings with numbers in Python for Data Analysis

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

Sometimes there is a requirement to convert a string to a number (int/float) in data analysis. For each string, we can assign a unique integer value to differentiate string values.For this, we use the data in Comma Separated Values(CSV) files. Say we have an excel file containing CSV data as follow −CompanyIndustryRecommendationHDFC BankFinanceHoldApolloHealthcareBuyHeroAutomobileUnderperformYes BankFinanceHoldM&MAutomobileUnderperformFortisHealthcareBuyMarutiAutomobileUnderperformAbove is just a few lines from a large dataset, we need to give different recommendation .i.e. Buy, Hold, Underperform etc. integer values, which will link to our metadata. So for the above input, our expected output will be something like −CompanyIndustryRecommendationHDFC BankFinance2ApolloHealthcare1HeroAutomobile3Yes BankFinance2M&MAutomobile3FortisHealthcare1MarutiAutomobile3Here is a way ...

Read More

How to create multiple styles inside a TextView on iOS App?

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

To create multiple styles inside a textview we need to use attributed string. The text view in ios has a property attributedText which can be used to style the text inside a text view. We’ll see this with help of an example.First, we’ll create an attributelet attributeOne : [NSAttributedString.Key : Any] = [NSAttributedString.Key(rawValue: NSAttributedString.Key.font.rawValue) : UIFont.systemFont(ofSize: 16.0), NSAttributedString.Key(rawValue: NSAttributedString.Key.foregroundColor.rawValue) : UIColor.blue]Then we’ll create an attributed string with the attribute we createdlet string = NSAttributedString(string: "Text for first Attribute", attributes: attributeOne)Similarly, we’ll create another string with different attribute. Then we’ll initialize the text of textView with the attributed string.Now the whole ...

Read More

Print Colors of terminal in Python

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

In the terminal, if you want to make some texts appears in colored mode, there are numerous ways in python programming to achieve it.Using python modules1.termcolor module: It is the ANSII Color formatting for output in the terminal.import sys from termcolor import colored, cprint text1 = colored('Hello, Tutorialspoint!', 'blue', attrs=['reverse', 'blink']) print(text1) cprint('Hello, Python!', 'blue', 'on_white') print_red_on_blue = lambda x: cprint(x, 'red', 'on_blue') print_red_on_blue('Hello, from Data Science!') print_red_on_blue('Hello, Python!') for i in range(10):    cprint(i, 'green', end=' ') cprint("Attention!", 'blue', attrs=['bold'], file=sys.stderr)Result

Read More

How to add a Submit button after the end of the tableview using Swift?

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

To add a submit button at the end of a table view, we can make use of table view footers. Let’s see this with help of an example where we’ll add a footer view to our table, and inside the table, we will add code for adding button at the bottom of the table view.Create a new project first, then inside the view controller add the following code which will initialize the table, add a section and a few rows to the table.func initTableView() {    let tableView = UITableView()    tableView.frame = self.view.frame    tableView.dataSource = self    tableView.delegate ...

Read More

Develop Notepad using Tkinter in python

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

Tkinter is a GUI library from python from which we can create multiple GUI apps. Here, using tkinter we will develop a notepad like text editor. This notepad will have the menu where we can create new file, open existing file, save the file, editing, cut and paste, all functionality will there.PrerequisitePython installed.Tkinter installed.Note: tkinter comes as a standard library with python 3.x.Adding menu items:Our notepad will have four main menu items: File, Edit, Commands & Help. Our file menu item will have four sub-items- New, Open, Save & Exit.Our edit menu item will have three sub-items- cut, copy & ...

Read More

Python library PyTube to download youtube videos

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

You know “youtube” right? Yes that most famous video sharing website especially in india . Most of the time, you like some videos and you try to download that video so as to check it later/offline. Then you come across “youtube-downloader” app to download youtube videos from the youtube website. But most of the apps comes with some restriction (if you are using it for free) or cost you money. But have you ever think of creating our own program to download youtube videos? If not you, then you should try as its very simply to do using the python ...

Read More

Socket Programming with Multi-threading in Python?

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

Multithreading ConceptsMultithreading is the core concept of nearly all modern programming languages especially python because of its simplistic implementation of threads.A thread is a sub-program within a program that can be executed independently of other section of the code. A thread executes in the same context sharing program’s runnable resources like memory.When in a single process, we are executing multiple threads simultaneously, it is called multithreading.Python Multithreading Modules for a thread implementationTo implements threads in programs, python provides two modules −thread (for python 2.x) or _thread(for python 3.x) modulethreading moduleWhere the thread module creates a thread as a function whereas ...

Read More

Bandwidth Delay Product

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

Bandwidth delay product is a measurement of how many bits can fill up a network link. It gives the maximum amount of data that can be transmitted by the sender at a given time before waiting for acknowledgment. Thus it is the maximum amount of unacknowledged data.MeasurementBandwidth delay product is calculated as the product of the link capacity of the channel and the round – trip delay time of transmission.The link capacity of a channel is the number of bits transmitted per second. Hence, its unit is bps, i.e. bits per second.The round – trip delay time is the sum ...

Read More
Showing 1341–1350 of 1,421 articles
« Prev 1 133 134 135 136 137 143 Next »
Advertisements