My name is Juri Strumpflohner and this is my technical blog. I'm a software architect, .Net, Android, Web and Java dev, TDD and best practices promoter and martial arts practitioner.

Recent Posts Subscribe

Dear reader of Juri's TechBlog,
I moved my blog to a new domain and a new hosting solution as well. I'm now blogging on juristr.com.

Integrating Jersey with Spring

Spring provides a lot of benefits and promotes best practices with its dependency injection mechanism, application lifecycle management and Hibernate support (just to mention some). In addition when you want to have a clean server-side REST-like JSON Api, I found Jersey to be quite handy. This article briefly highlights how both of them can be integrated.

Why Did it Have to Be So Complicated Before??

I started web development using Java, basically during my studies at the university. When working on my bachelor degree thesis I needed a web server back-end system (to my mobile J2ME client); I decided to do it "right". Spring (especially Spring.Web) for the application server part and Hibernate for the object relational mapping. Although having quite a tough time getting up that initial learning curve, the result payed out so well: everything nicely decoupled and testable. I loved it. Then, when starting to work professionally as a .Net developer things got more painful...

Chrome Developer Tools: 12 Tricks to Develop Quicker

This is definitely a "must-have-seen" video for every JavaScript developer. Chrome has some really nice features build into their developer tools which are being demonstrated in this short ~5 min video.

Droidcon London 2011 - Europe's largest Android Conference

Droidcon London 2011 is Europe's largest conference that exclusively covers Android development and applications. The conference will take place in London on 6th-7th October 2011.


Experiencing the jQuery 1.6 Breaking Changes

Unfortunately I did not actively follow the release of jQuery 1.6 as I would probably have noted that they introduced some breaking changes which would have prevented some issues at my side. So I needed to experience them the hard way :). Fortunately, though, our app was not yet in production but just end-user acceptance testing, so it didn't cause any major problem, but still...

JavaScriptSerializer: Circular Reference was Detected While Serializing an Object of Type...

Consider an ASP.net MVC web application where you use some Ajax for retrieving an object. Let's start from the server-side MVC controller:


public class BaseDataController : Controller
{
    private DataRepository repository;

    public BaseDataController()
    {
        repository = new DataRepository();
    }

    public JsonResult GetOperationDefinitionByCode(string operationCode)
    {
        return Json(repository.GetOperationDefinitionByCode(operationCode), JsonRequestBehavior.AllowGet);
    }
}

public class DataRepository
{
   private EntityContext context;
   ...

   public OperationDefinition GetOperationDefinitionByCode(string operationCode)
   {
      return context.OperationDefinitions.Where(x => x.OperationCode == operationCode).FirstOrDefault();
   }
}
So far, so good. Now you call your controller via a GET request, like http://localhost:40492/basedata/getoperationdefinitionbycode/?operationCode=120. This will call your method, but unfortunately it returns an exception:
A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.OperationDefinition_12123132123....'

How often did you use the Yield keyword??

If you think about your coding...how often have you used C#'s yield keyword? To be honest I continuously forget to use it myself, too. But it would be so useful in certain scenarious. Take for instance:
public IEnumerale<Person> FindMalePeople(IEnumerable<Person> people)
{
   IEnumerable<Person> result = new IList<Person>();
   
   foreach(Person person in people)
   {
      if(person.IsMale())
         result.add(person);
   }

   return result;
}

Check-in Small Pieces to your VCS!

A while ago our TFS master at work :) sent around a statistic about the "ExcutionCount" of each developer w.r.t. the TFS. The result was me on top of the "ranking" with quite a huge distance to others, although at that time I worked part-time, half the time each day as all other devs. Now, obviously this doesn't mean anything but does just express the number of interactions between a developer and the TFS system, nor does it mean that I was more productive than others :).

But still the statistic has a significance, namely it tells how the TFS (or more generally, the VCS system) has been used during the development process.While I prefer committing very small changes to the VCS, the other devs generally tend to work for a long time on different features and then from now and then they commit everything to the VCS. This (latter) approach has several drawbacks...

Posting JSON Data to an ASP.net MVC 3 Web Application

The trend in today's web application development goes more and more in the direction of having rich, desktop-like applications. There are numerous examples on the web, just watch out while your navigating around (Google services are always a good place to look for such apps). But also Microsoft has noted that trend and aligns its products in order reduce the pain to code such rich ajax apps to the minimum possible. A good example is ASP.net MVC 3. Below is a quick example on how easy it is to establish a data exchange mechanism between a JavaScript web app and an ASP.net MVC 3 web application. In the example I use JSON as the data exchange format as it is most convenient in a JavaScript environment and moreover it tends to be more compact than other formats (i.e. like XML).