Thursday, January 3, 2013

Opensource development ecosystem


 My aim was to have compleatly free development ecosystem for one project. Since this is java project I whanted to have java ecosystem. As a source control system was choosen git and that's why project was hosted at github (you know where it is so I don't put link here).
the JenktocatI start looking for free CI service. First I found Travis-CI but to maintain build there I have to make additional file in my repository (but at that time I was a bit lazy to do so). Fortunally I found another service. It's BuildHive from Cloudbees (and here is the link https://buildhive.cloudbees.com/). This service is based on Jenkins-CI and it was first plus. The second plus was the way to configure build. Actually you don't need to configure build, just type shell comands to build project ant that's it. 


Monday, December 17, 2012

How to change your jenkins theme

Why? 

Because I have two environments: development and production. They look very similar and I don't whant to broke production environment during testing

How?

1) Install theme plugin
 
 2) Add your css and js (and img) files under %JEKINNS_INSTALLATION_PATH%/userContent folder

 3) Add links to these files in configuration
 

4)* You may left blank field with JS file if you don't have one

 

What I've got?

With css below 
 #top-panel > * {
    background-color : #B80000 !important;
 }
I've got this result

Wednesday, October 10, 2012

EnvMan4J

Short story 

Recently I evaluated couple of code generation Java frameworks and I faced with one interesting issue. Every framework or application server wants to have XXX_HOME variable and %XXX_HOME%/bin element in a path variable.
I dreamed about tool that do such thing for a long time. And now I decided to write it. I choose Lazarus to write this tool because it must be native application (in case I need to set JAVA_HOME ;) ). Now this program works fine with Windows (I have only one open issue). Hope I will also make Linux version.

Where to get

You may get this application from my github https://github.com/crc83/EnvMan4J

Case study

I made short screen cast because it's better to see once than to hear many times. You may find it here

Monday, August 20, 2012

Eclipse plugins that I like and dislike

EclEmma - code coverage
Checkstyle - check style
Subverse - svn client (remove) TortoiseSVN plugin instead
LogViewer - for Log viewing
JInto -messages (deletes comments in message files)
Jautodoc - javadocs generator
InstaSearch - quick search in all files
GoToFile - fast go to file http://www.muermann.org/gotofile/update
Eclipse2ant - creates ant build script easily (ugly ant script)
Subclipse - svn client  http://subclipse.tigris.org/update_1.8.x
QuickImage - for picture viewer (useful in pair with bug tracing system)
AnyEdit - easily replace tabs by spaces and vice versa http://andrei.gmxhome.de/eclipse/
ContextMenu - invokes Explorer context menu http://timealias.bplaced.net/ContextMenuPlugin/update/
EasyShell - Opens system shell in eclipse
GrepConsole - Allows you colorify console output

Wednesday, July 25, 2012

Vim in four days

Vim is the one of the most powerful and widely used text editor. But how can you learn it staying at home with children. The answer is simple and straightforward. You can learn vim by rough memorizing. 
For inspiration you may use any youtube screencast
As a step by step guide I use this book. I read one chapter in 10-20 minutes. Then I try to recollect shortcuts while playing with children. At the evening or on the next morning I try to use them. And here is result of past three days.

1-st day

  • Navigation keys "hjkl".
  • Insert {"i"} and normal {Esc} mode. 
  • page up and page down {CTRL-U CTRL-D}
  • undo {"u"} and block undo {"U"}
  • Home {"^"} and end {"$"}

2-nd day

  • Word by word navigation {"b" "w"}
  • Delete word {"dw"}or couple of words {"d5w"}
  • Append characters to the end {"A"}
  • Delete line {"dd"}
  • append line {"o" "O"}

3-rd day

  • Join lines {"J"} or join five lines at once {"5J"}
  • Find character "s" in line {"fs"}
  • Repeat last modifcation {"."}
  • Record macro for key "n" {"qn" commands... then "q"}
  • Invoke recorded macro {"@n"}

4-th day

I skipped some parts since I don't need it in near future (and they are boring :) ). These parts are:
  • Filtering 
  • Working with windows
Then I stucked with visual block mode. I even can't turn it on (with CTRL-V hotkey). I googled a little bit and found the solution. Use CTRL-Q instead of CTRL-V on Windows.
Visual block mode I'm going to learn with tecnique read and try because I can't imagine behavior of VIM.
BTW: Vrapper fo Eclipse still doesn't support visual block mode.

Sunday, March 11, 2012

Using ZTL (Zkoss testing language) framework and Concordion for integration testing



To use ZTL for integration testing we have to inherit org.zkoss.ztl.ZKClientTestCase. We should initialize some variables for testcase (for example in constructor)
            target = "http://localhost:8080/ZK-demo";
            browsers = getBrowsers("iexplore");
            _timeout=100;
To use Concordion we also have to inherit org.concordion.integration.junit3.ConcordionTestCase. But Java doesn’t allow us to use multiple inheritances. So we should replace one of inheritances to usage. I did it for ZKClientTestCase. All of the fields listed above are protected. I made class ZKIntegrationTestCase that inherits ZKClientTestCase. In that class I made public setters and getters for those fields. So we don’t need to use inheritance for ZTL
public class SpecTest extends ConcordionTestCase{
      private ZKIntegrationTestCase ZKFunctionalTestCase zk;

