Call a Method After a Delay in Swift iOS

Mohtashim M
Updated on 23-Oct-2019 08:40:00

2K+ Views

In this post, we will be seeing how you can delay a method call using Swift. Here we will be seeing how you can achieve the same in two ways, So let’s get started, We will be seeing both the example in Playground, Step 1 − Open Xcode → New Playground.In the first approach, we will be using asyncAfter(deadline: execute:) instance method, which Schedules a work item for execution at the specified time and returns immediately.You can read more about it here https://developer.apple.com/documentation/dispatch/dispatchqueue/2300020-asyncafterStep 2 − Copy the below code in Playground and run, func functionOne() {    let delayTime = ... Read More

Rotate Image in ImageView by Angle on iOS App Using Swift

Mohtashim M
Updated on 23-Oct-2019 08:36:31

4K+ Views

Images are everywhere almost in all application, you might have come across many applications like gaming applications where you see images getting rotated.So, In this post, we will be seeing how to rotate the image in an image view by an angle in an iOS application.So, Let’s get started, Step 1 − Open Xcode→SingleViewApplication→name it RotateImage.Step 2 − Open Main.storyboard, add UIImageView and add 2 buttons as shown below name them ROTATE BY 90 DEGREES AND ROTATE BY 45 DEGREES. Add some sample images to UIImage View.Step 3 − Create @IBAction for both buttons and name them as rotate45button and ... Read More

Get Android Emulator's IP Address

Azhar
Updated on 23-Oct-2019 08:34:58

1K+ Views

This example demonstrates how do I get the Android Emulator’s IP address.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.xml.         Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.net.wifi.WifiManager; import android.os.Bundle; import android.text.format.Formatter; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    Button button;    TextView textview;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

Save Power of a Laptop on Battery Backup

Samual Sam
Updated on 23-Oct-2019 08:22:50

191 Views

At the time of doing some important task on a laptop without connecting laptop from the power plug (Running laptop on battery backup). In this situation, nobody likes to see their laptop screen suddenly goes dark or shut down. This happens because of less battery life, but some simple maintenance and power saving technique can keep your laptop to run for longer period of time. You can make your laptop to run for longer period of time by turning off or disabling all applications that consumes more power on your computer. This article is going to explain you some important ... Read More

Find All Patterns of 1, 0+1 in a String Using Python Regex

Pradeep Elance
Updated on 23-Oct-2019 08:22:30

275 Views

In this tutorial, we are going to write a program which finds all the occurrences of the 1(0+1) in a string using the regexes. We have a re module in Python which helps us to work with the regular expressions.Let's see one sample case.Input: string = "Sample 1(0+)1 string with 1(0+)1 unnecessary patterns 1(0+)1" Output: Total number of pattern maches are 3 ['1(0+)1', '1(0+)1', '1(0+)1']Follow the below steps to write the code for the program.Algorithm1. Import the re module. 2. Initialise a string. 3. Create a regex object using regular expression which matches the pattern using the re.compile(). Remember to ... Read More

Check If Both Halves of the String Have the Same Set of Characters in Python

Pradeep Elance
Updated on 23-Oct-2019 08:20:20

200 Views

We have to check whether two halves of a string have the same set of characters or not in Python. The frequency of the characters in the two halves must be identical. If the length of the string is odd, ignore the middle and check for the remaining characters. Follow the below steps to write code for the program.Algorithm1. Initialize a string. 2. Initialize an empty dictionary variable alphabets. 3. Initialize a variable mid with length / 2. 4. Write a loop until mid element.    4.1. Initialize the corresponding dictionary item by alphabets[char] with one if it's not initialized. ... Read More

Emergency Restart in Windows 8

Samual Sam
Updated on 23-Oct-2019 08:16:29

304 Views

 The Emergency restart an easy and user-friendly feature for user, given by Microsoft. An important key for users who want to restart their device in a minute or less than minute.The emergency restart mode closes all running apps forcefully without saving anything. It is useful when you have some issues with apps or the OS hanging or crashing and you would like to quickly restart the PC to fix it.Windows 8 and Windows 8.1, the emergency restart feature uses the hardware power button of Windows 8 tablet, laptop or desktop for operation. But this operation isn’t suggested yet user does ... Read More

Calculate N + NN + NNN + ... + N repeated M times in Python

Pradeep Elance
Updated on 23-Oct-2019 08:08:59

2K+ Views

We are going to write a program that calculates the following series in Python. Examine the example inputs and outputs for the program that we are going to write.Input: 34 3 + 33 + 333 + 3333 Output: 3702Input: 5 5 5 + 55 + 555 + 5555 + 55555 Output: 61725So, we will have two numbers, and we have to calculate the sum of the series generated as above. Follow the below steps to achieve the output.Algorithm1. Initialize the number let's say n and m. 2. Initialize a variable with the value n let's say change. 3. Intialize a ... Read More

Enable Slide to Shutdown on Windows 8.1

Samual Sam
Updated on 23-Oct-2019 08:08:50

528 Views

In Windows 8, user get Shut down option by right-clicking on the start menu, but some time it is difficult to get shut down option button.When you work on touchscreen devices, you might wish permitting a (cooler) slide to shut down UI on your Windows 8.1. It also works on desktop.In this article, we are going to share an easy to use method to use the “Slide to Shutdown” feature.The Slide to Shutdown UIThe Slide to Shutdown UI is an executable (.exe) file locates into the Windows –> System 32 folder. While double-clicking the SlideToShutDown.exe file displays lock screen rolled ... Read More

Reduce Download Conflicts Between Web Browsers

Samual Sam
Updated on 23-Oct-2019 08:04:40

231 Views

Worldwide, there are many useful web browsers, but Internet Explorer, Mozilla Firefox, Google Chrome and Opera are the most demanding and largely used browsers among all browsers. Browser choice is totally depends on user needs and for what kind of work user wants the browser. Generally, people use web browsers to download files, software, songs, movies, pictures, etc. By default, almost for all web browsers downloaded files stores in the “Downloads” folder. If somebody has number of web browsers with the same download path for all browser, it will be bit confusing when user download files at a same time ... Read More

Advertisements