New Year 2012

Newyear

It’s already three days after new year and we are back to work. New year brought lots of enthusiasm to celebrate and refresh our thinking. As a part of Hindu Mythology, I visited temple to pray for the successful year. Everyone has resolutions. I had few resolutions in 2011 which I missed. Simple goals are met but I need to work more on important and long term goals.

My important goals. Lose weight– Tough in Winter, but I need to start working on it. Learn More – Want to excel in few more areas other than programming with more certifications in Scrum and Agile along with management degree.  Spend Time– Spend more time with my better half and work on priorities in personal life. Sharing – Share my knowledge through blog posts as I was very poor in 2011. Voluntary Work – Involve in more community activities and spend some time in volunteering both in technical and group events. Increase sleep time – sleep longer for at least 6 hours from current 3-4.5 hours.

Hope you all reach your goals…Have a great year ahead.

Happy Coding Smile

Image Source: Image above is extracted from Editors Choice on 500px by Simone Ciliberti..

Advertisements

2011 in review

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 31,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 11 sold-out performances for that many people to see it.

Click here to see the complete report.

Free Windows Phones to Developers and Students in INDIA

In an effort to make its presence felt in the widespread use of smart phones. Microsoft has started a new  “I unlock Joy” program for developers, students and provides them an opportunity to win free Windows Phone handsets and other gifts.‘I unlock Joy’ program for developers will start from November 1, 2011 and will continue till March 30, 2012.

Mr. Moorthy Uppaluri, General Manager, Developer Partner Evangelism, Microsoft India said, “India is a vibrant developer market, and we see a lot of excitement and enthusiasm around the availability of marketplace for customers in India. We believe that opening up this marketplace will provide the developer community in India with an opportunity to showcase creativity. He added, “The best part about Windows Phone Marketplace is that developers will be able to use familiar development tools and technologies. They create global market opportunities for themselves and reach out to a large user base.”

The main offer has three categories:

Submit and Receive: Developers get a chance to receive a Windows Phone by submitting three distinct, original and non-trivial Windows Phone applications.

Port 2 Apps and Receive: Developers submitting two Windows Phone applications that are ported from existing Android and iPhone applications will get to receive a Windows Phone.

Women Special: The first hundred women developers to submit one Windows Phone application will qualify to receive a Windows Phone each. The applications can be based on entertainment, fashion, leisure, sports, recreation or travel themes.

In addition to these categories there is also a special offer for students. Each student to submit a Windows Phone application will receive a Merit Certificate, a Windows Phone T-Shirt and a 2GB USB flash drive. Students submitting four apps will additionally receive a Windows Phone. Submissions for the student category will close on December 18, 2011. Any app submitted under this initiative will be considered as a valid entry only after it passes Windows Phone Marketplace certification testing.

Visit http://www.microsoft.com/india/student/windowsphone/  for more information.

Happy Coding. 🙂

 

AppFabric ebook – Free Download

I have been passive for quite some time and would like to be back into regular blogging.

Today,  I present an eBook which is available for free.

 The developers guide to AppFabric – October Edition. 

Alan Smith  is the author of the book and explains “The Developer’s Guide to AppFabric” is a free e-book for developers who are  exploring and leveraging the capabilities of the Azure AppFabric platform. Click here to download. You can visit here for the latest edition of the book.

Happy coding 🙂

 

Task Failed because “SGEN.EXE” was not found

I was approached by a colleague recently about an error related to “SGEN.EXE” when tried to build the project in release mode. This error is only for the release mode and in debug mode it works perfectly.

I researched further on the error:

Sgen.exe is an XML Serializer Generator Tool used to create an assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.

Sgen.exe generates the [libraryname].XmlSerializers.dll and will be used by the clients of webservices to speed up the time to load the webservice.

Solutions:

  1. Right click on the project and in the properties page of the project, click on the Build tab.
    Select Configuration: Release.
    At the bottom, Generate serialization assembly is set to AUTO. When it is AUTO in release mode, SGEN tries to create XML serialization assembly and fails. Set Generate serialization assembly to OFF. If it is set to OFF, Visual Studio never runs sgen.exe.
  2. Copy the sgen.exe file from  C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ to C:\WINDOWS\Microsoft.NET\Framework\v3.5\. I’m not sure if this is 100% solution.
  3. Solution:
    • Open the GAC (C:\Windows\Assembly), find the DLL corresponding to your project.
    • Right click on it and select uninstall.
    • Now, re-build your project and the problem must be gone.
  4. Final solution would be to try refreshing from SourceSafe and if it wont solve the problem would be to destroy entire solution hierarchy and get a fresh version of solution to a new location.

I’m sure the first solution should solve the problem, 2nd and 3rd solution can be tried to solve the error.

Let me know if there is anything can be added in comments section.

Happy Coding Smile

 

Response.Redirect(url) : Solution for ThreadAbortException

From the early days of using ASP.NET, we use Server.Transfer(URL) and Response.Redirect(URL). These simple calls used in ASP would never create problems but, in ASP.NET an exception is thrown when used.

The ThreadAbortException is thrown when a call is made to Response.Redirect(url). This happens because the system aborts processing of the current web page thread after it sends the redirect to the response stream. Internally, Response.Redirect(url) makes a call to Response.End() and that call Thread.Abort() which forces the stack to end the thread.

Many suggest using Try and Catch block. I feel it may not be a proper solution as processing exception can be costly. Best option would be to use an overload method of Response.Redirect() to redirect without calling Response.End().

Response.Redirect(string url, bool endResponse);

Response.Redirect(url, true) The client will be sent the redirect for the new page and present page will immediately stop processing as a thread abort will occur.  This is the default behavior of a redirect.

Response.Redirect(url, false) – In this overload method, the second parameter tells the system whether to make the internal call to Response.End() or not. Parameter should be false to make the client is sent to redirect url but call to Response.End is skipped. This is one way to avoid the exception, but the cost is that this thread doesn’t stop executing the Application events!

If you are doing a redirect in Page_Init (or any page events) and call Response.Redirect(url, false) the page will only redirect once the current page is done executing.  This means that any server side processing you are performing on that page WILL get executed.

Though, there are cons of using both methods I personally prefer using Respose.Redirect(url,false).

Creation of the virtual directory http://localhost failed

When creating a copy of an application from Visual Source Safe, sometimes developers get the following error message :

The local IIS URL http://localhost/ specified for Web project DemoWebsite has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?

After clicking ‘Yes’, a new error message will be displayed:

Creation of the virtual directory http://localhost/ failed with the error: The URL ‘http://localhost/’ is already mapped to a different folder location.

All the projects will be loaded expect for a project which states unavailable and by right-clicking the project and selecting the option of editing the file with an extension of either .csproj or .vbproj.

In the file, find <iisurl> tag with localhost.( <iisurl>http://localhost/</iisurl&gt;) Change the tag details to your application name (<iisurl>http://localhost/yourapp</iisurl&gt;). Reload the project and you should be able to load the project now.

Happy Coding. 🙂