Seeing changes and diffs introduced by particular revision in mercurial

How to get changed files by revision in mercurial?
Here is a simple tricto see the diffs of files by revision in mercurial (hg)

Say if you want to see the changes by revision number 8976 then

to see the changed files :

hg status –change 8976

and to see the diff

hg diff –change 8976

Updating repository with previous revision in SVN

OK, you want to update the current repository with one of your previous revisions. It could be a single file you want to update
Here is what you would do:
Lets assume you have a module/folder svnrepos and it has two files soap.php and xml.php
And lets say you want to update and commit the file soap.php with the previous revision number

1. Go to the folder svnrepos
2. type svn up to make it up-to-date
3. type svn log –limit 10 (or whatever deep you want to go the past revisions
4. From there you would grab the revision number you want to get back to.
Now the trick is merging the current revision and the one you want to get back to: lets say the revision number you want to get back is 7865
5. do svn merge full/path/to/repository/svnrepos/soap.php@HEAD full/path/to/repository/svn/repos/soap.php@7865 soap.php
This would update your local, which was up-to-date, to the one from 7865.
6 svn st would show you soap.php is updated
7. svn commit -m ‘Reverting back to old revision’

ZAT is IT!!

Eclipse Helios Classpath Error While Working With Maven

I usually work on both terminal and Eclipse for my development.
Like compiling, creating of the war using maven and usage of Tomcat from terminal, and for coding Eclipse.
But, there are times I might need Eclipse like for debugging. And I want to run Tomcat from Eclipse itself.

I was using Helios, the project runs great from terminal. But, when I try it from Eclipse, it is not publishing it b/c it can’t get the jars.
I have updated the maven dependency and everything seems there. Like when I am developing, Eclipse knows about the imported files and I had no problem.

In short, eclipse can’t import the jars from maven or eclipse class path error was there while reading from maven.

Solution to how to import dependencies from maven to eclipse or how to import jars from maven to eclipse

1. Make sure you have the M2E plugin on your eclipse. To check that:
1.a Go to Eclipse–Help–Install new software
1.b On the work with text box insert Sonatype – http://m2eclipse.sonatype.org/sites/m2e and follow the wizard
When you are done restart your eclipse

2. Check if M2_REPO class path variable is there. To check that:
2.a Window–Preferences–Java–Build Path–Classpath Variable in this there should be M2_REPO variable being set. If it is not set, click the New button and add the repository of your maven path there.

3. Go to Window–preference–Maven–User Settings and check if there are not any warnings there. Mostly on User Settings. If there is one, update with the correct one. I am on Ubuntu and mine is on /etc/maven2/settings.xml

Go to your terminal and issue mvn eclipse:eclipse
then, right click on your project–maven and hit update dependencies.
Here is the fun part::
right click on your project, select build path and look at the library tab your dependencies would be listed there with M2_REPO path at the beginning
Then, Click on Deployment Assesment, it is right above Java Build Path, Select Java Build Path Entries
Hit next, select all the listed ones and hit finish

Refresh the project, clear the tomcat and all should be fine.

This should fix your eclipse class not found exception only because it not reading from maven correctly problem

Maven J2EE Eclipse: Hello world in J2EE and Maven on Eclipse

Step by step tutorial on J2EE and Maven on IDE Eclipse

Here is a simple yet basic tutorial for a J2EE application using maven and Eclipse from the scratch showing you step by step.

This tutorial assumes you know the basics of Maven and J2EE. This is just a step by step tutorial to show the marriage of the two.

Also, it is assumed that you have installed maven and tomcat on your machine which are fairly easy to do with simple googling.

Lets Start

1. Create simple Hello world module on Eclipse
1.a Open Eclipse Go to file->new->Dynamic Web Project
1.b Name the project as MavenEclipseJ2EE and hit Finish

We have finished the first step.

Now, maven expects some kind of folder structure. Well, you can do it in your own way and make extra configuration, or you can accept what is accepted as standard and have fun.. I go with the standard maven directory structure.

Here is the maven structure


src/main/java
src/main/resource
src/main/webapp

These are going to the source folders. So lets create them.

2. Creating source folders that are acceptable by maven

2.a Go to terminal or how ever you would create folders and create the folders as:

MavenEclipseJ2EE/src$ mkdir main
MavenEclipseJ2EE/src$ mkdir main/java
MavenEclipseJ2EE/src$ mkdir main/resources
MavenEclipseJ2EE/src$ mkdir main/webapp

2.b Go back to Eclipse, select the project and hit F5 or right click on Project and hit refresh. You will see the newly created folders under src

2.c Right click on the project, select properties, select build path and hit source tab

2.d You would see the previous source folder there. Select it and hit remove to remove it. We do this since we are changing the source folders

2.e Then hit the button add folder, expand src, expand main and select the java, resources and webapps only. Hit OK and hit OK again to finish creating source files.

Cool, so our folder structure is ready for Maven. Now lets move to the maven itself.

Maven relies highly on the pom.xml file that we would put on the project root folder. Lets do that.

Continue to part two

Server sent unexpected return value (405 Method Not Allowed) in response to MKCOL request error in svn

The error pops up when trying to commit to the repository.

This SVN error happens when trying to add the directory/file to the repository while the directory is already existing.

It can happen when one of the coworker creates a directory and commits and the other one tries the same task [svn add directory/file] without updating from trunk first.

Solution

A couple of options are there for this.

1. Update to the repository and deal with the conflicts if there are any.
2. if the created directory is assumed to be redundant, delete the directory and recommit it.

Also: Checkout how to identify changes in SVN

Adding Date to the template in netbeans

Updating netbeans template with date

It is common for the source code file to contain the name of the author, copyright notices, the purpose of the script and the date as well.

Can you find the longest palindrome from given sequence of characters?

IDEs would come with template of the source file to auto populate that for you. Netbeans is also doing that.

Netbeans also provides default template placeholders for author and other artifacts.

Importing packages to eclipse from maven – See how easy it is

All the others seems easy to proceed, but if you want to add date [@since] to your source file in netbeans here is how to do it.

Here is how you can add automatic date to the template.

1. Go to tools->templates
2. Select file that you are working on
3. add @since ${date} to the template where you would want to show date

 

Step by step tutorial for nodejs, angularjs and mongodb

Passing all jars to classpath from command line when compiling java

SVN integration to Eclipse setup and error – unable to load default svn client

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
-vmargs
-Djava.library.path=/usr/share/java/
-Djava.library.path=/usr/lib/jni/
-Xms128m
-Xmx512m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins

http://subclipse.tigris.org/update_1.6.x – depends on what eclipse you have – check this for compatibility. how do i know what version i have.

sudo apt-get install libsvn-java

default path /usr/lib/eclipse/eclipse.ini

http://ubuntuforums.org/showthread.php?t=916633

One of prevailing repository tools is SVN. I like and use it. I am also a fun of eclipse. The two would make programming cool.

To install SVN in eclipse

Go to http://subclipse.tigris.org/ and see the download and install link. Check which to install based on the Eclipse version – which is depicted on the page.

Install JavaHL

From your command line in Linux: sudo apt-get install libsvn-java.
This is the major factor for the unable to load default svn client error.

Finally

Update your eclipse.ini by adding this line just next to -vmargs at the end
-Djava.library.path=/usr/share/java/
-Djava.library.path=/usr/lib/jni

The location of eclipse.ini would be in your installation folder. The default location for eclipse which loaded from package would be /usr/lib/eclipse/eclipse.ini

Now, restart your Eclipse and enjoy SVNing.