      public SpecTest() {
            zk = new ZKIntegrationTestCaseZKFunctionalTestCase();
            zk.setTarget("http://localhost:8080/ZK-demo");
            zk.setBrowsers(zk.makeListOfBrowsers("iexplore"));
            zk._setTimeout(100);
You may find patched ZTL library (ztl), sample project(ZK-demo) and sample test project(ztl-demo) here: https://github.com/crc83/ztl
Hope it help you make quick rampup.

All about Concordion you may find here: http://www.concordion.org/
Original ZTL you may also find at github: https://github.com/zkoss/ztl
And forum about ZTL issues is here: http://www.zkoss.org/forum/listComment/17556/1/20

Tuesday, January 10, 2012

Fluent interface in java


Simple and robust.

Task

I need to have several sets of methods of class, that can be invoked in special order using fluent interface. For example I need to have always first init(int a) method in a chain. In a second chain I need to have add(int a) and reset() methods. For the third chain I’d like to have dec(int a) and getValue() methods. getValue() method will return a result.

Solution

It’s good idea to use inner classes.
package org.sbelei;

public class FluentInterfaceSample {
     
      private SecondChain chain2;
      private ThirdChain chain3;
     
      private int value;

      {
            chain2 = new SecondChain();
            chain3 = new ThirdChain();
      }
     
      public static FluentInterfaceSample create(){
            return new FluentInterfaceSample();
      }
     
      public SecondChain init(int start){
            value = start;
            return chain2;
      }
     
      class SecondChain {
            public ThirdChain add(int a){
                  value += a;
                  return chain3;
            }
           
            public ThirdChain reset(){
                  value = 0;
                  return chain3;
            }
      }
     
      class ThirdChain {
            public ThirdChain dec(int b){
                  value -=b;
                  return chain3;
            }
           
            public int getValue(){
                  return value;
            }
      }
     
      public static void main(String[] args){
            int b = create().init(31).add(12).dec(10).getValue();
            System.out.println(b);
      }
}

Sunday, December 18, 2011

Bar-code readers


There is huge zoo of these devices. They are divided to different groups from marketing and user point of view. In this post I'd like to introduce you a third point of view. Point of view of software engineer.

1. Quick start

Bar-code reader is always read only device for PC.
Bar-code reader could be configured via scanning special bar-codes from it's user manual
You can configure many parameters in that way. The most interesting for us are prefix and suffix of code sequence (I'll back to this later in details)

2. Two kinds of bar-code readers

I divided our bar-code readers zoo in two parts: 1. Bar-code readers that interact with PC like HID devices (these includes PS/2 and USB bar-code readers); 2. Bar-code readers that connects via RS-232 port.
Both of these kinds of devices have their advantages and disadvantages.

2.1. HID devices

Pros:
+ Easy to prepare your program to work with them.
+ You have no need to handle reconnection issues and the like.
Cons:
- There is sometimes hard to determine if we have input from bar-code reader or from keyboard (but this can be solved by using a prefixes and suffixes).

2.2. RS- 232 devices

Pros:
+ You always know that input that you receive is from bar-code reader.
Cons:
- You should handle reading from RS-232 port in your program.
- You should handle connection issues in your program.

3.N.B.

If you make some mistakes in configuration of bar-code readers, there is a page with “reset to factory defaults” sequence in user manual (Check if you have this page before making any changes in configuration).  

Tuesday, November 22, 2011

Announcment

I'd like to share some knoledgee about next items:
1. How to deal with interesting devices (Scales, Barcode readers, etc)

Sunday, October 23, 2011

ZKoss UI testing experience

Recently I had experience of developing small set of web applications for internal use. These applications were based on ZKoss AJAX UI framework. During development me and my teammates realized that we need set of UI test just because it easier and faster to test our work automatically than manually.

To solve this issue I take a look at Selenium. We realized that we can’t test ZKoss applications by Selenium itself; we need some additions because id’s of UI elements have been generated automatically by ZKoss (see presentation about it at slideshare and video (Ukrainian language) here ).

Fortunately ZK team have made testing framework on the top of Selenium to test their components. So I made a fork of this framework at github and modified it for our purposes (instead of component testing our team needed to make an integration tests).

So we received an ability to locate UI elements by different parameters. We choose next sets of parameters for this purpose:

  1. ZKoss element id (not an javascript id)
  2. ZKoss element type and caption (i.e. @menu[label=”File”])
  3. ZKoss element type, caption and modal form on which it located (i.e. @window[title=”Error”] @button[label=”Close”])

All these approaches works fine at the moment.

Also we have some issues:

  1. With two similar applications we have different behavior of internet explorer WebDriver (it’s related to issue http://code.google.com/p/selenium/issues/detail?id=2247). With one application we see unnecessary scrollbar and with other we don’t see it.
  2. We still can’t run htmlunit tests with our application.
  3. We still can’t run component tests with ZTL-2 and this will be subject of future investigation.
P.S. Also there is a brunch at ZKoss forum related to subject http://www.zkoss.org/forum/listComment/17556-ZTL-issues