The CodeBrickie

what i found out while laying code bricks.

Ext GWT 3 ComboBox Not Firing ValueChangeEvent

| Comments

In the current beta version of Ext GWT 3 (beta4), a ComboBox does not fire a ValueChangeEvent immediately after a value is selected. The event is only fired when the ComboBox loses its focus or the return key is pressed inside the ComboBox.

To fire the ValueChangeEvent immediately upon selection, you can add a CollapseHandler as a workaround:

1
2
3
4
5
6
combobox.addCollapseHandler(new CollapseHandler() {
  @Override
  public void onCollapse(CollapseEvent event) {
      combobox.setValue(combobox.getCurrentValue(), true);
  }
});

Using CoverMe With Jenkins

| Comments

CoverMe is a code coverage tool for Ruby 1.9.

Using Jenkins for CI, you can display the coverage results in your project overview even though Jenkins does not support the original output format of CoverMe.

  • Download and install the Emma plugin via the Plugins page of your Jenkins installation.
  • Install CoverMe for your Rails project as described on the project page on GitHub.
  • Edit lib/tasks/cover_me.rake and make the :report task look like this:
1
2
3
4
5
6
task :report do
  require 'cover_me'
  CoverMe.config.formatter = CoverMe::EmmaFormatter
  CoverMe.config.at_exit = Proc.new {}
  CoverMe.complete!
end
  • Configure your build job in Jenkins to publish the Emma coverage results from coverage/coverage.xml.

Oracle SQL Loader Whitespaces

| Comments

I’ve recently used Oracle’s SQL Loader with a control file like this:

1
2
3
4
5
6
7
8
9
10
11
12
OPTIONS (BINDSIZE=10000000, READSIZE=10000000, SKIP=1, ROWS=1000, PARALLEL=TRUE )
LOAD DATA
INFILE 'TEMP_DELETE.CSV' "STR '\N'"
APPEND
INTO TABLE TEMP_DELETE
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY '"' AND '"'
TRAILING NULLCOLS
          ( CREATION_DATE DATE "dd.mm.yyyy",
            NAME CHAR(4000),
            SERIAL_NUMBER CHAR(4000)
          )

SQL Loader gave me the error message ORA-01722: invalid number.

The definition of the TEMP_DELETE table is

1
2
3
4
5
CREATE TABLE TEMP_DELETE (
     CREATION_DATE DATE,
     NAME VARCHAR2(255),
     SERIAL_NUMBER NUMBER(38,0)
);

And the input file looks like

1
2
3
4
5
6
CREATION_DATE;NAME;SERIAL_NUMBER
03.04.2011;"Name 1";87364
04.04.2011;"Name 2";65765
05.04.2011;"Name 3";23497
06.04.2011;"Name 4";43657
...

Although the files look perfectly fine, I finally figured out the problem. SQL Loader tries to interpret the line breaks in the input file along with the preceding number, i.e. 87364 becomes 87364\n which obviously isn’t a valid number.

To fix this, I modified the control file and added TERMINATED BY WHITESPACE after the last column definition.

1
2
3
4
5
6
7
8
9
10
11
12
OPTIONS (BINDSIZE=10000000, READSIZE=10000000, SKIP=1, ROWS=1000, PARALLEL=TRUE )
LOAD DATA
INFILE 'TEMP_DELETE.CSV' "STR '\N'"
APPEND
INTO TABLE TEMP_DELETE
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY '"' AND '"'
TRAILING NULLCOLS
          ( CREATION_DATE DATE "dd.mm.yyyy",
            NAME CHAR(4000),
            SERIAL_NUMBER CHAR(4000) TERMINATED BY WHITESPACE
          )