Skip to content

Category Archives: Main

On-topic posts

Got a StackOverflow careers invitation.

04-Aug-11

They do a pretty cool thing: force you to tell “the truth” — no matter how subjective this term is — as opposed to emasculated official style: what you really did (whatever it means to you); what opensource/published projects did you participate in; Top Stack questions you answered; your professional reading and (sic!) writing. Here [...]

Why I don’t like GMock

16-Feb-11

I don’t like GMock. It’s not as if it was badly written or designed. But it lets you to unit-test dirtier code, tying to method call structure instead of resulting data. For instance, this GMock code can be rewritten:

Groovy Comparator for class field names

15-Feb-11

I wonder why this was not in JDK/Groovy Collections. Just put together a Comparator for StackOverflow question – a Groovy Comparator that would sort class field names in the declaration order. Feel free to use: class PropComparator implements Comparator { private Class clazz PropComparator(Class clazz) { this.clazz = clazz } int compare(Object o1, Object o2) [...]

DB2 supports LIMIT and OFFSET syntax, in MySQL compatibility layer…

29-Nov-10

It hasn’t even been a ten years that DB2, one of the most, er, expensive DBMSes, got a feature needed by every other application – dataset paging. Before, you had to use window functions rownumber() and fetch first 40 rows only. When used by Hibernate, this resulted ugliness like: select * from ( select inner2_.*, [...]

Google Buzz button for WordPress

12-Feb-10

Just installed a shiny new Google Buzz button for WordPress by Tejaswini, Sanjeev. I hacked it a bit, to align to the right. Download this plugin version here, until author updates it. I’m replacing a diggIt button; Buzz fits my color scheme better Enjoy.

“group by” clause in GORM/HibernateCriteriaBuilder

08-Feb-10

Just in case someone needs a code snippet. This one groups Prices by PriceProvider and was intended to pick only last 5 values for each PriceProvider – but sadly, it’s impossible without window functions. Which are not supported in Hibernate in any way.

Hibernate join bug

03-Sep-09

Hibernate bug 1895 seems to be still there since 2006. If, for instance, in Grails, such a syntax won’t work for you (it won’t): def books = Book.findAll(“FROM Book AS b JOIN Chapter AS c WHERE c.active = :isActive”) with a NullPointerException in “HqlSqlWalker.createFromJoinElement” — just use alternative join syntax, via WHERE: def books = [...]

Unit tests quickstart

24-Jun-08

A friend asked me for it, so probably someone might need a jumpstart in unit tests. Here’s a short list of short (though very deep, if not best) intros. Except for JUnit cookbook (~2 pages) (which has a lot of “ports”, like CppUnit cookbook), I’d name: “Endo-Testing: Unit Testing with Mock Objects” at mockobjects.com (Tim [...]

On unit tests in Visual Studio 2008 vs NUnit

02-Jun-08

Comparison of Microsoft Visual Studio unit tests (MSTest) vs NUnit, mentioning PartCover and

Please meet: Lua

15-May-08

Lua language brief description, and the best Lua book in CHM.

Another C++ quiz, simpler

14-May-08

Simple C++ quiz about class member pointer.

C++ quiz from the past

14-May-08

C++ quiz about streams, dynamic_cast, temporary values, default type conversions and more…