Sunday 7 February 2010

Struts.NET = ASP.NET MVC ?



These days, I am reading a bit about ASP.NET MVC and it looks like Microsoft is trying to implement Java Struts !

Does it mean that it took so long for .NET guys to understand Struts and get ASP.NET support such a paradigm?

Let's not get into a Java vs .NET debate but see the similarities and differences between ASP.NET MVC and Java Struts:
  • To start with, an ASP.NET form expects/mandates only one form tag but with MVC now, you can have any number of form tags in an ASPx page. You could have any number of form tags in a JSP page.
  • The code-behind event handlers used to act as controllers in a standard ASP.NET web application. In Struts, an Action class acts as a controller which means that any submit action on a page is associated with an Action class. ASP.NET MVC is following the Struts Action controller approach now.
  • ASP.NET MVC takes very good advantage of LinQ-SQL. VS 2008 is made so powerful that it eases the life of a developer by generating lot of useful code. On the other hand, although there are OR class libraries like Hibernate, the IDEs (the ones that I used so far) generate very little code and thus make you write a lot of code !
  • ASP.NET MVC is convention based, meaning that it expects the controllers/view pages and the model to follow a consistent naming convention (although, this is not mandatory and not that restrictive too). In Struts, the key is Struts-config.xml that associates a view and a controller.

So far, these are some of my observations on Struts and ASP.NET MVC. Let me make my hands dirty with ASP.NET MVC and then talk more about it after I achieve a level of comfort :-)

Thursday 3 December 2009

CRM FetchXMLBuilder ...

While developing applications (Plugins, Workflows, Service Portals) for CRM, it is a quite common requirement to build FetchXML or write search logic using QueryExpressions of CRM SDK API.

I found an excellent tool called Fetch XML Builder that helps you prepare FetchXML by building queries and joins using an intuitive user interface.

Let me tell you that there is a smarter way to extract FetchXML and this is how you can do it:

  1. Open Advanced Find in CRM Build your search criteria in the UI (you can't get a sophisticated UI than this :-))
  2. Save the query
  3. Hit Find




  4. View the source of the results page and search for the hidden field named "fetchXML".




Now, my attempt is not to outsmart the tool - Fetch XML Builder, but let me tell you how you can use this tool for some useful code :)

  1. Launch Fetch XML Builder
  2. Click "Import" -> "User Query" to import the query that we built in CRM




  3. Now, let the tool generate code for you by clicking on "Create Code" -> "QueryExpression"
Let the effort that had gone towards building an intuitive UI for FetchXMLBuilder be appreciated :-)

Windows Service Monitor ...

.NET makes life lot lot easier at times. Recently I came across a requirement where it is required to monitor the installed windows services and send a notification (via Email or an SMS) to designated people letting them know that a windows service of interest got stopped.

I searched for a freeware in Google and found that all the products out there can send an email when a service "fails" not when a service is stopped.

I ended up writing a small windows based application that looks like below:




The program monitors the selected services at regular intervals of time (configurable) and sends an email when a selected service is stopped (one email per service).

The source code for the above program is here.

Tuesday 27 October 2009

Extending CRM 4.0 ...

These days I get to spend a lot of time working on CRM 4.0. In this post, I would like to list (without much technical details) some of the extensions that I have implemented on CRM 4.0.

Audit CRM records

  • Created a little plugin that logs changes to a record to a custom entity (just one is sufficient to hold changes across all entities :-))
  • A web page that presents the changes in a readable format

Record Counter


Concurrency checker

  • An interesting implementation that checks to see if the current record was already saved by one user when two users had opened it simultaneously.

Tuesday 6 October 2009

Commercializing Calamities ...


I like to watch news on TV, but not anymore !! With increasing number of TV channels that serve news 24X7, it looks like every damn thing is made news about. Things that one doesn't care is being hyped up to an extent that audience go mad discussing it or feel anxious about.

