Friday, January 29, 2016

getting java.lang.IllegalStateException: Profile not locked due to exception in eclipse while trying to open Install new software

Start by checking you error log under Window -> Show View -> Error Log
It's clear to demonstrate the issue by the exception.
You need check whether your account that is running Eclipse has permission to create lock file(C:\WORK\GALILEO\eclipse_STT - Offline\p2\org.eclipse.equinox.p2.engine\profileRegistry\epp.package.rcp.profile.lock). Or manually remove it if it already exists.

Friday, June 26, 2015

Swift ?? operator

The nil coalescing operator (a ?? b) unwraps an optional a if it contains a value, or returns a default value b if a is nil.

Monday, June 8, 2015

Wrapping Google Analytics in Swift


import Foundation
@objc enum MyEventCategory: Int {
    case Category1
    case Category2
}
@objc enum MyEventAction: Int {
   case Action1
   case Action2
   
}
@objc class MyAanalytics  {
    
    func getMyCategory(category: MyEventCategory) -> String {
        return String(stringInterpolationSegment: category)
        
    }
    func getMyAction(action: MyEventAction) -> String {
        return String(stringInterpolationSegment: action)
    }
    func trackEvent(category: MyEventCategory, action: MyEventAction) {
        var label: String, value: NSNumber?
        label = "Any label" // whatever label you want to give
        value = nil
        
        let tracker = GAI.sharedInstance().defaultTracker
        let trackDictionary = GAIDictionaryBuilder.createEventWithCategory(self.getMyCategory(category), action: self. getMyAction(action), label: label, value: value).build()
        tracker.send(trackDictionary as [NSObject : AnyObject])
    }

}

Conditional unwrapping in swift using where clause


checking the optional bool variable as well as that is that variable is true or not


if canPlay = self.dataSource?.functiion() where canPlay= true {

}

Wednesday, June 3, 2015

Removing conflicts during merging two branches on bitbucket

On terminal

 $git status


remove untracked files if exists

$rm -rf fileWithFullAddress


$git status 

Repeat above till get clean directory


$git checkout FinalDestinationBranchForMerging


$git pull // get update for local branc


Now merge the other branch with it

$git merge MergingBranch

It will show the files having conflicts. Files will get -- head tags 

open Editor, make the changes


After making changes

$ git add ChangedFileWithAddress
$ git status

If need to remove/reset some file from the project 

$ git rest FileToBeRemoved

$ git add -A
$ git status

$ git commit -m 'The message I got while merging the branches'

$ git push

Done