• Looking for JavaScript grid/table component

    Recently I was looking for grid/table component in Javascript which is would be open-source, flexible enough and not tied heavily to some large framework. I'd like to share with you some brief notes of that research. I like SlickGrid more so I've explored it more. SlickGridhttps://github.com/mleibman/SlickGrid/wikiLicense: MIT PROs: Supports huge datasets via virtual scrolling. Looks like it's the only grid that supports horizontal virtual scrolling.  Supports trees Data provider API - allows model creation.
  • Antipatterns: initialization after usage

    I've seen such problem fiew times and I'm going to describe it as an antipattern - let's call it "initialization after usage". It could sound a bit like Captain Obvious, but isn't it typical for some pattern/antipattern catalogs? :) The problem:There is an object which has some fields initialized in one place, some in completely different place, and in the meantime the object is used somewhere. So when using the object it's not clear if its fields are completely initialized or not.
  • A good question for quiz about generics In Java

    Suppose you have two classes: public class Foo { private String[] array = (String[]) new Object[]; public static void main() { Foo f = new Foo(); } } public class Bar<T> { private T[] array = (T[]) new T[]; public static void main() { Bar b = new Bar<String>(); } } Will they compile? Will they run? At a first glance it may seem that both make inappropriate casting from superclass Object[] to subclass String[].
  • Quoting password for user in Oracle database

    Recently I needed to create a user in Oracle11g database and I was surprised that for other people following expression works well: CREATE USER name IDENTIFIED BY password But I'm constantly getting ORA-00922: missing or invalid option error. Quoting the password solves the problem, so following expression works fine: CREATE USER name IDENTIFIED BY "password" It turned out that for password which contain only digits or start with a letter quotes aren't needed, so first expression works fine.
  • Collections.addAll performance

    I was wondering how efficient addAll() method in Java collections is and looked through the JDK code (Sun/Oracle JDK 1.6.0-27). Here is code for ArrayList.addAll(...): public boolean addAll(Collection<? extends E> c) { Object[] a = c.toArray(); int numNew = a.length; ensureCapacity(size + numNew); // Increments modCount System.arraycopy(a, 0, elementData, size, numNew); size += numNew; return numNew != 0; } So here you can see incomming collection content copied into intermediate array.
  • POST-Redirect-GET Pattern In Spring WebFlow

    It's a good practice to redirect user to get requests after making some changes with post and this is usually done by Spring WebFlow by default. But what if by some reason you need to use <webflow:always-redirect-on-pause value="false"/> option? You can do this through java code. This approach is not described in WebFlow reference but documented via API javadoc. Suppose you have some Action which is configured through WebFlow. If you want to make redirect to GET after this action you can modify action methods in following way:
  • Beware of SchedulerFactoryBean

    Recently I've discovered unpleasant side effect of org.springframework.scheduling.quartz.SchedulerFactoryBean which results to instable behaviour. It implements FactoryBean interface, so by default if you reference it in your context it returns Scheduler instance instead of the factory itself. But Scheduler instance creation is triggered by SchedulerFactoryBean.afterPropertiesSet(), and factory can't return Scheduler at all until it has been fully initialized. See the point? Suppose we have some cyclic reference in the context and SchedulerFactoryBean relies on some other beans (for example, they may be needed for initial state configuration), and some of those other beans relies on scheduler in order to do some job later.