... Home Contact

Krzysztof Koźmic's blog

You're doing it wrong.


Show appreciation: My Amazon.com Wish List

Me@Twitter

    Currently reading

    Article Categories

    Archives

    Post Categories

    MyPersonal

    Syndication:

    August 2009 Entries

    Book review – Debug It!: Find, Repair, and Prevent Bugs in Your Code

    I bought Release it! some time ago, and it was a really good book. Now Pragmatic Programmer released a new book in their ‘do it!’ series – Debug it!, so when I got a change to snap a copy, I did, and I’m here to let you know that it is a remarkable book. First of all, I think the title might be a little misleading for some people. It is about debugging in a broader sense than most people define it. If for you debugging equates dealing with debugger, you won’t find much of that in...

    Castle blogs – RSS feed

    One thing I don’t think I articulated clearly enough when announcing Castle Blog Aggregator, was that it comes with RSS feed. You may have noticed an RSS icon in your browser when browsing the aggregator site, but in case you didn’t here’s the direct link to the feed that you can use in your favorite feed reader. We’re also open to include other blogs in the feed, so if you blog about Castle, or know any good blogs about Castle project, let us know, either in the comments, or create a suggestion on Castle UserVoice...

    Book review - C# in Depth, 2nd edition

    Note, that this is a review of very early MEAP release – this is not complete book, and I review only 2 chapters that are available at the time of this writing. If you are at least a casual user of StackOverflow you know who Jon Skeet is. Jon has a hard earned reputation of being an expert in just about anything he touches, so it came as no surprise that first edition of his C# in Depth book was universally praised for its high quality. ...

    Castle Dynamic Proxy tutorial part XIV: Persisting proxies

    Wow, what I had planned as few parts tutorial has turned to nothing less than full examination of Dynamic Proxy capabilities. Of all most important features we' have basically just one left – proxy persistence, which is what we’re going to talk about today. Discussion Although Dynamic Proxy’s name suggests that it’s useful for… well creating proxies on the fly at runtime, there are other scenarios where the framework can be useful. We’ve seen one such scenario last time, when we created mixins, not using proxying at all. Also the dynamic aspect of proxies is not always what we want. This is not...

    Adjusting NHibernate mapping for tests

    As nice as SQLite is for tests it is very simple database, and it does not have all the options ‘big’ databases provide (foreign key enforcement!). I don’t think there’s much you can do about this issue, but there’s more. SQLite does not support all the mappings you can have. I bumped into this issue when working with mapping similar to described in this post. Basically when you try to create schema from this mapping: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="ConsoleApplication1" ...

    Castle blogs aggregator

    Mauricio, Castle newest committer, long time community member, and our man on StackOverflow.com, did a fabulous job at creating Castle blog aggregator. You now have one all things Castle RSS feed to subscribe to instead of hunting for content on many various blogs. It has some rules set so that it collects content from only a handful of blogs, skipping posts that are not related to its main topic. It comes mostly from committers and few other blogs that have proven in delivering high quality content. If you know any blogs that you think should be added to the...

    Testing with NHibernate and SQLite

    There does not seem to be too much details on how to set up a test environment for NHibernate testing using SQLite. Ayende has a nice post on this, but he does not go into details of how, what and where, so I decided to fill in the blanks, and provide an up to date sample for NHibernate 2.1. Let’s first gather all the things we need: NHibernate (obviously) SQLite binding for .NET get the full version (not managed-only) SQLite itself scroll down to...

    Castle Dynamic Proxy tutorial part XIII: Mix in this, mix in that

    So far we covered most of basic features of Dynamic Proxy, except for one – mixins. Not getting into theoretical details, mixin is an object that stitches many other objects together, exhibiting behaviors of all these objects. Let me illustrate that in pseudo code: var dog = Dog.New(); var cat = Cat.New(); var mixin = mixin(cat, dog); mixin.Bark(); mixin.Meow(); In most languages this is achieved through multiple inheritance, but this is not allowed in the CLR, which imposes certain limitations on how mixins are implemented and work in Dynamic Proxy. We can’t have...

    Solving a programming puzzle

    My fellow devlicio.us blogger Tim Barcz posted an interesting problem to solve. I think it's fun, so I decided to give it a try. Now, I don't know enough context to solve it for just about any case (and I don't think that's even possible), so I made a few assumptions. The strings we're gonna be handling are not too long. Otherwise I'd probably use a StringReader/Writer. I'm looking at minimal solution. YAGNI - I could do some optimizations probably, but I want to keep it simple, because the sample...

    Making Asynchronous WCF calls without SvcUtil

    On the course of last few months, I’ve been working with Craig Neuwirt, on what I consider one of the coolest additions to Castle WCF Integration Facility. Problem As you probably know by default all WCF calls are synchronous – you make a request, under the cover WCF blocks your thread using a WaitHandle waiting for response, then it unblocks your threads making it look like a local call. This makes things simple for a programmer, who does not have to deal with synchronization, but it’s an overkill from scalability and performance perspective. There are also one...

    Can you spot a difference?

    This is registration website of one of the major logistics companies, can you spot a missing piece? For these of you who can’t read Polish, the text next to the bottommost textbox sais “type the CAPTCHA digits”. It failed to show the CAPTCHA in 3 out of 4 browsers. Not to mention that even though it says that required fields are only these with *, it required text in some that didn’t have the *, it would not accept NIP (which is Taxpayer ID) unless it was...

    Framework Tips XIII: Testing Random code

    Question How do you test code that is random. For example say you have a class that allows some action with 60% probability: public class UsingRandom { private Random generator; public double probability = 0.6D;   public bool ShouldAllow() { return generator.NextDouble() < probability; } } How do you unit test that?   Answer The answer is staggeringly simple – you fake...