[Quicktip] Importing a “dependencyManagement”-section from an external artefact

Situation: You have a parent pom with defined dependencies in the “dependency management”-section. This way you do not have to provide versions for your dependencies. Standard-Maven-Stuff.

New situation: BUT for some reason you have to switch to another totally different parent pom with totally different “dependency management”-section. Your previously declared dependencies have no version, so there will be errors when invoking maven on this pom.

One solution: A cool thing you can do since Maven 2.0.9 is the import of the “dependency management”. So still no versions required for your previously declared dependencies…

This is accomplished by declaring a pom artifact as a dependency with a scope of “import”.

The offical documentation can be found here

Advertisements

[Quicktip] Totalcommander, batch-files and foreach

You want to call a cmdline-tool, but this tool only supports only one file per invocation? But you have to process hundreds of files? With the following approach (in combination with the Totalcommander) you can select many files and handle each file sequentially.

Setup:

  1. create a batchfile named foreach.bat
    @echo off
    REM call it via 'foreach.bat filewithfilenames'
    
    SET filewithfilenames=%1
    
    for /f %%f IN (%filewithfilenames%) do (
        REM insert your code here, the current iteration item is %%f
        echo %%f
    )
    
  2. create a startermenu entry in totalcommander
    • name: foreach...
    • command: foreach.bat
    • parameter: %L

Usage:

  • mark all files to be adressed in Totalcommander
  • call the newly created startermenu entry “foreach...

Explanation:
When calling the startermenu-entry the Totalcommander will save the filenames of the selected files in a temp-file and will provide the filename of the temp-file as parameter. That is the magic of the parameter %L. (Perhaps such a scheme is also available in Speedcommander, Freecommander and other tools like that?! I do not know…)

Now this temp-file can easily be read using a special syntax of the “for-loop” of the Windows command line (cmd).  Type in "for /?" in your cmdline for more details on this syntax and see the example above (<code>%%f</code> in line 6).

[Quicktip] faster usage of FreeMind

FreeMind (an open-source mindmapping tool) has some handy features, which may also improve your productivity:

  • Shortcuts: Use the shortcuts like ENTER and INSERT and navigate via the ARROW keys!
  • Creating subnodes from your clipboard: If there are several lines of text in the clipboard and you paste its content into FreeMind while a node is selected, then several subnodes will be created. That is really cool and i discovered it by accident!

FreeMind can be downloaded from http://freemind.sourceforge.net/

[Quicktip] Easy split in T-SQL

I found a cool and easy solution for splitting a text value into its components. See post @stackoverflow.com.

SELECT 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),3)) DB1, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),2)) DB2, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),1)) DB3, 
    ProductDescription
FROM #TABLE T

The magic is done via the PARSENAME-function.

SMALL ISSUE: It only works for items which have 4 components.

--This will not work!!
SELECT 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),5)) DB1, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),4)) DB2, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),3)) DB3, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),2)) DB4, 
    LTRIM(PARSENAME(REPLACE(ProductDescription,'-','.'),1)) DB5, 
    ProductDescription
FROM #TABLE T

[Quicktip] JMeter – Own graphs/diagrams using csv-export

You want to create good looking graphs, but JMeter doesn’t provide them? You want to compare several testruns and present the results in one graph? But you do not want to code a plugin for JMeter or don’t want to parse the *.jtl file via XSLT?

Then use the easy but often overlooked  csv-export feature of JMeter:

  • Add a listener like “Aggregate Report” (includes 90% line) or “Summary Report” (includes standard deviation) to your project.
  • Record or load your testdata
  • Navigate to the listener and click on the button “Save Table Data” at the bottom and save the result as a file.

That did the trick. You got a CSV file, which you can import into your favourite spreadsheet application and create diagrams from the data.

With a little bit of tweaking the diagram options you can create diagrams like the following example, which compares two testruns. Such type of diagram is easy to understand and shows possible performance improvements in the same scale…