Wednesday, May 27, 2015

iPhone: CLLocation: Get current location


http://kennyray.com/2013/06/27/iphone-cllocation-get-current-location/


iPhone: CLLocation: Get current location


Steps to basic geolocation:
1. Add CLLocation framework to Build Phases, Link Binary with Libraries
2. Set up instance variable in .h file:

3. Instantiate and set up location manager in the .m file:
4. Inside the button handler:

This tells the location manager to start updating.
5. This function gets called by the location manager. It is like a callback. The location manager will call this function every time the location is updated.
All this does in this case is dump the data to the debug window.

Tuesday, May 19, 2015

Removing all line breaks notepadd

First, click on the ¶ symbol in the toolbar: you can see if you have CRLF line endings or just LF.
Click on the Replace button, and put \r\n or \n, depending on the kind of line ending. In the Search Mode section of the dialog, check Extended radio button (interpret \n and such). Then replace all occurrences with nothing (empty string).
You end with a big line...
Next, in the same Replace dialog, put your delimiter (
) for example and in the Replace With field, put the same with a line ending (\r\n). Replace All, and you are done.

Friday, May 15, 2015

replace comma with newline notepad++

In Notepad++, using the "Replace" command, tick "Regular Expression", and use '\n' without the apostrophes for the Replace With.



-117.9118113188791,33.69572651904701,0  -117.9150150002747,33.69569900779641.......

TO:

-117.9118113188791,33.69572651904701

 -117.9150150002747,33.69569900779641


Monday, May 11, 2015

Eclipse can't start can't find Java or “Java was started but returned exit code 13”

general if you have java_home environment variable setup, and installed the latest java, 
you do not need do any change on eclipse.ini.

No need to add -vm c:\....java\bin, just leave eclipse.ini file alone. 

Here is my environment variable:

computer > properties > advanced system settings > environment variable

add:

JAVA_HOME    C:\Program Files\Java\jdk1.8.0_05
PATH   C:\Program Files\Java\jdk1.8.0_05;
=====================================

This happens mainly due to:
  1. incompatible sdk and jdk versions
  2. using a 32 bit java version for your 64 bit eclipse JVM (programfilex86-java)
WHAT YOU HAVE TO DO : firstly check the eclipse.ini file to see if you have a path that is pointing to your jdk it should look something like this
-vm    
C:\Program Files\Java\blah\blah\blah\javaw.exe    
if not then locate the jdk 7 javaw.exe file
sample :
C:\Program Files\Java\jdk1.7.0_45\jre\bin\javaw.exe 
paste -vm and the path below it into your eclipse.ini file
-vm  
C:\Program Files\Java\jdk1.7.0_45\jre\bin\javaw.exe        
make sure that you type the above just before the -vmargs and after the OpenFile

Thursday, May 7, 2015

IBAction IBOutlet

IBAction and IBOutlet are macros defined to denote variables and methods that can be referred to in Interface Builder.
IBAction resolves to void and IBOutlet resolves to nothing, but they signify to Xcode and Interface builder that these variables and methods can be used in Interface builder to link UI elements to your code.
If you're not going to be using Interface Builder at all, then you don't need them in your code, but if you are going to use it, then you need to specify IBAction for methods that will be used in IB and IBOutlet for objects that will be used in IB.

IBAction and IBOutlet
Gone are the days of switching back and forth between .h and .m files! And one of the tangible benefits of a single file per class is easy access to IBAction and IBOutlet declarations.
In Objective-C your .h would probably have a bit of this:
@interface MyViewController: UIViewController

@property (weak) IBOutlet UIButton *likeButton;
@property (weak) IBOutlet UILabel *instructions;
- (IBAction)likedThis:(id)sender;

@end
And then you constantly have to dig into your .h file when playing with storyboards to tweak names. Blah.
Simplicity rules in swift. If you have a property defined that you want to make accessible to your storyboards, just add the @IBOutlet attribute before your property. Similarly with @IBAction to connect storyboard actions back to code.
class MyViewController: UIViewController {
  @IBOutlet weak var likeButton: UIButton?
  @IBOutlet weak var instruction: UILabel?

@IBAction func likedThis(sender: UIButton) {}
}
There are other interesting attributes that you can apply in swift but for now we’ll just cover these two common interface builder ones. There are two new interface builder attributes @IBDesignable and@IBInspectable which we probably won’t cover as their usage is very similar to this.