Find a Class in a bunch of JAR Files

Flattr this!

for j in *.jar; do echo $j:; jar -tvf "$j" | grep -Hsi ClassName; done

  1. Iterate over every jar in your folder.
  2. Output every JAR Name (to match found classes to JARs lateron)
  3. List Content of every JAR ( jar -tvf “$j” )
  4. Grep for that specific ClassName grep -Hsi ClassName

Original Post: https://coderwall.com/p/7d-mta/find-a-class-in-a-bunch-of-jar-files

SSH Tunnel RDP Session over another Host

Flattr this!

Let’s say you want to tunnel an RDP connection via SSH.
User: phaus
SSH-Server: ssh.example.com
RDP-Server: win2k8.example.com

#!/bin/bash
ssh -L13389:win2k8.example.com:3389 phaus@ssh.example.com

You need to run that script and keep your session open.
You can then access the remote System with a RDP Client over localhost 13389.

Original Post: https://coderwall.com/p/wzvxhg/ssh-tunnel-rdp-session-over-another-host

Fixing Error installing cocoa-pods on MacOS

Flattr this!

If you installing cocoapods on a vanilla MacOS System you might get some error like this:

# sudo gem install cocoapods
Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -O3 -Wall -O0 -ggdb  -o generator.o -c generator.c
gcc -dynamic -bundle -o generator.bundle generator.o -L. -L/usr/local/lib -L. -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lruby.1.9.1  -lpthread -ldl -lobjc

make  install
/opt/local/bin/gmkdir -p /usr/local/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/.gem.20130925-59217-5zt5ke/json/ext
make: /opt/local/bin/gmkdir: No such file or directory
make: *** [/usr/local/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/.gem.20130925-59217-5zt5ke/json/ext] Error 1

The important error is make: /opt/local/bin/gmkdir: No such file or directory

You need to install coreutils for fixing this.

With MacPorts:

sudo port install coreutils

For Homebrew:

sudo brew install coreutils

Original Post: https://coderwall.com/p/ehijxg/fixing-error-installing-cocoapods-on-macos

use 3rd party Dependencies in your Maven Project

Flattr this!

Deploy your JAR to your local (file) Repository. You shold also commit this to your CVM System. You can also add JARs as Javadoc or Source.

    mvn deploy:deploy-file \
        -DgroupId=<group-id> \
        -DartifactId=<artifact-id> \
        -Dversion=<version> \
        -Dfile=<path-to-file> \
        -Dpackaging=jar \
        -Durl=file:///<project-dir>/repo 
        ( -Dclassifier=javadoc | sources  )

You can now use these JARs in your pom File if they were in a normal Repository:

    <project>
        ...
        <repositories>
        ...
            <repository>
                <id>project.local</id>
                <name>project</name>
                <url>file:${project.basedir}/repo</url>
            </repository>     
        ...
        </repositories>
        ...
    </project>

Original Post: https://coderwall.com/p/r28cew/use-3rd-party-dependencies-in-maven-project