Jan 30, 2017

Searching for Java classes outside of your projects in a dedicated path within NetBeans

I'm using NetBeans as my Java IDE.


For my current project, I'm working in multiple maven projects which are using some core framework. But - I do not work in the core framework.

Sometimes I have to look into the Code of the core framework.
How to do this.

Store the Code somewhere on your local disk, open a file browser (in my case Multi Commander) and search for the file.
The bad thing is

  • to switch from the IDE and 
  • to show the code outside of the IDE without any syntax highlighting. 
There is a Plugin available to do exactly this thing in NetBeans. It's called Quick File Search
which is available in the Plugin Manager to install: 





After the installation you have to restart the IDE and configure the plugin in the Tools->Options window:


Provide the Base folder, where to search and after pressing <Ctrl>-<I> you get into the search window in the right upper corner and can start to search for the File or other Types and get also the
list of files from this basefolder outside of any project.

Jan 19, 2017

Jumping between tabs and left/right panle in Multi Commander

I switched over to Multi Commander instead of the default Windows Explorer.

MultiCommander has two panes like the "old Norton Commander"  and in each panel multiple
tabs can be opened - a lot easier than searching the right Windows Explorer window 😃.


  • To change the panels, the keyboard shortcut is <Shift>-<TAB>
  • Switching between Tabs in one panel the keyboard shortcut is <Ctrl>-<TAB> or <Ctrl>-<Shift>-<TAB>  depending on the direction. 
  • For opening a new Tab, the keyboard shortcut is <Ctrl>-<T>
  • Favorites can be retrieved with <ALT>-<BACK> to store shortcuts for different locations. 


executing a chain of/multiple requests with postman

In this post, I wrote about reusing response data for a different request, by storing the information.

But now, I'd like to execute multiple requests one after the other, with just one click.

To get this feature of postman, you define multiple requests in a collection and add some code in
the test section:


This is a simple call and in the Test section, the next request is set by

postman.setNextRequest("bing"); 

The parameter for setNextRequest is the name of the request, as you can see in the collection on the
left side. After defining multiple requests with a "workflow" through request, you can "run" the request.

Select the arrow of the collection and press the run button as can be seen in the next screenshot.


After pressing the "run" button, the collection runner is opened and you can start the "workflow" of
requests:




As you can see, in the middle part you select the collection and the environment to use and press
the "Start Test" button. On the right side, you see the result of each request and on the left side is a
history of the executed sequencies.

Jan 13, 2017

How to allow the focus to follow the mouse in Windows 8.1

Some time ago, I wrote about a method how to get the focus to a background window, without raising it.

After some updates, I searched again for a method to allow the focus to follow the mouse and go to
this posting, which also references my previous source.

For some windows like Word, I have to move the mouse over the taskbar to switch
the focus.

With FullScreenMode on multiple screens, I have also some problems.
Also, the tip to decrease the value of the registry key ActiveWndTrkTimeout is very valuable.

Jan 12, 2017

get a cmd or powershell in windows in a specific directory from Multi Commander

In the previous post, I wrote about starting a shell (cmd.exe or PowerShell) in a specific directory to
which the Windows Explorer is navigated to.

But I mostly use Multi Commander as Windows Explorer replacement. Multi Commander has two
columns, wherein each column multiple tabs can be opened.


To open a shell in a specific directory you can enter "cmd" or "PowerShell" in the red marked text
box followed by a <Return> to start a shell in the directory of the directory of the currently active
tab.


get a cmd or powershell in windows in a specific directory from the explorer

it happens quite often for a developer to start a cmd.exe in a specific directory to start e.g. a
maven compilation.

You have the choice to either type in the path for a cd command or navigate in the Windows Explorer to the target directory, copy the path from the address bar and execute the "cd" with copy/paste in the
cmd.exe shell.

But it is much easier.

Navigate in the Windows Explorer to the target directory  and enter "cmd" or "powershell" in the address bar instead of the path:





and you get a cmd.exe in the desired directory without any "cd"


Jan 7, 2017

