Labels

Friday, August 29, 2008

IIS Logging

Hi,

Here we’ll cover below.

- How to enable IIS Logging

- Where the IIS log files are stored?

How to enable IIS Logging

- Run Internet Information Services (IIS)

- Right click on ‘Default Web Site’ and choose properties.

- On the Web site tab, near the bottom, Check the checkbox that says "Enable Logging".

Where the IIS log files are stored

- Next to the checkbox there is a Properties button. Click on the Properties button.

- At the bottom of the General Properties tab, you will see a box that contains the log file directory and the log file name. The full log path is comprised of the log file directory plus the first part of the log file name.

Thanks & Regards,

Arun Manglick || Senior Tech Lead

Monday, August 18, 2008

Latest MSDN Flash Questions

Jan 02, 2008

1. What is the default value for the Char type?

(A) "0'

(B) ''

(C) '\0'

(D) null

Ans: (C) '\0'

2. Which type of class can you develop to alter SOAP messages sent to and from an XML Web service and client?

(A) SOAP Messages

(B) SOAP Alterations

(C) SOAP Configurations

(D) SOAP Extensions

3. In C#, what character is used to indicate a verbatim string literal?

(A) @

(B) !

(C) "

(D) #

--------------------------------------------------------------------------------------------------------------------------------------------------------

Jan 22, 2008

1. What does the acronym CLS stand for?

(A) Common Language Standard

(B) Common Language Specification

(C) Component Language Standard

(D) Component Language Specification

Ans: (B) Common Language Specification

2. What is the comment syntax for C#'s XML-based documentation?

(A) /** and **/

(B) //#

(C) ///

(D) //*

Ans: (C) ///

3. Which C# statement is actually a shortcut for calling the Enter and Exit methods of the Monitor class?

(A) mutex

(B) lock

(C) semaphore

(D) thread

--------------------------------------------------------------------------------------------------------------------------------------------------------

Feb 15, 2008

1. What is the default value for the Char type?

(A) '0' (B) '' (C) '\0' (D) null

Ans: (C) '\0'

2. Which of the following is a value type, and not a reference type?

(A) array (B) delegate (C) enum (D) class

Ans: (C) enum

3. What is the default version of an assembly?

(A) 1:0:1:0 (B) 1:0:0:1 (C) 1:0:0:0 (D) 1:0:1:1

Ans: (C) 1:0:0:0

--------------------------------------------------------------------------------------------------------------------------------------------------------

Feb 28, 2008

1. Shared assemblies are installed where?

(A) System Assembly Cache (B) Global Assembly Cache

(C) Machine Assembly Cache (D) Windows Assembly Cache

Ans: (B) Global Assembly Cache

2. Which of the following is not a method of System.Object?

(A) GetType (B) ToString (C) Equals (D) Clone

Ans: (D) Clone

3. What is the term used to describe the process the Runtime uses to find an assembly?

(A) Locating (B) Probing (C) Searching (D) Resolving

Ans: (B) Probing

--------------------------------------------------------------------------------------------------------------------------------------------------------

Mar 18, 2008

1. In C#, what character is used to indicate a verbatim string literal?

(A) @ (B) ! (C) " (D) #

2. Which interface allows a collection to be navigated using the foreach statement?

(A) INavigator (B) ICollection (C) IEnumerator (D) IEnumerable

3. In C#, which of the following is not a valid C# jump statement?

(A) jump (B) goto (C) return (D) throw


Ans: (A) Jump

--------------------------------------------------------------------------------------------------------------------------------------------------------

May 20, 2008

1. To modify a SOAP message in a SOAP extension, what method must you override?

(A) ChainStream (B) ReceiveMessage
(C)
ProcessMessage (D) SoapMessage

Ans: (A) ChainStream

2. Pick the command line that would result in the C# compiler generating an XML documentation file:

(A) csc /doc:HelloWorld.xml HelloWorld.cs
(B)
csc /doc /docfile:HelloWorld.xml HelloWorld.c
(C) csc /doc /out:HelloWorld.xml HelloWorld.cs
(D)
csc /xml HelloWorld.cs

(A) csc /doc:HelloWorld.xml HelloWorld.cs

3. All types derive from a single base type called:

(A) System.Base (B) System.Object
(C) System.Root (D) System.Type

(B) System.Object

--------------------------------------------------------------------------------------------------------------------------------------------------------

June 03, 2008

1. To add performance counters to your .Net application, you would use:

