Skip to main content

Posts

Showing posts from 2012

Silly but useful stuff - Part 1 (.Net)

Collection and List Let's have a look at this snippet: In first sight, most of you might feel that both List and Collection will contain print numbers from 1 to 6. Am I right? But Alas! There is a hidden gotcha in it ;) Because the actual output is: What happen surprised??? If you have ever tried to get in depth of Collection and List, then you might know the answer. Well, the answer is pretty simple. MSDNdocumentation clearly states that "Initializes a new instance of the Collection class as a wrapper for the specified list" . And on the other hand, MSDN documentation states that "Initializes a new instance of the List<T> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied." Hope now it is clear to you. So, the moral of the story is, one should be very cautious while using L

Converting a given string to Title Case

To convert string in title case is bit tedious and may require lot of code as there is no direct method available in C#.Net  in String class. So, here I am sharing a method, which will be the extension method for String class and can be used to convert given string to title case. Here I am using CultureInfo from Globalization and ToTitleCase method of TextInfo class. public static class StringExtensions {     public static string ConvertToTitleCase(this string input)     {         System.Globalization.CultureInfo cultureInfo =         System.Threading.Thread.CurrentThread.CurrentCulture;         System.Globalization.TextInfo textInfo = cultureInfo.TextInfo;         return textInfo.ToTitleCase(input.ToLower());     } } Hope reusing this will save lot of your time :)

Changes in Visual Studio 2012

Introduction Nowadays, we see that software development process is shifting from enterprise-driven process to consumer-focused approach, in which applications are fully based on the taste of consumer market and the devices they want to use. And the speed at which these devices and platform are emerging, it is becoming more and more challenging for developers. Earlier applications were used to run on a server or a desktop but today many more devices like smartphones, tablets are becoming ubiquitous. So, in this case developer must either create applications that work on multiple platforms or make applications tailored to each platform with similar logic and the most important thing is, there should be a connected experience that allow user to seamlessly move among all these devices and platforms. But as long as Microsoft is with developers, developers need not worry. Agree ???  Visual Studio 2012   Launch of  Visual Studio 2012  solved a lot of problems. Now instead of the de

Windows App Splash Screen - Beginners Tutorial

I ntroduction Continuing to my previous article title, here we will see about splash screens, how to set the splash screen image and how to change the background color.  Splash Screen Every Windows Store app must have splash screen. Splash screen consists of image and a background color. Whenever the user will launch application, splash screen will be the first to come up. Now you might be thinking, what is the purpose of splash screen??? We all know that, whenever any application is launched, lot many things happened at backend before our application is fully launched. So, splash screen provides a way to hide all those background details from the user. This splash screen is launched, when application is initialized and as soon as our application is ready for interaction, this splash screen goes off. Isn't it a nice thing ? Now question is can we customize this splash screen ? Then my answer will be Yes. You can customize image as well as background color. Enough of th

Creating Windows Store app - Beginners tutorial

I ntroduction In this tutorial we will be creating a very basic Windows Store App using XAML and C#. As this is the very first tutorial of this series, I'll be focusing mainly on project setup and basic workflows and later on, in other upcoming series, I'll be picking up more advance concepts. So, before moving forward, let's talk about the environment setup to execute our app. Pre-requisite In order to complete Windows 8 metro style app, our machine need following things: You need Windows 8 with Microsoft Visual Studio Express 2012 You need developer license  Creating a project Launch Visual Studio 2012. Select File >> New Project. The New Project dialog window appears and from the left pane you can select template of your choice In the left panel, you can select 'Windows Store' template. Once selected, center pane will show you the list of available items for the selected template. Here we are using  Blank App

The URL you requested has been blocked as per DOT guidelines

Today while doing internet surfing, I found that few sites are giving error message as:  and the solution to this error is: Go to this  URL and download Tor Browser Bundle  Extract the downloaded folder on your machine Run start Tor for browser And you are done. Now access the internet and your issue is resolved.  Hope it helps :)

Out-Of-Memory error and Visual Studio crashes

As part of assignment, I was working on a project, which is having 137 projects Windows Form in a solution. Whenever I was building my solution, I was getting Out-Of-Memory error and due to this my Visual Studio use to get crash. Then the only solution left with me was to restart my Visual Studio  L . Earlier I as facing this issue once a while, but from last week, it is occurring frequently. Hope you can imagine, how painful it is restart the Visual Studio every now-and-then, especially when your solution contains such a huge number of projects. My error was something like this: “ The "ResolveManifestFiles" task failed unexpectedly. System.OutOfMemoryException: Insufficient memory to continue the execution of the program.”   The only thing, which was coming into my mind, was that it is due to Visual Studio’s memory limits. I also tried to minimize Visual Studio, but no luck :( . After consulting with few people, I got an idea to breakup my solution into multiple s

Starting with Prism - Part 2 of n

Background Continuing to my   Prism series 1 of n , in this series, I am going to talk about a few more interesting concepts like Modules and Views. Modules In this article, we will talk about how to take other views/logic and broken down into a small pieces called Modules and use them in your Prism application. We gonna start-up by talking about What a Module is, then registering Modules, loading Modules and then we will talk about how to initialize a Module. What is a Module? You can think Module as a building block for our Prism application. It is a package that contains all the functionalities and resources required for our application. Prism provides a support for run-time Module management in our application, in which each Module can be developed and tested independently. Prism application loads the Modules as and when they are required. Before moving forward, let’s have a look at how our application was architected inside Visual Studio prior to the concept of Module