Monitoring a docker-engine with portainer (http://portainer.io/)

During the last days, I read about "Portainer" (http://portainer.io/ ), which is a continuation of a
UI fork.

On my local system, I use the Docker Toolbox on Windows 8 for my experiments.

After some attempts, I failed to get any data, but now I got it up and running.



  1. start a machine for docker (already created or create a new one)

    docker-machine start java
  2. set the environment in your shell (in my case Powershell)

    docker-machine env java | Invoke-Expression
  3. Pull the Image

    docker pull portainer/portainer
  4. Start the portainer container

    docker run -d -p 9000:9000 --name portainer portainer/portainer
With this steps, the preparation is finished. Now we can access the UI in a browser. 
To get the IP address of the docker-machine you can use the environment or the docker-machine command:

$env:DOCKER_HOSTdocker-machine.exe ip java

On the first access to the container you have to define the admin password: 






































After the password definition, you get a login where you enter the new password. 


The next step is, to define the first endpoint, which is guided:

Here you provide a name (which is shown in the UI), the IP-Address of the docker-machine with
the port (you get it from the $env:DOCKER_HOST environment variable).

The docker-machine is secured by TLS, so you have to provide the certificates.
The files can be found under your home directory:
C:\Users\<user>\.docker\machine\machines\java

After this, you continue with the "Connect" Button and get a screen with a failure box:


Here I always thought, I did something wrong. The problem is, that the new endpoint is not used!!

When you select the endpoint on the left side under "ACTIVE ENDPOINT", you get the data: 


With this UI, you can do a lot of basic stuff on the docker-machine like starting/stopping/killing containers. Pulling Images, maintaining the network part and a lot more. 

Dec 21, 2016

cherrypicking with TortoiseSVN (subversion)

Now I have to work again with Subversion (TortioseSVN on Windows) as VCS system.

To get only the changes of one specific revision to a different branch, the keyword for searching
is cherry picking.

TortoiseSVN supports the create and apply a patch, but creating a patch only works on the current
working copy - before the commit.

When you want to have a patch from one specific revision, you can

  • show the log
  • mark a/the revision(s) you like to have in the patch
  • Show as unified diff 

  • This displays a window with the changes in a unified diff format. 
  • In the Files-Menu, you can select "Apply Patch...", which opens a
    directory selection dialog, where to apply the patch.

  • the following window allows you to selected the each or all files to apply

REST-Testing with Postman and using response data for next request

Currently, I'm using Postman to run Request against an OData endpoint.

For calling some request, some HTTP-Headers must be present from the authentication.
Till now, I used the stored request variables in the form {{variable}}.

The new values are manually stored in the Environment, which is selected to execute the requests.


and in the stored request, just references to the variables are made:



But this is a manual task, so automation would be the next step.

After asking Google for help, I found this link: http://blog.getpostman.com/2014/01/27/extracting-data-from-responses-and-chaining-requests/

Adding Tests in the request part (upper part in postman) to the first request let's see in a quick overview if everything went well.
It allows setting environment and global variable, which can be referenced as before in the upcoming request.


After executing the request, you can see the result of the 'tests' in the response part (lower part in postman):


After the execution, the variables are set with postman.setGlobalVariable and all further request
using this variable can be executed without any manual intervention.
If you have the variables set somewhere else, they might be overwritten, so be careful and delete them from the environment.

Nov 13, 2016

First experiments with Apache ZooKeeper - a distributed Key-Value Store.

Apache ZooKeeper is a distributed Key/Value Store and more, which can be used as a kind of
registry for the currently modern MicroServices architecture.

My first attempts were to let 3 instances run as a Docker Container.

As the base for my start, I used the available docker image jplock/zookeeper from the docker registry.

Before starting with the zookeeper containers, I built my own image by adding my own configuration  for zookeeper:

FROM jplock/zookeeper
MAINTAINER ......

ADD conf/zoo.cfg /opt/zookeeper/conf/zoo.cfg

The content of zoo.cfg is:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo2:2888:3888

And the containers are started up with the help of docker-compose with the following 
docker-compose.yml configuration: 

version: '2'

services:
  zoomaster:
    image: ewer/zookeeper
    ports:
      - "2181:2181"
    expose:
      - "2181"
      - "2888"
      - "3888"
    labels:
      zookeeper: master
    volumes:
      - /c/Users/name/docker_volumes/zoo1:/tmp/zookeeper
    container_name: zoo1
  zooclient2:
    image: ewer/zookeeper
    ports:
      - "2182:2181"
    expose:
        - "2181"
        - "2888"
        - "3888"
    labels:
      zookeeper: master
    volumes:
      - /c/Users/name/docker_volumes/zoo2:/tmp/zookeeper
    container_name: zoo2
  zooclient3:
    image: ewer/zookeeper
    ports:
      - "2183:2181"
    expose:
      - "2181"
      - "2888"
      - "3888"
    labels:
      zookeeper: master
    volumes:
      - /c/Users/name/docker_volumes/zoo3:/tmp/zookeeper
    container_name: zoo3

As you can see in the volumes, per default only the homedirectory is mounted into the 
boot2docker Image of the docker engine, using the cygwin path 
A precondition zookeeper needs is a file called myid in /tmp/zookeeper with sequential numbers. 


After creating a docker machine on windows with 
docker-machine.exe create java

and setting the environment by the help of 
docker-machine.exe env java 


docker-compose up -d 

After installing a local version of zookeeper to get the commandline client the first test could be 
done: 

The IP-Adress is the one from the docker-machine ( retrieved by docker-machine.exe env java )
and the port is sequentially configured for each container in the docker-compose.yml

Connecting to the container zoo1 and creating some data: 
PS C:\dev\Docker\zookeeper\zookeeper-3.4.9\bin> ./zkCli.cmd -server 192.168.99.100:2181
[zk: 192.168.99.100:2181(CONNECTED) 19] create /vsop 1
Created /vsop
[zk: 192.168.99.100:2181(CONNECTED) 20] create /vsop/eaiserver 1
Created /vsop/eaiserver
[zk: 192.168.99.100:2181(CONNECTED) 21] create /vsop/eaiserver/port  8181
Created /vsop/eaiserver/port
[zk: 192.168.99.100:2181(CONNECTED) 22] ls /vsop
[eaiserver]
[zk: 192.168.99.100:2181(CONNECTED) 23] ls /vsop/eaiserver/port
[]
[zk: 192.168.99.100:2181(CONNECTED) 24] get /vsop/eaiserver/port
8181

Now connect to the container zoo2 and check the data there: 

PS C:\dev\Docker\zookeeper\zookeeper-3.4.9\bin> ./zkCli.cmd -server 192.168.99.100:2182
[zk: 192.168.99.100:2182(CONNECTED) 24] get /vsop/eaiserver/port
8181
cZxid = 0x60000000d
ctime = Sat Nov 12 18:42:15 MST 2016
mZxid = 0x60000000d
mtime = Sat Nov 12 18:42:15 MST 2016
pZxid = 0x60000000d
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0