Tuesday, March 24, 2015

Registering a listener for changes in network connections and proxy from eclipse preferences

import org.eclipse.core.net.proxy.IProxyChangeEvent;
import org.eclipse.core.net.proxy.IProxyChangeListener;
import org.eclipse.core.net.proxy.IProxyService;
import org.osgi.util.tracker.ServiceTracker;

public class ProxyHelper
{

public void registerListener()
{
ServiceTracker tracker = new ServiceTracker(MyPlugin.getDefault().getBundle().getBundleContext(),
IProxyService.class.getName(), null);
tracker.open();
IProxyService proxyService = (IProxyService) tracker.getService();
proxyService.addProxyChangeListener(new IProxyChangeListener()
{

@Override
public void proxyInfoChanged(IProxyChangeEvent event)
{
// TODO: your action for proxy changed
}
});
}

}

Sunday, March 22, 2015

Tool for checking MD5 and SHA1 values for any file

Git: Updating a forked repository from the original repository

Let's take a scenario:

This is the remote repository: https://github.com/apache/mystudio.git
Your forked repository from the above:  https://github.com/kolipakakondal/mystudio.git

'development' is the branch name both in remote and forked repository.

1. Add remote repository to forked repository
>git remote add upstream https://github.com/apache/mystudio.git

2.  Fetch from remote repository .i.e upstream
> git fetch upstream

3. Rest your branch(ex: development) to the remote branch(ex: development)
> git reset --hard upstream/development

4. Pushed changes which we got it form remote repo to remote forked repo.
> git push origin  development --force






Friday, March 20, 2015

Debugging an Installer Plugin


Step 1 : Configure your Xcode project

1Open your plugin project in Xcode.
2Choose Project > New Executable…
3Click Choose.
4Select Installer.app.
You can find Installer.app in /System/Library/CoreServices on Mac OS X 10.5 (or later) and in /Applications/Utilities on earlier versions.
5Click Finish.
6Choose Project > Set Active Build configuration > Debug.
7Choose Build > Build.

Step 2 : Debug

1Add breakpoints in Xcode
2Copy your plugin into the Plugins folder.
3Choose Debug > Debug Executable in Xcode.
4Open your package with Installer.app.


Product->Scheme->Edit scheme -> 
This will launch below screen








Wednesday, March 18, 2015

How to identify mac os Eclipse is 32 bit or 64 bit ?

These are the flags you can look at to identify whether your Mac Eclipse is 32 bit or 64 bit ?

Navigate to this menu:
Eclipse ->About Eclipse -> Click on "Installation Details" -> Click on "Configuration" tab->

And look for these parameters:

macosx
-ws
cocoa
-arch
x86_64

Here x86_64 represents 64 bit eclipse.

For 32 bit eclipse, you will find only x86. 
macosx
-ws
cocoa
-arch
x86


There are few more parameters that also represent the same.
org.osgi.framework.processor=x86-64
osgi.arch=x86_64

Upgrade node.js via npm

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

This will install the latest stable version.

If you want to install a specific version.
sudo npm n 0.10.34

This will install 0.10.34 version.

Just to cross check, use below command. This will print the installed version.
node -v