(A) Windows.Diagnostics (B) System.PerformanceCounter

(C) System.Diagnostics (D) App.PerformanceCounter

2. Configuration files for .Net applications are in what format?

(A) XML (B) XHTML (C) ASPX (D) CS

3. CLR stands for:

(A) Code Language Runtime

(B) Common Loading Runtime

(C) Common Language Runtime

(D) Code Loading Runtime

--------------------------------------------------------------------------------------------------------------------------------------------------------

1. To add performance counters to your .Net application, you would use:
Ans: (C) System.Diagnostics

1. What is the default value for the Char type?
Ans: (D) Null


July 08, 2008


1. In SQL Server, if you want to track date and time of the last time access, you will:

(A) Add a time stamp to the table (B) Insert a Trigger field in the table (C) Add a datetime column to the table and write a trigger that sets its value (D) Insert a unique identifier column to the table

Ans: (C)


2. In C#, the use of system.string is more efficient than string, for memory usage and performance?

(A) True (B) False (C) Both perform equally

Ans: (C)


3. In C#, every method must have a name. Is this True or False?

(A) True (B) False (C) True for C#2.0, False for C# 3.0

Ans: (B) - False


July 15, 2008

Are you up-to-date with your programming language? Try this trivia to find out.


1. In Visual Studio 2008, how many types of Intellisense can be implemented in the language services?:

(A) 2 (B) None (C) 4 (D) 3

Ans: (C) : 4


2. Chars and strings in .Net are:

(A) 64-bit (B) 16-bit (Unicode/UTF-16) (C) 8-bit

(B) 16-bit


3. Does C# support multiple inheritance?

(A) Yes (B) No (C) True for C#2.0, False for C# 3.0

Ans: (B) No


Aug 05, 2008

Are you up-to-date with your programming language? Try this trivia to find out.


1. Which of the following will NOT have to be re-architected during a VB 6-to-VB.NET migration?

(A) DHTML Pages (B) ActiveX docs (C) OLE controls (D) ADO to ADO over interlop

Ans: (D) : ADO to ADO over Interlop


2. In .Net C#, to which event handler will you add code to validate data before a form is closed?

(A) Closing (B) Closed (C) Deactivate

Ans: (A) Closing


3. When creating an application in .Net for multiple cultures, what should you do during initial design of the application, but before implementing other languages?

(A) Set Localizable property to True (B) Set language property to English (C) Set Text property to English

Ans: (A) Set Localizable Property to True


Thanks & Regards,

Arun Manglick || Senior Tech Lead


Keep the Spark Alive : Chetan Bhagat

 

Inaugural Speech for the new batch at the Symbiosis BBA program, Pune - 23rd June, 2008 - By Chetan Bhagat

 

Good Morning everyone and thank you for giving me this chance to speak to you. This day is about you. You, who have come to this college, leaving the comfort of your homes (or in some cases discomfort), to become something in your life. I am sure you are excited. There are few days in human life when one is truly elated.  The first day in college is one of them.  When you were getting ready today, you felt a tingling in your stomach. What would the auditorium be like, what would the teachers be like, who are my new classmates - there is so much to be curious about. I call this excitement, the spark within you that makes you feel truly alive today. Today I am going to talk about keeping the spark shining. Or to put it another way, how to be happy most, if not all the time.

 

Where do these sparks start? I think we are born with them. My 3-year old twin boys have a million sparks. A little Spiderman toy can make them jump on the bed. They get thrills from creaky swings in the park. A story from daddy gets them excited. They do a daily countdown for birthday party – several months in advance – just for the day they will cut their own birthday cake.

 

I see students like you, and I still see some sparks. But when I see older people, the spark is difficult to find. That means as we age, the spark fades. People whose spark has faded too much are dull, dejected, aimless and bitter. Remember Kareena in the first half of Jab We Met vs the second half? That is what happens when the spark is lost.   So how to save the spark?

 

Imagine the spark to be a lamp's flame. The first aspect is nurturing - to give your spark the fuel, continuously. The second is to guard against storms.

 

To nurture, always have goals. It is human nature to strive, improve and achieve full potential. In fact, that is success. It is what is possible for you. It isn't any external measure - a certain cost to company pay package, a particular car or house.

 

