Friday, October 30, 2009

ExtJS GridPanel autoExpandColumn issue with IE

Issue: In Internet Explorer the column set to autoExpand will go beyond the page width. The Grid will not fit into browser

Solution: Change the attribute in the CSS file:
File Name: ext\resources\css\ext-all.css
Code change:
Original: .x-grid3-header-offset{padding-left:1px;width:10000px}
Code fix: .x-grid3-header-offset{padding-left:1px;width:auto}

Monday, October 19, 2009

Aggregation with String in SQL Server

The following code will do the similar functionality of a amount column summation for String data (String concatenation)

SELECT DISTINCT Author, Titles
FROM (select Title, Author from BookStore) a
CROSS APPLY ( SELECT Title + ' '
FROM (select Title, Author from BookStore) b
WHERE a.Author = b.Author
ORDER BY Author
FOR XML PATH('') ) D ( Titles )

Reading large XML File

Here is the code for reading large XML file, this code works faster than opening the file in any other application.

XmlTextReader xtrInput;
XmlDocument xdItem;
xtrInput = new XmlTextReader("sample.xml");
int i = 0;
while(xtrInput.Read())
{
while (xtrInput.NodeType == XmlNodeType.Element && xtrInput.Name.ToLower() == "record")
{
i = i + 1;
xdItem = new XmlDocument();
xdItem.LoadXml(xtrInput.ReadOuterXml());
xdItem.Save("file" + i.ToString() + ".xml");
}
}
xtrInput.Close();


Monday, June 8, 2009

Error registering COM+ dll using Regsvcs.exe

“Could not load file or assembly System.IO.FileNotFoundException”

This error happens due to various reasons. The first solution that you will find for this issue is, “Copy all the dependency files to the destination server and register the dll”. This seems to be an easy fix, hence we miss this solution by oversight. Do not go by an understanding that target machine has the similar environment as our development machine and there is not need to copy the dependencies. Dependencies need not be the framework dll, it can also be any specific dll created for this process. In such case copy the latest of that dlls to the bin folder of the solution and build the code. Copy the latest build and the dependency dlls to the target machine and register the dll.

There may be other reasons for which you may receive this error. Information about the same are available in the following link.

http://blogs.msdn.com/dougste/archive/2006/09/05/741329.aspx

Additional information on COM+ registration
http://social.msdn.microsoft.com/Forums/en-US/netfxremoting/thread/343e7086-8b24-4314-ad5a-4115dfaadce0

Monday, April 13, 2009

WMI - Failed to connect

WMI (Windows Management instrumentation) service had been an issue recently in most of the installation like SQL Server 2005, SQL BPA etc. There are many solutions provided on the net, having tried almost all, only the following worked at last - Rebuilding WMI

Comprehensive rebuild methodImportant note:
If you've installed a Service Pack, you need to insert your Windows XP CD with Service Pack integration (called as the Slipstreamed Windows XP CD). If you don't have one, you may point to the %Windir%\ServicePackFiles\i386 folder for a recent version of the system files required during WMI repair. Or you may create a slipstreamed Windows XP CD and insert it when prompted.
Click Start, Run and type the following command, and press ENTER:

rundll32.exe setupapi,InstallHinfSection WBEM 132
%windir%\inf\wbemoc.inf

Insert your Windows XP CD into the drive when prompted. Repair process should take few minutes to complete. Then restart Windows for the changes to take effect.
Note: Do not copy wmiprvse.exe while rebuilding. Remove this file from the %Windir%\ServicePackFiles\i386 folder, if exists, then start rebuilding. This file will cause CPU spike.

Tuesday, January 20, 2009

First level of Performance Tuning in SQL Server

A Simple way to performance tune your query:
a) Check if the WHERE clause is using INDEX or FULL TABLE scan using query plan
b) Ensure the columns used in WHERE clause is in the order of the index creation (if applicable)
c) Include the WHERE condition that would limit the number of records to be searched and then the JOIN condition

Recently I have created a query which took nearly 4 minutes to get executed. I did the following changes, which made my query get executed in 2 minutes.
(I have changed the table names for this sample)
Initial Query:
SELECT FROM Employee empINNER JOIN Address adr ON emp.EmpID = adr.EmpIDLEFT OUTER JOIN Phone ph ON emp.EmpID = ph.EmpIDLEFT OUTER JOIN FamilyMembers fly ON emp.EmpID = fly.EmpIDLEFT OUTER JOIN BankDet bk ON emp.EmpID = bk.EmpID
I commented all the JOINs and uncommented each JOINs and verified the execution time. Only for Phone it took more time. Hence I moved the JOIN condition for Phone at the end of the JOINs. This limited the records to be processed for the Phone table and reduced the timing.