It is my subjective feeling/opinion that NEWS channels (in particular) should follow certain standards. The other day, I was watching a news channel that went on saying that it motivated the public so much that people turned up in huge numbers to help out flood-hit areas. Well, when there is a calamity and a fellow being is suffering in some part of the world, it is quite natural that people empathize the suffering and come up with some generosity to help the needy.

I got pissed off with the way these TV channels promote themselves. For these TV channels, even charity seems to be NEWS, helping the needy is a means to increase their TRP ratings !! Shame on such channels that put themselves as the only motivators helping out people suffering from a natural calamity!!!

There is a saying - "No news, Good news" but it looks now, every news is a bad news or may be bad is brought out to make news !!

Thursday 4 June 2009

JQuery.NET ...

Of late, I have been reading through JQuery and I find it very interesting.A fantastic javascript library that helps web developers traverse the HTML DOM fairly easily.

I found an interesting example that uses JQuery here.

I built a .NET custom control using the example above.

Some of the features are:


  • Ability to bind the control to a list of name value pairs

  • Allow the control to be initialized with a list of tokens

  • Property to determine if the list has to allow adding items not in the search results


Feel free to write to me incase you are in need of such a control and I shall be glad to email you the sources.


Note: Please do not forget to quote your email address while requesting for the sources :-)


Cheers !!

Saturday 23 May 2009

Cancer - Can Sir ...

Continuing with my last post where I ended with a wish/pray that ARR wins an OSCAR for India - On the day when OSCARs were announced, I was up early in the morning not just to see the event but attending a CT Scan for my dad !! I was going through a mixed feeling - on one hand, my wish for my icon got fulfilled while on the other hand, my dad was diagnosed to be suffering from Cancer!

Cancer - the term is scary, for sure. It is often said that "Cancer can be cured when diagnosed early" and having observed the diagnosis and the treatment for my dad, I intend to put my experiences with an aim to spread the awareness on Cancer.

What is Cancer - putting it simply it is a disease where some cells in our body start multiplying exponentially resulting in bulges/tumors on the body.

How do you diagnose it ? - This is infact a tough question.How many times did you feel your whole body to observe any lump/bulge that is not painful ? I am sure the answer is "zero". Generally, we tend to ignore a swelling/lump/bulge in our body that is not causing pain and there's the culprit.

A swelling that is painful is less dangerous than the one that is not painful.

In my dad's case, we observed a swelling near the left jaw and we ignored it ('coz we were busy with my engagement and marriage events and on the other hand, the swelling is not causing any pain !). We went to a local doctor who concluded that it is a general infection, while it is not.My dad started experiencing pinching pain near the abdomen and that's when we consulted a specialist who diagnosed the disease to be Cancer. (thanks to the doctor - Dr.G.V.Prakash).

Dr.Prakash helped us by explaining the purpose of each test, the results and the next steps. After having gone through a set of tests that ensured that all the vital organs in the body are in tact, he referred us to a Radiation Oncologist (Dr.Nalini) who took up the case and started the treatment.

The treatment comprises two major procedures - Radio therapy and Chemo therapy.
Radio therapy - the patient is subjected to controlled radio active rays at the area where Cancer is identified.
Chemo therapy - a particular combination of injections/chemicals are injected into the body which identifies the culprit cells and kills them. The chemicals are so powerful that they affect the normal cells too and as a result the patient suffers from various side-effects like loss of hair, sore throat, mouth ulcers, vomiting sensation, dehydration, fever, etc..


Believe me, Cancer is a disease where the disease doesn't cause the pain but the treatment is painful. I thank God for my dad is able to bear the pain and I pray Him to give my dad all the strength to tolerate the side-effects and come out of it healthy.

During the course of the treatment, I had collected some material guiding the patients as to how they have to maitain diet during the treatment and here is the link to that document.

For Cancer, more than the medicine, it's the diet/food and a positive attitude that helps one fight it.

I hope I have contributed a bit towards fighting Cancer by spreading awareness and I will be more than happy if the information here helps you in some way.