Most of us are from middle class families. To us, having material landmarks is success and rightly so. When you have grown up where money constraints force everyday choices, financial freedom is a big achievement. But it isn't the purpose of life. If that was the case, Mr. Ambani would not show up for work. Shah Rukh Khan would stay at home and not dance anymore. Steve Jobs won't be working hard to make a better iPhone, as he sold Pixar for billions of dollars already. Why do they do it? What makes them come to work everyday? They do it because it makes them happy. They do it because it makes them feel alive. Just getting better from current levels feels good. If you study hard, you can improve your rank. If you make an effort to interact with people, you will do better in interviews. If you practice, your cricket will get better. You may also know that you cannot become Tendulkar, yet. But you can get to the next level. Striving for that next level is important.

 

Nature designed with a random set of genes and circumstances in which we were born. To be happy, we have to accept it and make the most of nature's design. Are you? Goals will help you do that. I must add, don't just have career or academic goals. Set goals to give you a balanced, successful life. I use the word balanced before successful. Balanced means ensuring your health, relationships, mental peace are all in good order.

 

There is no point of getting a promotion on the day of your breakup. There is no fun in driving a car if your back hurts. Shopping is not enjoyable if your mind is full of tensions. 

 

You must have read some quotes - Life is a tough race, it is a marathon or whatever. No, from what I have seen so far, life is one of those races in nursery school, where you have to run with a marble in a spoon kept in your mouth. If the marble falls, there is no point coming first. Same with life, where health and relationships are the marble. Your striving is only worth it if there is harmony in your life. Else, you may achieve the success, but this spark, this feeling of being excited and alive, will start to die.

 

One last thing about nurturing the spark - don't take life seriously. One of my yoga teachers used to make students laugh during classes. One student asked him if these jokes would take away something from the yoga practice. The teacher said - don't be serious, be sincere. This quote has defined my work ever since. Whether its my writing, my job, my relationships or any of my goals. I get thousands of opinions on my writing everyday. There is heaps of praise, there is intense criticism. If I take it all seriously, how will I write? Or rather, how will I live? Life is not to be taken seriously, as we are really temporary here. We are like a pre-paid card with limited validity. If we are lucky, we may last another 50 years. And 50 years is just 2,500 weekends. Do we really need to get so worked up? It's ok, bunk a few classes, goof up a few interviews, fall in love. We are people, not programmed devices.

 

I've told you three things - reasonable goals, balance and not taking it too seriously that will nurture the spark. However, there are four storms in life that will threaten to completely put out the flame. These must be guarded against. These are disappointment, frustration, unfairness and loneliness of purpose.

 

Disappointment will come when your effort does not give you the expected return. If things don't go as planned or if you face failure. Failure is extremely difficult to handle, but those that do come out stronger. What did this failure teach me? is the question you will need to ask. You will feel miserable. You will want to quit, like I wanted to when nine publishers rejected my first book. Some IITians kill themselves over low grades – how silly is that? But that is how much failure can hurt you. But it's life. If challenges could always be overcome, they would cease to be a challenge. And remember - if you are failing at something, that means you are at your limit or potential. And that's where you want to be.

 

Disappointment's cousin is  frustration, the second storm.  Have you ever been frustrated? It happens when things are stuck. This is especially relevant in India. From traffic jams to getting that job you deserve, sometimes things take so long that you don't know if you chose the right goal. After books, I set the goal of writing for Bollywood, as I thought they needed writers. I am called extremely lucky, but it took me five years to get close to  a release. Frustration saps excitement, and turns your initial energy into something negative, making you a bitter person. How did I deal with it? A realistic assessment of the time involved – movies take a long time to make even though they are watched quickly, seeking a certain enjoyment in the process rather than the end result – at least I was learning how to write scripts, having a side plan – I had my third book to write and even something as simple as pleasurable distractions in your life - friends, food, travel can help you overcome it. Remember, nothing is to be taken seriously. Frustration is a sign somewhere, you took it too seriously.

 

Unfairness - this is hardest to deal with, but unfortunately that is how our country works. People with connections, rich dads, beautiful faces, pedigree find it easier to make it – not just in Bollywood, but everywhere. And sometimes it is just plain luck. There are so few opportunities in India, so many stars need to be aligned for you to make it happen. Merit and hard work is not always linked to achievement in the short term, but the long term correlation is high, and ultimately things do work out. But realize, there will be some people luckier than you. In fact, to have an opportunity to go to college and understand this speech in English means you are pretty damm lucky by Indian standards. Let's be grateful for what we have and get the strength to accept what we don't. I have so much love from my readers that other writers cannot even imagine it. However, I don't get literary praise. It's ok. I don't look like Aishwarya Rai, but I have two boys who I think are more beautiful than her. It's ok. Don't let unfairness kill your spark.

 