Tuned Query:
SELECT FROM Employee empINNER JOIN Address adr ON emp.EmpID = adr.EmpIDLEFT OUTER JOIN FamilyMembers fly ON emp.EmpID = fly.EmpIDLEFT OUTER JOIN BankDet bk ON emp.EmpID = bk.EmpIDLEFT OUTER JOIN Phone ph ON emp.EmpID = ph.EmpID

Sunday, January 18, 2009

Covey's impressive answers (An extract from The Economic Times)



How can you be effective in time when negativism is so pervasive ? This is a perfect time to create long-term competitive advantage . It’s in times like these that people can adapt and make sacrifices . This is really an opportunity for creative businesses to gain long-term competitive advantage. Even if we find that we are not in control of anything, one always has the power of choice to do what one can do.

Every management expert says that tough times should be used to build competitive advantage. But is it easy to think about building competitive advantage when all you are thinking of is survival?

It’s tough because everything around people is negative. When the external factors over which one has no control in a way start to become negative it starts to affect our creative juices. You have to be creative in these times and take advantage of this ‘valley’ and turn it into a ‘peak’ , a new initiative can make a difference and the key to that is to move away from the industrial age model because the industrial age model is top down and command-and-control.

And tough times help unleash the creative force in people’s own professional lives and that feeds upon itself and the creative juices get going again. It’s not easy but it’s within reach. And it’s the perfect time to do so.

This profits vs principles war is seeing the wrong winner in some cases. Do you think there needs to be a rethink on the ‘hows’ of the business?
I think that’s part of it. People have to look up to themselves to begin with - an inside out approach. They must also learn how to involve other people all the way; to involve the entire organisation to look at these issues; to develop systems and structures which reward the right things.

What’s the new model of openness that you are advocating these days? It involves being clear and transparent. In taking the reality of what is happening with the people and then asking them: What do you think we can do in this situation? You will find that it will work on the basic underlying forces that produce trust and openness. We have had misaligned systems that rewarded people for wrong things and this has been happening all around the world.

This is the perfect time to unleash people’s creative energies and come up with new creative ideas and companies can do this with suppliers and their customers because everybody is feeding on the paranoia and the fear.

It’s like a cancer that feeds upon itself and people get victimised by all these forces. So they criticise, they complain, they compare, they become cynical, they compete. This is the perfect time to take advantage of this and turn it around. And you have to be creative on how to do that and that will be the main challenge.

Why have you focused on habits to bring about change? Because people co-relate habits of thought and habits of actions which are completely misaligned with these new realities. And it’s like trying to play tennis with a golf club. The habits, not only of people, but also the structures of the system (Covey calls them habits of organisations) of the organisation are misaligned. The result is that people get negative and pessimistic and discouraged and disparaged and that feeds on itself.

How does one prioritise one’s life when there are so many demands on one’s time because of one’s role as a father, husband, employee, boss?
You have to get everybody in the culture on the same page about what is really important. The thing that is important now is taking advantage of this difficult time by unleashing the creative energy but what’s happening now is that fear is sprayed everywhere. And people have no control over this situation. What is important is the need for a balanced life, in which you learn to say no to things that are urgent even though not important.

Most people spend half their lives doing things that are urgent even though not important and they know it. They don’t have the courage to say no to things that are not important. My Seven Habits book deals with personal and interpersonal, The Eight Habit deals with the organisational. And unless people wake up and change the structures and systems, the entire culture , it won’t happen.

Do you believe in fate? I believe in faith. One of the things that I have admired about India is the spiritualism of the people. That’s a great advantage and because of that spirituality, if one can learn to change the systems we have and learn to synergise with each other, then India can again become a dominant force in the world.

If we look at the progress India has made in the past decade, it’s tremendous. I admire that. You have such tremendous traits, only if you can get out the vindictiveness, defensiveness and the negative energy out of the way.

Full article: http://economictimes.indiatimes.com/Features/Corporate_Dossier/Be_effective_in_tough_times_and_win_back_trust_Stephen_Covey/articleshow/msid-3986583,curpg-1.cms