Thursday, May 26, 2016

Waking up Heroku app

Deployment is not enough to wake it up. I just hit the URL in the browser :) Unfortunately if you use a free dyno for a hugbot that is integrated with slack, you need to wake your dyno up after recharging period.

Wednesday, April 20, 2016

Oracle PLSQL alert table add not null column with default value throws exception

I was trying to run following script:
alter table qrtz_blob_triggers add sched_name varchar(120) not null DEFAULT 'TestScheduler';

I kept receiving a following exception:
alter table qrtz_blob_triggers add sched_name varchar(120) not null DEFAULT 'TestScheduler'
Error report -
SQL Error: ORA-30649: missing DIRECTORY keyword
30649.0000 -  "missing DIRECTORY keyword"
*Cause:    DEFAULT DIRECTORY clause missing or incorrect.
*Action:   Provide the DEFAULT DIRECTORY.
I had to change the order of a query (default before not null):
alter table qrtz_blob_triggers add sched_name varchar(120) DEFAULT 'TestScheduler' not null;
I will keep this as an example for people that keep telling me that SQL is a declarative/functional language, and not something that Scarily Qualifies as a Language

Monday, March 21, 2016

Maven command to run tests in a selected module and ignore failures and redirect output to a file

This is useful when I want to see all the failed tests, and I want to have it in file so I can easily navigate thru entire output - for example to search for errors.
mvn -f system-tests/pom.xml -Dmaven.test.failure.ignore=true clean install > myout.txt

Tuesday, February 23, 2016

NoClassDefFoundError - classloaders in Java

Key concepts

  1. There is a hierarchy of classloaders
  2. Class loader may delegate to its parent
  3. Parent may load class
  4. If none of loaders loaded the class -> NoClassDefFoundError

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.