Wednesday, March 9, 2011

Mercurial and Git cheatsheet

We are using Git and Mercurial for many different projects. Apart of suffering often of confusion in command usage, I am still trying to figure out tricks and understand advanced features. here I will try to keep a cheatsheet uptodate. Corrections are welcome, as well as comments about how to fill in the gaps. Whatever comes in and makes sense, I will update the cheatsheet.

In this I am not trying to show how that git and hg are the same. I only want to show how common tasks could be done in the two versioning systems. Please be aware that (as some commented) this might create confusion, since there is no 100% same way to do things and branches, tags and whatever do not always have the same meaning in both worlds. So please be careful. I find the cheatsheet useful, so might others

Discussion ongoing in the comments section.


--- update 1: Wed Mar 9 11:22:54 CET 2011

Monday, March 7, 2011

Perhaps not everyone knows that... line tools in uDig

While adding some small tools to handle orientation and moving of features, I noticed that I didn't even remember that I had added the possibility to show a profile of a feature over a coverage (!!).

So I though that if I don't know it perhaps many others might not know.

So here some it is, select a feature and a coverage layer, and it will appear as operation:




If you have to handle lots of data and need to analyse them and move them around, the following tools might also be of use:



View line orientation:




Invert orientation of any 2d geometry:



And moving features one layer up or down:



To help in being really fast, here the shortcuts:

- move features a layer up: Alt-Shift-W
- move features a layer down: Alt-Shift-Z
- view line orientation: Alt-Shift-A
- invert geometry orientation: Alt-Shift-S

Saturday, March 5, 2011

BeeGIS in osgeo4w

As promised we now have also BeeGIS coming with the osgeo for windows installer.

Again, want to try it out? Just run the installer here and search for BeeGIS in the advanced install. The BeeGIS extentions will appear in the uDig istallation.

Friday, March 4, 2011

uDig in osgeo4w again with 1.2.1

After some nice user making me notice that I was laging 3 years behind with the uDig version in the osgeo for windows installer, I wrapped myself up and with the gentle help of the osgeo guys (I had 2 tickets open since 3 years :( ) I got back on track.

The result is that uDig 1.2.1 is available in the osgeo4w installer. I really like the installer of osgeo4w and I will definitely put also BeeGIS as an installation option into it.

Want to try it out? Just run the installer here.

Monday, February 21, 2011

Geotools SWT/JFace module and its RCP integration

After some discussion in the geotools mailinglist about the possibility of a SWT port of the geotools swing module, Ian Mayo from the Debrief project funded the port. He also wanted the resulting port and documentation to be Open Sourced (thanks!).

The result looks like:


A tutorial adn the source code about how to get there are here.

Wednesday, February 16, 2011

Copy Maven Dependency Tree jars

Well, it is the second time I need to get the jar on which a maven project depends on and copy them into a non-maven application. Sure mvn dependency:tree is your friend to see which jars you need to copy. And there are also maven tasks that can do the copy. But what if I want to copy them over without polluting the pom? I couldn't find a quick way (I am sure someone will tell me :)), so I created a groovy script that would do that for me.

Here it is, change the path to the repo, change the path into which to copy to, and run the thing.




// copy also source jars?
def alsoSources = false;
// copy also javadoc jars?
def alsojavaDocs = false;
// your maven repo path
def repo = "/home/moovida/.m2/repository/"
// path to which to copy them
def copyPath = "/home/moovida/development/gt-swt-port-hg/rcp-gt-swt/libs/"


def mvnCommand = "mvn dependency:tree";
def proc = mvnCommand.execute();
proc.waitFor();

def output = proc.in.text;
// clean out what we need
def lista=[];
def lines = output.split("\n");
def depsList = [];
def startIndex = -1;
def endIndex = -1;
for (int i = 0; i < lines.size(); i++){
def line = lines[i];
if(line.startsWith("[INFO] [dependency:tree]")){
startIndex = i + 1;
continue;
}
if(startIndex != -1 && line.startsWith("[INFO] ----------")){
endIndex = i - 1
break;
}
if(startIndex == -1){
continue;
}

lista << line;
}

println "Search for:"
lista.each{
println it
}

println "---------------------------------------"
println "---------------------------------------"

// find jars
def basedir = new File(repo)
def files = [];
basedir.eachDirRecurse () { dir ->
dir.eachFileMatch(~/.*.jar/) { file ->
files << file
}
}

// extract name pattern and version
def fileBeginList = []
def versionList = []
lista.each{
def split = it.split(":");
fileBeginList << split[1]
versionList << split[3]
println "${split[1]} --- ${split[3]}"
}

def finalList = [];
// extract right jars paths from list
for (it in files){
def name = it.getName()
def path = it.getAbsolutePath()

if(!alsoSources && name.matches(".*sources.*")){
continue;
}
if(!alsojavaDocs && name.matches(".*javadoc.*")){
continue;
}

for (int i = 0; i < fileBeginList.size(); i++){
def fBegin = fileBeginList.get(i);
def version = versionList.get(i);
if(name.startsWith(fBegin)){
if(name.matches(".*"+version+".*")){
finalList << it;
break;
}
}
}
}

println "---------------------------------------"
println "---------------------------------------"
println "Found:"
finalList.each{
println it
}


println "---------------------------------------"
println "---------------------------------------"
if(copyPath){
println "Copy deps jars to: ${copyPath}"
finalList.each{
def name = it.getName();
def path = it.getAbsolutePath();
def newPath = new File(copyPath, name).getAbsolutePath();
new AntBuilder().copy ( file : path , tofile : newPath )
}
}





Worked well for me.

Thursday, February 3, 2011

uDig 1.2.1 is out

Copied over from the official uDig blog:

We have recently released uDig 1.2.1. This is an incremental update with mainly bug fixes but there are a few notable features added as well.

  • Additional style editor pages; thanks to the JGrass project and Hydrologis
  • Access to the latest GeoTools renderer with support for hatch patterns
  • Access to world+image "bmp" files
  • Experimental - WMS 1.3.0 support
  • Updated "submit log" in the help menu
Additional documentation:

  • Updated online help capturing the new style pages style pages
  • Updated intro documentation for users and developers

For developers:

  • We have migrated to a new git repository http://gitorious.org/udig
  • Access to the latest GeoTools 2.7 Release Candidate

The new release can be accessed and downloaded from http://udig.refractions.net/download/