Finally, the last point that can kill your spark is isolation. As you grow older you will realize you are unique. When you are little, all kids want Ice cream and Spiderman. As you grow older to college, you still are a lot like your friends. But ten years later and you realize you are unique. What you want, what you believe in, what makes you feel, may be different from even the people closest to you. This can create conflict as your goals may not match with others. . And you may drop some of them. Basketball captains in college invariably stop playing basketball by the time they have their second child. They give up something that meant so much to them. They do it for their family. But in doing that, the spark dies. Never, ever make that compromise. Love yourself first, and then others.

 

There you go. I've told you the four thunderstorms - disappointment, frustration, unfairness and isolation. You cannot avoid them, as like the monsoon they will come into your life at regular intervals. You just need to keep the raincoat handy to not let the spark die.

 

I welcome you again to the most wonderful  years of your life. If someone gave me the choice to go back in time, I will surely choose college. But I also hope that ten years later as well, your eyes will shine the same way as they do today. That you will Keep the Spark alive, not only through college, but through the next 2,500 weekends. And I hope not just you, but my whole country will keep that spark alive, as we really need it now more than any moment in history. And there is something cool about saying - I come from the land of a billion sparks.

 

Thank You.

 

Thursday, August 7, 2008

05 - Blocking and Deadlocking

Hi,

Here we’ll cover below:

- Blocking

- Deadlocking

- Identify Blocking

- DEADLOCK_PRIORITY

- Deadlock & SQL Profiler

Blocking-

- Blocking occurs when a transaction is locking resources that one or more other transactions want to read or modify.

- Possible Reasons

o Transactions that BEGIN and then request user feedback or interaction

o Transactions that BEGIN and then look up data that could have been referenced prior to the transaction starting.

o Using locking hints inappropriately; for example, if the application only needs one row, but uses a table lock instead

o The application uses long-running transactions, updating many rows or many tables within one transaction.

Deadlocking -

- Deadlocking occurs when one user session (let's call it Session 1) has locks on a resource that another user session (let's call it Session 2) wants to modify, and Session 2 has locks on resources that Session 1 needs to modify. Neither Session 1 nor Session 2 can continue until the other releases the locks, so SQL Server chooses one of the sessions in the deadlock as the deadlock victim.

- This deadlock victim has its session killed and transactions rolled back.

- Possible Reasons

o The application uses long-running transactions, updating many rows or many tables within one transaction.

o In some situations, SQL Server issues several row locks, which it later decides must be escalated to page or table locks. If these rows exist on the same data pages, and two sessions are both trying to escalate the lock granularity on the same page, a deadlock can occur.

Identify Blocking-

- In Query Analyzer, run sp_who. This will produce below.

- Look at the Blk column. When a number exists in this column, this identifies the SPID that is blocking that current row's process. You could have a chain of blocking (numerous blocked or blocking processes), so you may need to run through this process many times

- Run sp_lock, including the SPID that is blocking other processes.

- From the results, you should track the type of locks, lock mode, and objects impacted. The options for status are GRANT (lock was obtained), WAIT (blocking is occurring), or CNVT (lock is converting to another lock).

- To see the object name from the ObjId integer, execute below.

SELECT OBJECT_NAME (integer)

This returns below.

- Now that you know which statement is blocking the resources, and which resources are being blocked, it is time to take a look at the statement issuing the block, by running below.

DBCC INPUTBUFFER (SPID):

- If possible, ask your client or application contact to stop the transaction blocking the resources. In either case, if you cannot stop the process in an elegant way, you can run the KILL process to stop the blocking:

KILL 53

SET DEADLOCK_PRIORITY

- You can increase the likelihood of a session being chosen as a deadlock victim by using the SET DEADLOCK_PRIORITY statement.

- LOW identifies the session to be the preferred deadlock victim.

- NORMAL returns the session to the default deadlock-handling method.

- @deadlock_var has the character value 3 for LOW and 6 for NORMAL

SET DEADLOCK_PRIORITY { LOW | NORMAL | @deadlock_var }

e.g

SET DEADLOCK_PRIORITY LOW

GO

Update MyTable Set …..

Capture Deadlock Activity using SQL Profiler

Thanks & Regards,

Arun Manglick || Senior Tech Lead