Friday, January 29, 2016

Jenkins: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

If you see following error in Jenskins build and you are using git:
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
It is because someone moved some git branches around, and they are missing. Instead of selecting a branch in Jenkins config modify advance input with:

Monday, January 25, 2016

Maven command to run System tests from CI

I keep system tests in a separate module. Command run by CI to run them is following:
mvn -X -B -f system-tests/reservationsWS/pom.xml --fail-at-end verify install deploy:deploy

Maven install skipping tests

It speeds up install when I just want to recompile everything:
mvn clean install -DskipTests -DskipITs -DskipSystemTests

Saturday, January 23, 2016

UNMET PEER DEPENDENCY kerberos@~0.0, while installing mongoose

I am not sure why it is not in a mongoose documentation, but when you run:
npm install --save mongoose
You receive a following error

I had to install first kerberos in order for mongoose to success.
npm install --save kerberos mongoose

Friday, January 15, 2016

XOR swap - or how to swap two numbers

It used to be explain in multiple books that I read in university, but I do not see a clear and easy to follow explanation in the internet.

Let's say that we have two variables:
x = 5
y = 7
and we want to change the value of these numbers w/o using additional variable. We can achieve it by using using simple basic operation:
x := x + y = 5 + 7 = 12
y := x - y = 12 - 7 = 5
x := x - y = 12 - 5 = 7
But there is a different technique that is more efficient in IT because all the data is kept in binary format, it make sense to take advantage of a simple xor operation to do the work.
x= 101 in binary = 5 in decimal
y= 111 in binary = 7 in decimal

------ x xor y

------ x xor y
y=101 = 5 in decimal

------ x xor y
x=111 = 7 in decimal
One more note. You don't want to code it, because compile should optimize it for you - even when you use additional variable to swap the values compiler should use xor technique to do the job.

Monday, January 11, 2016

Enabling debugging for TomEE+

The simplest way is to edit bin\startup.bat file. Add following two lines:
set JPDA_TRANSPORT=dt_socket
Modify following line:
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
Config options explained on Trifork blog.

Tuesday, January 5, 2016

Nuget repository only looks at Microsoft repository

Recently few things changed in Nuget word. Currently when I run:
get-packages -ListAvailable
It only shows packages from Microsoft.
To be able to use Nuget repo again and be able to install typical libriaries like NUnit one has to add NuGet.Config to a folder that holds the solution file.
<?xml version="1.0" encoding="utf-8"?>
    <add key="NuGet official package source" value="" />
    <add key="local" value="C:\development\PathToYourLocalNugetRepositoryIfYouNeedIt\NugetLocal" />

After modification, Manage NuGet Packages tool should show All, NuGet official package source, local, Microsoft and .NET.

Saturday, January 2, 2016

gulp-jshint@2.0.0 requires a peer of jshint@2.x but none was installed

Just like in title. When you try to run
npm install
In freshly created mean folder
cd  && npm install
You will probably first see

Error and then at the very end
npm WARN EPEERINVALID gulp-jshint@2.0.0 requires a peer of jshint@2.x but none was installed.
In order to fix this issue you need to run
npm install --save-dev jshint gulp-jshint
It will show some invalid operations in a console

But at the end it will work.