Month: July 2012


Last week was quite simple and went without trouble  , and just before I start enjoying my weekends – stuck in to in issue of getting ROW_NUMBER() (as we are doing in sandard SQL Query ! Finally come-up with sort and sweet code! var items = context.ItemMasters.AsEnumerable() .Select((u, index) =>  new ItemDetail {    ItemId = u.ItemId, ItemName = u.ItemName, IsActive = (bool)u.IsActive, Count = index + initialRow + 1 }).Skip(initialRow).Take(finalRow).ToList(); Please post comment if any other better solutions is possible for the same. Thanks Happy Coding !...

Read More

Convert List to ObservableCollection Extension Method

Today we found one more interesting thing of converting List to ObservableCollection , Its something you will need regularly when you are working with WPF / Silverlight application – because ObservableCollection typically automatically synchronized when its get updated ! Here is the code may helpful to  you ! , Its extension method to convert into ObservableCollection public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> enumerableList) { return enumerableList != null ? new ObservableCollection<T>(enumerableList) : null; } Happy Coding...

Read More

Add www prefix for windows hosting

Ok ! Here you go – something interesting related to URL rewriting for Windows hosting to add WWW prefix .  Recent conversation with SEO Expert leads me to understand that and are different for SEO and Page Ranking ! So , I did tried to achieve www prefix for my website finally that achieved by url rewriting ( remember .htaccess won’t work with windows hosting !) <rules> <rule name=”Add www” patternSyntax=”Wildcard” stopProcessing=”true”> <match url=”*” /> <conditions> <add input=”{HTTP_HOST}” pattern=”” negate=”true” /> </conditions> <action type=”Redirect” url=”{R:1}” /> </rule> </rules> For Linux <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond...

Read More