Monday, November 23, 2015

How to uppercase string in linux command line

Presume you have a text:

and you need to convert test to upper case by smth in OS

1) Wrap text with "tr [a-z] [A-Z]<<EOF" and "EOF" at top and bottom respectively and copy to terminal.

tr [a-z] [A-Z]<<EOF


go to browser and do search for any online service that do uppercase: 

Sunday, October 18, 2015

Software Quality Award comment for Checkstyle

ATTENTION: non of following should be treated as appellation or demand to reconsider review of Checkstyle project in Award. This post is targeted only to contributors who asking why Checkstyle missed so obvious points.

> 83K Java LoC, 553K HoC

suseika/inflectible (5K LoC, 36K HoC) - winner
testinfected/molecule     (10K LoC, 43K HoC)
coala-analyzer/coala      (14K LoC, 160K HoC)
xvik/guice-persist-orient (17K LoC, 54K HoC)
raphw/byte-buddy      (84K LoC, 503K HoC)
citiususc/hipster   (5K LoC, 64K HoC)

checkstyle/checkstyle (83K LoC, 553K HoC)
kaitoy/pcap4j         (42K LoC, 122K HoC)

we are second biggest project in Final. But we are the oldest projects, we are almost 15 years old. That point will explain some design problems below.

> There are many ER-ending classes, like SeverityLevelCounter, Filter, and AbstractLoader (for example), which are anti-patterns.

That is controversial anti-pattern and I will explain why there is no damage this in separate post. No comments for this point, it is just philosophy of Award owner. 

> There is a whole bunch of utility classes, which are definitely a bad thing in OOP. They are even groupped into a special utils package, such a terrible idea.

Utility is good as it is stateless realization of algorithms. Mismatch of design philosophy between Author and us.

> Setters and getters are everywhere, together with immutable classes, which really are not an OOP thing, for example DetectorOptions.

Yes, that is effect of 15 years old project and numerous existing Checkstyle's integration and extensions that already exists in this world. We can not changes this - it will be huge compatibility damage. Nobody will benefit from such update. But we will already in progress to make Checkstyle more immutable.
Attention: getter/setter is very controversial anti-pattern (mutability is a concern, but there is not problem in naming), I will explain this in separate post.

> NULL is actively used, in many places — it's a serious anti-pattern

Yes, that problems comes from core Checkstyle - ANTLR2 parser.

> I've found five .java files with over 1000 lines in each of them, for example 2500+ in

Yes, and we do this on good reason. First of all is in test ares, secondly it is generated :).
There are exceptions in rule for big files:
2) UTs are also in exclusion, as it is easier to find from class --> and not puzzle what  mean (and how author decide when test should go second test file). So it is OK.

> There are direct commits to master made by different contributors and some of them are not linked back to any tickets. It's impossible to understand why they were made. Look at this for example: 7c50922. Was there a discussion involved? Who made a decision? Not clear at all.

Such commit is mine :). But we do have strict control of commit message, we are even more fanatic than all other projects. Whole idea is described - . There is no problem with direct commits, especially from the most experienced owners of it (see all details in wiki link).

Releases are not documented at all.

It is first time I see that somebody pay attention to , we do have Release Notes in human friendly way on our main HTML site -  (it is not a list of commits !!!! users do not need commits!!! )

> Release procedure is not automated. At least I didn't find any release script in the repository.

It is automated and done by standard maven procedure "mvn release" no need for special shell file and we are multi-OS project (Linux, Windows, MacOS). 
Release is not a binaries copy to artifact repository!  Here is detailed instructions on how to make a release - with all details of how systems should be prepared and what should be updated after version bump. But I agree, I would be happy to automate it. For now it does not make sense to spend time on difficult automation, if we release ones a month.


some quotes from Award page:
I'm a big fan of object-oriented programming in its purest form
Strict and visible principles of design.

We participated in Pure OOP contest. I do not share fanatic following of pure OOP designs, I am more in favor of changes to be more functional. Any re-factoring in favor of OOP is not possible without braking compatibility with plugins/extensions.
So 7th place is very good.

Friday, October 16, 2015

Code coverage could help to detect dead or extra code

Code coverage could for help detect dead code or useless conditions, see example at

No way to reproduce in UT it mean that code is dead or useless.

Interesting automation for dead code removal base on code coverage (Guantamo project) - 

How to cache maven local repo between Travis builds

caching is allowed only for private repos or public repos that use "Using container-based infrastructure".

1. instruct travis to use "container-based infrastructure"
2. instruct travis what folder you need to cache

Official documentation:

Results: that caching speedup build on ~3-4 minutes for each jdk.


Oracle jobs creation and logging activation

create job , configure logging and enable it:

   job_name           =>  'TEST_SCHEDULED_JOB',
   job_type           =>  'PLSQL_BLOCK',
   job_action         =>  'BEGIN select * from  myschema.mytable; END;',
   start_date         =>  TO_DATE('14/01/2015,12:00 AM', 'DD/MM/YYYY,HH:MI AM'),
   repeat_interval    =>  'FREQ=HOURLY; INTERVAL=4',
   end_date           =>  null,
   job_class          =>  'DEFAULT_JOB_CLASS',
   comments           =>  'detection and notification of ORA- errors in log files.  Notify admins');



Check that job scheduled correctly:

select last_start_date, next_run_date 
where job_name = 'BOD_CHANGE_SYSDATE' ; 

after testing drop a job :

 DBMS_SCHEDULER.drop_job (job_name => 'TEST_SCHEDULED_JOB');

Filter logback events by time


<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- perform more precise filtering, you can suppress particular messages here -->
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">

     java.util.Calendar cal = java.util.Calendar.getInstance(java.util.TimeZone.getDefault());
     int hour = cal.get(java.util.Calendar.HOUR_OF_DAY); //HOUR_OF_DAY is required for 24h format
if (hour > 14) {
return false;

return true;
<OnMatch>NEUTRAL</OnMatch> <!-- we may want to add more filters later -->


Oracle SQL to show all columns for all tables in particular schema

Oracle SQL to show all columns for all tables in particular schema:

SELECT   table_name, SUBSTR (MAX (all_columns), 2) all_columns
       FROM (SELECT     table_name,
                        SYS_CONNECT_BY_PATH (column_name, ',') all_columns
                   FROM (SELECT table_name, column_name,
                                ROW_NUMBER () OVER (PARTITION BY table_name ORDER BY column_id)
                           FROM all_tab_columns c
                          WHERE c.owner = 'YOUR_SCHEMA'
                            --AND column_name NOT IN ('OLD_', 'DEP_')
             CONNECT BY PRIOR table_name = table_name
                    AND PRIOR column_no = column_no - 1
             START WITH column_no = 1)
   GROUP BY table_name;

output is like: