Being Cellfish

Stuff I wished I've found in some blog (and sometimes did)

Browse by Tags

Tagged Content List
  • Blog Post: Tail Recursion and C#

    Tail recursion is a powerful optimization since it typically improves both execution time and memory usage for recursive calls. It can also be your enemy if you forget about it. Read more here .
  • Blog Post: Logical task combinators

    When I had to use Erlang for the very first time it was a brand new language and I was in collage. Back then Erlang did not have a logical not function so we had to define our own in order to make our code readable. At least given the knowledge me and my lab partner had at the time. So the other week...
  • Blog Post: Hashtable vs ConcurrentDictionary

    Historically I've seen the Hashtable be favored over ConcurrentDictionary with the assumption that is was more efficient allowing for lock free reads. Well they both allow lock free reads so which one is really the better option? Read more here !
  • Blog Post: Dependency injection with IObservable

    Just when I started working on my little toolbox I read this series on dependency injection for events which was great inspiration. Read more here.
  • Blog Post: Unexpected Progress<T>

    When I was working on the WithProgress extensions I learned something about Progress<T> that I didn't expect. Read more here.
  • Blog Post: Task-based Asynchronous pattern - for your pleasure

    If you liked my old series of articles covering TAP and especially the different extension methods I showed. Then you will be even happier now. Read more here .
  • Blog Post: Asynchronous enumerations - summary

    So what did we end up to do after the discussion two months ago? Well we ended up using option #1 mostly because it simplified things to have all items available during processing. technically not needed, but it simplified things. My generic advice would be to use option #1 or #2 and to favor option...
  • Blog Post: Asynchronous enumerations - Part 5: MyEnumerationAsync

    For background, read the introduction . If you have no need for filtering using LINQ (or Rx) and you do not want to expose an IEnumerable you can create tour own " IEnumeratorAsync " that asynchronously fetches the next item. Again this is something I would advice against. First of all you are loosing...
  • Blog Post: Asynchronous enumerations - Part 4: IEnumerable<Task<IEnumerable<T>>>

    For background, read the introduction . This is really just a variant of option #2 using the fact that you use azure tables and know that you will get several items at a time. In my opinion you shouldn't even consider this option since it uses a feature of the underlying storage layer and compared...
  • Blog Post: Asynchronous enumerations - Part 3: IObservable<T>

    For background, read the introduction . In part 2 I briefly mentioned that if you have simple filtering needs then you might implement your own LINQ-like methods. Well if you have more advanced filtering needs there is already something out there to help you; Reactive Extensions (Rx) . The only thing...
  • Blog Post: Asynchronous enumerations - Part 2: IEnumerable<Task<T>>

    For background, read the introduction . This is essentially the opposite of option #1 . With this approach you are optimized for processing one item at a time. Or even process all items in parallel! So this is a very good option if you do not need all your data at once and you also have a large number...
  • Blog Post: Asynchronous enumerations - Part 1: Task<IEnumerable<T>>

    For background, read the introduction . If you need all data before you start processing it or if you expect just a few records each time, then this is probably your simplest way to get an "asynchronous enumeration". Technically the enumeration is not asynchronous since you retrieve all data asynchronously...
  • Blog Post: Asynchronous enumerations - Introduction

    A couple of weeks ago I had a discussion with a co-worker about what would be the proper way to asynchronously iterate over some data in azure tables. Exploring different options was very interesting and let us understand different pros and cons for each asynchronous strategy. So over the next few weeks...
  • Blog Post: Which collection interface do I use?

    ReSharper has a warning that I thought came from FxCop that is so important I wish it was an FxCop warning. It warns you if you try to enumerate an IEnumerable twice. This is important when you take a collection as an argument and you do not know how that collection is created. For example if the collection...
  • Blog Post: How would I test a WebAPI controller

    Kind of related to my previous post , this article on how to test ASP.Net WebAPI controllers made me think. As you can see from the article it is fairly easy to get your controller under test, but it does take some work to get everything setup properly. And I have never tested my WebAPI controllers like...
  • Blog Post: Collection initializers not doing what you expect

    Let's assume that you have a class that have a collection property and that you want the default for that collection to be to actually have a value. That class might look like this: 1: class Foo 2: { 3: public Foo() 4: { 5: this .Numbers = new List< int > { 4711 }; 6: } 7: public...
  • Blog Post: Task-based Asynchronous Pattern - kick starter

    Regardless of if you are new to TAP (Task-based Asynchronous Pattern aka " async/await ") or have been doing it for a while this presentation from an MVP summit in February (2013) serves both as a good introduction explaining how it works as well as providing deeper knowledge and high-lighting a few...
  • Blog Post: How to know when the garbage collector is not helping you

    A while back I did an experiment where it turned out that allocating objects was better than pooling them. Since then I have encountered a few times where allocating actually turned out to be a bad thing. I've never seen this being a problem in a client application, but in servers allocating a lot of...
  • Blog Post: Factory pattern improved

    My impression of most major west coast cities like Seattle, San Francisco, Los Angeles etc, is that people in general are very healthy. And Redmond where Microsoft have its HQ is even the bicycle capital of the north west (I guess anything can be the capital of anything if you just constrain geography...
  • Blog Post: Implementing a good GetHashCode

    If you've ever implemented GetHashCode you probably did it the way suggested in MSDN which is using XOR. And if you use R# you might have seen that it generates a different GetHashCode using prime numbers. So what should you do? I think there are three properties you want to aim for when it comes to...
  • Blog Post: Implementing IDisposable

    The IDisposable is probably one of the most abused interfaces in .Net. Except from all the cases where you actually have an unmanaged resource you need to release I've seen it being used a lot of times (including by myself) just to guarantee some code is executed immediatly when a variable go out of...
  • Blog Post: Task-based Asynchronous Pattern - PauseToken and common problems

    I just wanted to make sure you did not miss this article describing a mechanism to pause asynchronous processing. Just like the article state that this came out of a problem encountered in the UI World I think this is something I would not expect to see a lot outside the UI world. But it could be used...
  • Blog Post: Reactive Extensions Reminder

    It's been a while since I last looked at Rx and I must confess that my first impression was that the amount of possibilities to do the same thing and all the extension methods was overwhelming at start. But like with any new framework you learn you'll settle for a few to solve your most common problems...
  • Blog Post: TestInitialize execution order

    This was brought to my attention and I was blown away by the fact that somebody would mark classes as TestClass without any tests in them just to reuse some setup code. And that they then make any assumptions on in which order the methods are called. If you really want to do that the constructor is a...
  • Blog Post: Task-based Asynchronous Pattern - WaitAsync

    Recently I was asked about a specific scenario when some code was being converted into using TAP and this was code that already used tasks. Since the existing code used the "IsFaulted" property a lot I came up with this little extension method making it easy to see if a task failed or not using the await...
Page 1 of 3 (74 items) 123