Posts

Showing posts with the label Technical

Tracking down managed memory leaks

Image
Steps to track managed memory leaks Simple Steps Very Simple: 1. Debug your code from VS and run. 2. When app is stable, from VS break all (or pause) 3. Now open “Immediate window” 4. Type following to load sos.dll .load C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\sos.dll 5. Then type !DumpHeap –type For Ex: !DumpHeap -type SomeNameSpace.ClassNameObj Above command will give reference counts of specified type, along with the address of each reference. 7 Then you can use: !gcroot For Ex: !gcroot 02bcddc8 This will give the reachable reference path that is holding your reference. Check for HANDLE(Pinned) in above result. This specifies the non collectible references. Others with HANDLE(WeakSh) or HANDLE(WeakLn) are weak short and weak long references that can be collected by garbage collector. References http://blogs.msdn.com/b/ricom/archive/2004/12/10/279612.aspx http://blogs.msdn.com/b/tess/archive/2007/10/19/net-finalizer-memory-leak-debugging-with-sos...

public abstract sealed class MyFundooClass {}

Ever heard of a class that is abstract as well as sealed? Sounds impossible right? abstract means some functions must be defined in derived class and sealed means class can not be derived. Conflicting statements!!? Well actually the catch is in the meaning of abstract class. Creating abstract class means that instance of a class can not be created. That is why you can have following class in c#: public abstract class MyFundooClass { //abstract class without any abstract members. } So now you are clear that abstract means class can not be instantiated. But what if someone decided to derive your class and create an instance of it? For ex: public class MyFundooClassImpl : MyFundooClass { } .... void SomeFunc() { MyFundooClass obj= new MyFundooClassImpl(); //Ohh some has an instance of MyFundooClass !!?? } Here the sealed keyword comes to rescue. Sealed means class can not be derived. So now you can write your class as publ...

My Rants on Scrum

It is like Churchill or Rooseveldt said something along the lines of: "Democracy is flawed, but nothing else works!". Which is also true. Democracy is the rule of the mob and pop culture, but all other governing styles leads to chaos, elitism or despotism. I do like a lot of the ideas behind Scrum, the agile thinking is great, the XPways do work. Everyone seems to jump on the Scrum bandwagon taking every element as gospel, and defending it religiously. But Scrum, has introduced many elements I don't like. I can see why, and what they can achive, but some I really detest. Unfortunetly, all other project managent styles have more flaws, so I think "Scrum matured", or some better Agile methodalogies in the future is a better solution. For Scrum and agile there are 3 sides to view from the pros and cons to its benefits.  Management  Developers  Customers It is mainly been developers who having been pushing Scrum as it will be better for customers, ...

C# Polymorphic types conversion with Generics

Image
Polymorphism has been interviewer's  delight for ages. I have been taking interviews for quite some time.  And ever since i started preparing question on C# Polymormism, I have been getting surprises. To prepare interview questions, I try writing code, verify it and and then twist the code snippet to make it "interview-able". This blog is to highlight some of the surprises that i have got while preparing the questions.  The motive of this blog is to highlight tricky points to keep in mind while writing overloaded Functions with Generic parameter. To explain the concept, I'll start with this short code snippet and would like readers to predict the output without scrolling down to answer. Code - 1  If you know the output and the reasoning behind it, then you may leave the rest of blog as you probably are better expert than rest of my audience.  And if you are still read...

A morning dream

My eyes were paining, as I coded per requirements, I shouted for it was crowded, and he gifted me diamonds, I kept on coding and he kept on gifting, Diamonds kept shining, and it started rhyming, and then a figure appeared it said in my ears... "it's not wise to loose your eyes for diamonds for any requirements" oh please, one day i'll be rich with AAA from Fitch and S&P would die to rate me, who you are to teach me, do you love, or do you hate me? and there the dream broke, was it a reality or was it a joke?

Data Binding in .net

Image
I have been toying with data binding in .net for quite some time now. And ever since I started working and analyzing the binding support in .net f/w 2.0, I have always been eager to know: What makes WPF data binding so great that Microsoft showcased it as the biggest driver for WPF and MVVM? Even though the data binding existed in .net framework 2.0, why didn't MS pushed for its use as it did for WPF? The INotifyPropertyChanged interface was introduced in .net framework 2.0 and was fully supported by WinForm binding engine. However, most of my fellow developers are unaware of this fact.  So the fundamental question that arise is why should one go for WPF if all we want is nice Data Binding support and it’s available in .net 2.0? The answer to this question is, MS has introduced an all new Data Bindinding engine in WPF which fixes lots of bugs of WinForm data binding, has a much improved performance. And I think this is enough for any GUI developer to consider switching to WPF ...

MVVM explained again!

I just started to work on WPF after quite a long break (8 month). And I wanted to recap my WPF knowledge and use MVVM in a plugin like scenario. Download from here... (Download link: http://www.4shared.com/file/VrKkQQkH/TestWPFApps.html) I have prepared a very basic plugin like app which makes use of MVVM with Commands, DataBindings and DataTemplates. The AnimalsLibrary is a Plugin base which is referenced by every plugin. The OuterUserAnimals is a Plugin which creates a new animal type. It also defines its own way of displaying its animals using a data template. The TestListBoxTemplate is our main app which displayes the standard animals and loads other animals from plugin dll. For now you may finc the path od plugin dll hard coded so you would have to change that to match your needs (as per you save loaction of the zip). This example shows how to create a ViewModel which can be bound to a view. How to create and load DataTemplates from a referenced Dll (animals lib). ...

Precompiled Or Inline Regular Expressions

Precompiled Or Inline Regular Expressions What to Do Consider using Precompiled Or Inline Regular Expressions in the scenarios where the same set of regular expressions are used quite often in the applications. Precompiled Regular Expressions can be created using RegexOptions.Compiled switch while defining the regular expression. Inline Regular Expressions can be created using Regex.CompileToAssembly method. Why Interpreted Regular Expressions have the least start-up time, but has performance issues at runtime. If the regular expression is used rarely in the application, use Interpreted Regular Expressions. Precompiled Regular Expressions take little more time at start-up, but gives better performance at runtime. Use Precompiled Regular Expressions for the regular expressions which are used most often in the application for better runtime performance. The precompiled regular expressions give 30 % better runtime performance then interpreted regular expressions. Inline Regular E...

WOW... Business with Maths included

Who said derivatives of class 12th were junk... Read this discussion about Swaptions (option on Swaps) to know how traders talks in terms of bus-maths http://www.quantessential.com/messageview.cfm?catid=8&threadid=80892

Job description with a style

Requirements (and we mean it!) Techie Cred: CS or similar degree so you can talk to our enginerds about Python, map reduce jobs, and naive Bayesian algorithms without a translator. Design Chops: While Yelp PMs hold technical degrees, we're also passionate about design and have either schooling or significant experience building beautiful sites or apps. You should, too. Passion about the Space: You love the world of social networking, local search and consumer websites. Non-Nerd Empathy: You're interested in FriendFeed, Twitter, etc. as much as the next nerd, but you also recognize that you're designing for a non-techie audience. A Conditional Love for Yelp: Like a BFF or a tee ball coach, you should love us but also be able to tell us what we're doing wrong. You'll need to be able to dish out the criticism here and take it, too. A Need for Speed: Daily release cycle? Bring it! check out for details this Job Description on Stack Overflow. ( or fo...

Free time? go and read this dude...

http://groups.google.com/group/wpf-disciples/browse_thread/thread/3fe270cd107f184f?pli=1