Posts

Learn Objective-c after swift the opposit way

Image
Migrate from Swift to Objective-c There is ton of material available on how to migrate from objective c to swift but believe me there is nothing on the opposite transition.  No worry I will help you to get through it !     There is lot material for why should I need objective-c after learning swift but today I will give you some really important cut-short points: -The frameworks are written in Objective-C. -Objective-C is stable and well-tested. -Total you will find more than 80% iOS Developers are still with Objective C.   -For Library of C++ you will need to talk to the C++ objects from Objective-C. Swift can call C functions, but I believe that if you are working with a lot of C functions and types, you will want to code in Objective-C. - Maintenance of legacy code. -Transition is going to TAKE time.  - Objective-C is still the facto standard. -Debugging a “nasty” bug is not easy in swift. -The iOS developer community speaks Objective-C. - How long will ...

How to get Current Location in iOS using Swift?

Image
Get user's current location in iOS Swift To get a user's current location in iOS Swift you need to declare: let locationManager = CLLocationManager() In viewDidLoad() you have to instanitate the CLLocationManager class, like this: // Ask for Authorisation from the User. self.locationManager.requestAlwaysAuthorization() // For use in foreground self.locationManager.requestWhenInUseAuthorization() if CLLocationManager.locationServicesEnabled() {     locationManager.delegate = self     locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters     locationManager.startUpdatingLocation() } Then in CLLocationManagerDelegate method you can get user's current location coordinates: func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {     var locValue:CLLocationCoordinate2D = manager.location.coordinate     print("locations = \(locValue.latitude) \(locValue.longitude)")...

Enterprise Java Easy Readme to get started in J2EE

Image
J2EE Getting Started Guide Q.What is J2EE ? Answer: server side specifications (APIs)  for different services such as Persistence,web comps(sevlets,JSP,filter)  life -cycle management, EJB(Enterprise Java Bean) management,security,connection pooling,transactions ,JMS(Java Messaging Service), Java mail ,web services support ,JPA(Java persistence API) ,etc. Why ??? 1. Can support different types of clients(thin clnts ---web clnt or Thick clnts --appln clnt, mobile clnts Thin clnt (min)--- only web browser + net conn. to server ---- protocol HTTP/HTTPS Thick clnt (min) --- Java SE support + (optional) server lib + net cn to server protocol --- RMI style protocol.(Server vendor propritery protocol based upon RMI/IIOP) eg -- from core java ---TCP clnt,RMI clnt,UDP clnt 2. Server side applications ---- will be completely independent of underlying web server/application server.(J2EE compliant server) 3. Enterprise applications -- distributed, transactional, and portable applications ...

Uses of Optional in Java 8

Image
What are the uses of Optional in Java 8? Answer: Java 8 introduced a new  container class java.util.Optional<T> . It wraps a single value, if that value is available. If the value is not available an empty optional should be returned. Thus it represents null value with absent value. This class has various utility methods like isPresent() which helps users to avoid making use of null value checks. So instead of returning the value directly, a wrapper object is returned thus users can avoid the null pointer exception. Class Declaration Following is the declaration for  java.util.Optional<T>  class − public final class Optional<T> extends Object Class Method S. No. Method & Description 1 static <T> Optional<T> empty() Returns an empty Optional instance. 2 boolean equals(Object obj) Indicates whether some other object is "equal to" this Optional. 3 Optional<T> filter(Predicate<? super <T> predicate) If a value is present and th...