Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Sunday, 25 March 2012

Sharing photos using SignalR

SignalR is the latest .NET library available for broadcasting data from a hub to its clients (similar to polling methods used for various sites such as facebook, twitter etc). More information about SignalR is available at signalr.net

I have tried a simple mvc application that can be used to share photos between friends which gets updated instantaneously. An user connected to the website can upload a photo which will be automatically broadcasted to all clients connected at that point.

Here is how it looks:-



Latest version of source is available at photowebpro.codeplex.com

SignalR is an asynchronous signaling library for ASP.NET that can be used to build real-time multi-user web application. There is a simple and interesting video available on Channel 9 about SignalR, which will give you a heads-up.

Technology presumes there's just one right way to do things and there never is. ~Robert M. Pirsig

Thursday, 8 March 2012

Using join on a subquery with NHibernate

NHibernate is one of the best ORM solution available. That said sometimes its not easy to find a way around your problem. I have been trying to create a join on a subquery and want to uses "EXISTS" on a table to be more efficient.

Here is my class design


All I want is to get list of flytoys for a purchase order
- filter on customer name
- get the oldest purchase order

After trying many various methods, here is the code snippet that worked for me:

  public FlyToy[] GetPendingToys(int Count)
        {
            using (var session = OpenSession())
            {
                PurchaseOrder po = null;
                FlyToy toy = null;
                QueryOver subQuery = 
                    QueryOver.Of(() => po)
                        .SelectList(list => list
                            .SelectGroup(() => po.Toy.ID)
                            .SelectMin(() => po.OrderDate))
                        .Where(Restrictions.EqProperty(
                            Projections.Property(() => po.Toy.ID),
                            Projections.Property(() => toy.ID)))
                        .Where(p => p.CustomerName == "Saif");


                var mainQuery = QueryOver.Of(() => toy)
                    .Fetch(t => t.Discount).Eager
                    .WithSubquery.WhereExists(subQuery).Take(Count);

                IList results = mainQuery.GetExecutableQueryOver(session)
                    .List();

                FlyToy[] FlyToys = results.ToArray();
                return FlyToys;
            }
        }


Be nice to nerds. Chances are you'll end up working for one.
- Charles Sykes

Friday, 2 March 2012

Website giving an error Retrieving the COM class factory for remote component with CLSID

I have got a website which was working fine until today and all of sudden I am getting following error message when tried to access the website.

Retrieving the COM class factory for remote component with CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} from machine MMMMMMMM failed due to the following error: 80070005.

There's has been no changes to the code base,no changes to its dependencies and nothing noticeable. So remember the word noticeable, simple to say but very hard to point out. The error code 80070005 usually means that you do not have enough permission.

That does not help at all why would I get an error message as not enough permission if I am using windows authentication for the website. After digging some more the situation is this website is making a call to another webservice which is giving this error message.

Fine now both of them are running under the same application pool then it should work, but its not. Finally working through all the odd methods I have found impersonation is set to true for the website that's hosting the web service. I have just made

impersonate=false 

and yes that started working.

All in all the point I have missed out in my investigation is checking web.config. Anyway lesson learned for next time.

Information technology and business are becoming inextricably interwoven. I don't think anybody can talk meaningfully about one without the talking about the other. ~Bill Gates
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers