Skip to main content

Posts

Starting with Prism - Part 1 of n

Introduction  Prism provides the guidance to create composite applications and help us to design loosely coupled components, which can be integrated and developed in seamless manner. Like every other application, Prism application also need to get start from somewhere. And when coming to Prism, it is Bootstrapper and Shell. These two things help any Prism application up and running. In this article, we will look more into Bootstrapper and its process. So, gear up and let's get started... Bootstrapper So, what is Bootstrapper? Bootstrapper is the class, which is responsible for initializing our application. Now question is what to initialize? So, the first thing is to initialize is the Core Services and then the Application Specific Services. Core Services : These are non-application specific services that Prism library provide to us. These services include: IModuleManager  - Responsible for retrieving application's modules IModuleCatalog  - It is used to register

Strange fact about GetHashCode()

While doing one of my assignment, I came across a strange fact about GetHashCode() in C#. Object.GetHashCode() tells that String class returns identical hash codes for identical strings. But after doing some experiments, I found that above mentioned statement is bit misleading. Actually, it varies from architecture-to-architecture, depending upon, whether one is using 32-bit or 64-bit machine. To prove this, I created a sample application in C#. I ran above snippet on 32-bit windows machine and found below result: then I ran the same code on 64-bit machine and come up with below result : Now looking at above results, one can easily conclude about the behaviour of GetHashCode(). So, beware and think atleast twice, before using GetHashCode() for strings, as it may give different-different results on different-different platforms. CodeProject

Submitting a HPC job from on-premise - Part 2 of 2

Continuing with my previous article, today I am going to share my one more experience with HPC.  Nowadays, there are lots of links available on net, which tell, how to submit a job to Azure HPC Scheduler. I also explored most of them, and found that almost all are talking about job submission from cloud premise(Front or Head node). But nowhere was it mentioned how to submit a job from outside of cloud vicinity. I came across this issue, while working on one of my assignments. After hitting my head, finally I found a way to do this. When we are talking about interaction between cloud and on-premise, then first thing come into our mind is network. Here definitely, TCP won’t work. There are few transport schemes available in Azure HPC framework. After exploring them, I found one as WebAPI and wow, that suits my requirement. I just used WebAPI as transport scheme, by modifying the name of the headnode to complete host name (i.e. <headNodeName>.cloudapp.net) and get my issue re

My first day on Microsoft Windows Azure HPC - Part 1 of 2

Recently I entered into the Azure’s HPC world and thought to share something, which I learnt from my experience as a beginner. Today is my first step towards the Azure’s HPC.  I just downloaded the sample service and followed the configuration instructions. But even after following those, I faced few difficulties during this journey. So, here I am sharing that experience only. Hope it will be useful for all newbies. I feel that below are the few points, which are directly related to the application performance. 1)       Affinity Group – While working on cloud, the first thing comes into mind is performance and throughput. And in order to gain better throughput and performance, one need to make sure that all our services and storage accounts hosted on the cloud are located in proximity, which will reduce data transfer time. So, to bring all the services and storage closer, we can keep all of them in a group. And in Azure’s term, this group is called as Affinity Group. So, cr

Performance analysis for String and StringBuilder

Sometimes small-small changes in our code really makes a huge difference to a performance. There are many tips and tricks available and among those, one I am going to discuss over here. I'll be talking about  String vs StringBuilder. One needs to be very careful while playing with strings because memory wise there is a huge impact of strings. I  know, there are lots and lots of articles available on net on String and StringBuilder, but still I am going to show this, using some statistics. Here I am taking Fx 4.0 C# console application with different static methods to showcase my analysis.  Basically what I am doing here is, I am having a String variable named  outputString  and just looping that for 1000 times and concating the string to variable outputString.  Please note, concatenation is done using + symbol. So, what happens internally is, whenever concatenation is done using + symbol, every time, new String object is created. So, as with my snippet. Here I am  lo

BackgroundWorker in .Net Console Application

Today I was just doing net surf and came across one interesting question 'Can progress event of BackgroundWorker execute after completed event'. At first I thought no, but when I tried this with Console application, I was also able to reproduce this issue. Now question is, how come this scenario occurs in Console app and not in Windows form. Pretty interesting, right ? Now coming to Windows form, this issue will never occur, due to message queuing support. Windows message queue takes very good care of execution sequence of the events. This clearly mean that the progress event may run after the DoWork has completed, but the completion event will always happen afterwards. Another interesting thing here is the SynchronizationContext, which helps in maintaining all these sequencing. But when talking about Console application, none of the above holds true. There is no SynchronizationContext installed and the events just end up in getting run in threadpool thread, which doesn&#

Resource name can not be used more than once

Recently I came across an error "Resource name can not be used more then once". Apart from this, error message was not showing any other information, not even line number, file name, nothing. Generally such errors came, when there is any duplicate key present in resource file, but in my case, I was not using any resource file also. So, there is no chance of duplicate keys also. I tried to hit my head many times for some online help, but no luck :( One thing I noticed was, after building my solution (it was in VS2010) for 3-4 times continuously, error was thrown. Please note, I was just building the solution, without doing any modification in my code or in any of the files. Still I didn't get any clue. So, finally I thought to remove one one project from my solution and build. Till 4-5 projects I removed and I didn't get any clue till yet. Suddenly I found that, Obj folder is added to my solution explorer. This obj folder holds all temporary files with few .resour