Hi there!

Hi there!
My name is Michael Ivanov and i'm a Senior SDE/Software architect.
My CV - here. You can find articles and other blog posts on the main page. I also develop some free and commercial software - complete list is here.

Sunday, January 22, 2012

from high to low: design wsdl for your webservice

I spent a couple of last days to design wsdl for third-party systems in my new project. It got me some painful moments, so i decided to write a post about problems i met and may be some thoughts i gained during the process. I ll try to emphasize them below for more effect.
The idea was that i had an interface (not in C#-syntax or so, but described by words/UML) and i needed to create a wsdl for third-party systems to implement the interface. Show/hide

Friday, January 6, 2012

persistence.xml within "Dynamic Web Project" in eclipse

Being totally newbie at j2ee area, i decided to spent some time looking through the area and to get familiar with appropriate technologies. After reading about odata and servlets, i decided to build a simple servlet to return some odata block. I created Dynamic Web Project and used odata4j to return appropriate producer. But i met some problems that took me 3 days to serve.
In Java (as you probably know) is a standartized API named JPA, that describes a set of notations for ORM (Object-relation mapping). You configure your future mapping with a special file, named persistence.xml (and no other names should be used). All articles i looked through (well, may it was my mistake - i just looked through all manuals) told me to put this file in the /WebContent/META-INF directory. I did it and after deploying to my tomcat (integrated in eclipse) i got
root cause

java.lang.RuntimeException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named TaskPersistanceUnitName
org.odata4j.producer.resources.ODataProducerProvider.newProducerFromFactory(ODataProducerProvider.java:65)
org.odata4j.producer.resources.ODataProducerProvider.getInstance(ODataProducerProvider.java:45)
org.odata4j.producer.resources.ODataProducerProvider.getInstance(ODataProducerProvider.java:15)
com.sun.jersey.core.impl.provider.xml.LazySingletonContextProvider.get(LazySingletonContextProvider.java:83)
com.sun.jersey.core.impl.provider.xml.LazySingletonContextProvider.access$000(LazySingletonContextProvider.java:55)
com.sun.jersey.core.impl.provider.xml.LazySingletonContextProvider$1.getValue(LazySingletonContextProvider.java:72)
com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable$1.getValue(AbstractHttpContextInjectable.java:104)
com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)


I spent several days trying to figure out the reason of such behavior, and finally i read carefully http://javahowto.blogspot.com/2007/06/where-to-put-persistencexml-in-web-app.html
i created folder META-INF inside WebContent/WEB-INF/classes
and got it works

Friday, December 23, 2011

WCF and OData serialization

Even though Microsoft is one of the pioneers of OData protocol, in it's implementation for WCF (Data Services) they just "forgot" (you! bastards!) to implement json $format for it. I figured this couple hours ago while looking througn various options in protocol buffers for my future wcf-based odata service. Googling some time i found implementation for json format serialization http://professionalaspnet.com/archive/2010/06/17/The-query-parameter-_27002400_format_2700_-begins-with-a-system_2D00_reserved-_270024002700_-character-but-is-not-recognized.aspx great thanks to the author. Its pretty simple and readable, i'm going to try extend it to the protobuf engine.

Saturday, October 16, 2010

Un-recursive - part 1

I decided to write a cycle of posts about avoiding recursive calls in your algorythms. Recursion is the thing i hate to implement - it's hard to debug, it cost too much and so on. In this cycle i'm going to start with a common task - Tree Painting in depth - a task that could easyly solved with recursive calls - and show two ways to achieve the goal without recursive calls. After that i ll build parallels between this task and "common" recursive-solved task. Than i will implement quick sort and merge sort. Show/Hide

Tuesday, September 21, 2010

Randomized Quick-sort

Quick-sort is another type of comparison sorting algorythm. It's much better than other comparing algorythms cause it doesn't require additional space for its work (unlike merge sort for example). It also has a good time of work in average case - O(n lgn) - that is best time for every comparing algorytm as you know. It's also has asymptotic n^2 time of work in worst case, that occurs rarely. Using randomization at the each step of algorytm helps to avoid receiving "pre-defined worst case", when our solution gives us worst time on a particular sequence. Here is an implementation of randomized qucik-sort: Show/Hide

Wednesday, September 15, 2010

Count sort - yehhaaa!

Count sort is very good to sort sequence of integer which has small range of values (in comparison with sequence length). Due to two assumptions - our sequence contains only integers and its values range is much less than amount of items in sequence, it's linear in time to the amount of items in input. It's much better than classic algorythms based on comparison, cause it doesn't use comparison in its work, so it overcomes traditional for comparing algorythms O(nlogn). Here is an implementation: Show/Hide

Monday, September 13, 2010

Merge implementation with predicate

I study algorythms carefully during last two weeks and as you probably know, many algorythm tasks require implementation of sorting procedure. There is a huge amount of various sorting algorythms, such as Quick Sort, Heap Sort and so on. But one of the easiest to implement is a Merge Sort. You can find its description somewhere. I implemented it several times - for ascending sorting, for descending sorting and so on, so finally i take time to implement it with any predicate you like. Here is an implementation: