Though iOS does not provide any official way to take screenshots on iOS device programmatically, it provides a way to screenshot using the home and power button, by pressing both of them at the same time.To take a screenshot, we’ll have to go through a series of steps.We’ll get the layer of keyWindow – UIApplication.shared.keyWindow!.layerWe’ll get the scale of screen – UIApplication.main.scaleCreating a new image with same size as the view.Render and save the image.Let’s create a new project, in the main view controller give some background color and then drag a button and connect to create an action to ... Read More
Import the following package for Calendar class in Javaimport java.util.Calendar;Firstly, create a Calendar object and display the current dateCalendar calendar = Calendar.getInstance(); System.out.println("Current Date = " + calendar.getTime());Now, let us decrement the date using the add() method and Calendar.DATE constant. Set a negative value since we are decrementing the datecalendar.add(Calendar.DATE, -3);The following is an exampleExample Live Demoimport java.util.Calendar; public class Demo { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); System.out.println("Current Date = " + calendar.getTime()); // Decrementing date by 3 calendar.add(Calendar.DATE, -3); ... Read More
The Xcode error occurs when the xcode version and ios versions don’t match. Usually it happens when the Xcode version is less than the device iOS version. i.e. the Xcode is too old for the device. This is a compatibility issue which can be resolved by performing some steps.Always check if the device you are using has compatible iOS version to the Xcode version, if not Xcode requires an update.If you are not able to update XCode or there is no update being shown for Xcode, please check if the OS needs an update.In some cases you would not like ... Read More
Register A is an 8-bit register used in 8085 to perform arithmetic, logical, I/O & LOAD/STORE operations. Register A is quite often called as an Accumulator. An accumulator is a register for short-term, intermediate storage of arithmetic and logic data in a computer's CPU (Central Processing Unit).In an arithmetic operation involving two operands, one operand has tobe in this register. And the result of the arithmetic operation will be stored or accumulated in this register. Similarly, in a logical operation involving two operands, one operand has to be in the accumulator. Also, some other operations, like complementing and decimal adjustment, ... Read More
Horticulture is a discipline that is concerned with garden management and cultivation. It has a lot of scope in India considering the fact that allied agricultural activities are also getting promoted in the country and are encouraged as a subsidiary occupation by many state governments.Students from the background of physical and chemical sciences can do Diploma in Horticulture after passing their 10+2 board examination. However, this may vary from institute to institute.Here are some of the popular colleges/ institutes which offer this programme in India −Dr. YSR Horticultural UniversityLocated in the West Godavari district of Andhra Pradesh, is one of ... Read More
To go through all the text fields one by one on tap on done or return button, we’ll have to create a logic. Let’s understand it with help of a project.Create a project and on the view controller story board drag Four text fields.Select them one by one and from attribute, inspector set their tags as 1, 2, 3, 4 respectively.Also set their return key to Done from the attribute inspector itself.Create outlets for all four text fields in the View controller class, connect them to their respective outlets.@IBOutlet weak var tf1: UITextField! @IBOutlet weak var tf2: UITextField! @IBOutlet weak ... Read More
Registers B, C, D, E, H, and L are general purpose registers in 8085 Microprocessor. All these GPRS are 8-bits wide. They are less important than the accumulator. They are used to store data temporarily during the execution of the program. For example, there is no instruction to add the contents of Band E registers. At least one of the operands has to be in A. Thus to add Band E registers, and to store the result in B register, the following have to be done.Move to A register the contents of B register.Then add A and E registers. The ... Read More
Import the following package for Calendar class in Javaimport java.util.Calendar;Firstly, create a Calendar object and display the current dateCalendar calendar = Calendar.getInstance(); System.out.println("Current Date = " + calendar.getTime());Now, let us increment the month using the add() method and Calendar.MONTH constant −calendar.add(Calendar.MONTH, 2);The following is an exampleExample Live Demoimport java.util.Calendar; public class Demo { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); System.out.println("Current Date = " + calendar.getTime()); // Incrementing Month by 2 calendar.add(Calendar.MONTH, 2); System.out.println("Updated Date (+2 Months) = " + calendar.getTime()); ... Read More
System.out.format is used in Java to format output.Firstly, create a Calendar object −Calendar calendar = Calendar.getInstance();Now, use theDate-Time conversion characters to get the date, month and year −System.out.format("%te %tB, %tY%n", calendar, calendar, calendar);The following is the complete example −Example Live Demoimport java.util.Locale; import java.util.Calendar; public class TestFormat { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); System.out.format("%te %tB, %tY%n", calendar, calendar, calendar); } }Output22 November, 2018
Sometimes while testing our app on simulator we need to test for case where no internet is available. This can be achieved in multiple ways.Below are some of the possible ways to do itEasiest but not the most correct way is to disconnect your mac from the LAN Cable is you are on a LAN, or turn off the wifi if you are connected on a wifi network. But that will definitely turn off internet for your whole device, not just simulator. So, there are some more ways to do itDownload Hardware IO tools for Xcode.Go to Xcode menu, select ... Read More