March 2, 2014

If pushing to a non-default branch, you need to specify the source ref and the target ref :git push origin branch1:branch2

Fetch from Original Forked Repository or any other Related Repository :

First you need to add the desired repository as a remote :

$ git remote add upstream https://github.com/wso2/product-esb

This remote will be referred to as 'upstream' now. Then you can fetch from this upstream. You can verify the added remote repositories as below :

$ git remote -v

originhttps://github.com/maheeka/product-esb.git (fetch)

originhttps://github.com/maheeka/product-esb.git (push)

upstreamhttps://github.com/wso2/product-esb (fetch)

upstreamhttps://github.com/wso2/product-esb (push)

Now merge the changes to the local branch :$ git merge upstream/master master
upstream/master is the upstream branch that you need to merge from and master is your local branch. If you are merging to another branch use that branch name instead of master.$ git merge upstream/branch branch

July 23, 2012

If you have got the above error message when you try to open a MS Office file in eclipse, that means your OLE editor is not working in eclipse. When i googled I found that this is a common problem for Excel files. So I suggest to set the Excel files to open in Excel editor instead of OLE editor. So, do the following ;

June 29, 2012

When you cannot decide the number of parameters you need for a method, varargs becomes the solution. Earlier, if we couldn't determine such, we had to use a collection as a parameter to help with this scenario. But varargs simplifies this.

Varargs does use an array underneath, but using varargs syntax hides the process.

public static String format(String pattern,
Object... arguments);

Example :

If you need to write a file name extension filter for a number of extensions, you can use this method of defining the method.

June 22, 2012

In order to find the frame that contains a component, it is necessary to walk up the component's parents until the frame is encountered. SwingUtilities.getRoot() is a convenience method that finds the frame.

This example implements an action that finds and hides the frame of the component that triggered the action. See also Creating a JButton Component.

February 5, 2012

For a graph with v vertices, the spanning tree contains (v-1) edges. Also the number of spanning trees can be given by vv-2 (Cayleys, 1889). Using this formula, lets determine a relationship between number of constraints and the number of spanning trees. Consider the following complete graph with 4 vertices. The colored edges will be the constraints (compulsory edges) we will consider.

According to Cayleys formula there has to be 44-2=16 spanning trees for the graph and each spanning tree contains (4-1) = 3 edges. The image below shows all the spanning trees.

According to the spanning trees, lets consider the number of spanning trees when constraints are present.

# Constraints

Constraints

# Spanning trees

0

No constraint

16

1

Blue

8

1

Red

8

1

Green

8

2

Blue, Red

3

2

Blue, Green

4

2

Red, Green

3

3

Red, Green, Blue

1

Conclusion:

According to the above numbers, although there is a relationship when one constraint is present (Vv-2/2), there is no such linear relationship when two or more constraints are present. If the two compulsory edges are adjacent then the number of spanning tree is lesser. When the number of constraints equals the number of edges in spanning tree, only one spanning tree exists.