Tuesday, May 24, 2011

How to Disable / Remove Annoying Shutdown Event Tracker (Shutdown Reason UI) in Windows Server 2003 / 2008?

If you are using Windows Server 2003 or 2008, you might have noticed that whenever you click on Shutdown button, it shows a dialog box asking you the reason behind shutting down the system. You have to select an option from drop-down box or write into Comment box to be able to shutdown the system.


Many people find it very annoying and want to disable it but they don't know how to disable it.

Today in this tutorial, we'll tell you a simple way to completely remove this annoying dialog box:

METHOD 1: Using Group Policy Editor

1. Type gpedit.msc in RUN dialog box and press Enter.

2. It'll open Group Policy Editor. Now go to:

Computer Configuration -> Administrative Templates -> System

3. In right-side pane, look for "Display Shutdown Event Tracker" option.


4. Now double-click on "Display Shutdown Event Tracker" and select "Disabled". Apply it and the annoying dialog box will never appear again.

NOTE: You can also use this method to enable Shutdown Event Tracker in Windows client OS like Windows XP, Vista, 7, etc. Just set the option value to "Enabled".

METHOD 2: Using Registry Editor

If you face problems while using Group Policy Editor, you can also use Registry Editor to do the same task.

1. Type regedit in RUN dialog box and press Enter.

2. It'll open Registry Editor. Now go to:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT

3. Under "Windows NT" key, look for a key "Reliability". If its not present, create it.

4. Now select "Reliability" key and in right-side pane, look for following 2 DWORD values:

ShutdownReasonOn
ShutdownReasonUI

If the DWORD values are not present, create them.

5. Now set values of both DWORD to 0


6. That's it. Now you'll not see the reason dialog box while shutting down the system.



NOTE: You can also use this method to enable Shutdown Event Tracker in Windows client OS like Windows XP, Vista, 7, etc. Just set the values of both DWORD to 1 using Step 5.

Monday, May 16, 2011

Enter key is not working in Firefox Resolved

This problem is due to AVG Safe Search Extension for Firefox.

Step:1 Go to Firefox’s
Step:2 Tools–>Add-Ons–>Select Extensions then disable AVG Safe Search extension.

After this restart your firefox browser.

Saturday, May 14, 2011

Just In Time(JIT) Debugger Error Resolved


I found this actually resolved my issue with JIT:


1. Click Start


2. Click Run


3. Type cmd (and click ok)


4. Type drwtsn32 -i (and press enter)

Wednesday, May 11, 2011

Configure XAMPP Apache and IIS to Run Together on Windows XP or Windows Vista

The task is now simplified by 2 steps below

1. Change Apache port
Open C:\xampp\apache\conf\httpd.conf
Replace “Listen 80″ with “Listen 81″
Replace “ServerName localhost:80″ with “ServerName localhost:81″

2. Change SSL port
Open C:\xampp\apache\conf\extra\httpd-ssl.conf
Replace “Listen 443″ with “Listen 4430″
Replace “VirtualHost _default_:443” with “VirtualHost _default_:4430”
Replace “ServerName localhost:443″ with “ServerName localhost:4430″


That's all. Easy isn't it?

Tuesday, May 10, 2011

Fill Drop Down List Box using data table.

Using C#

string qry = "Select * from table";
con.Open();
DataTable dt = new DataTable();
dt.Columns.Add("field1");
dt.Columns.Add("field2");
SqlCommand cmd = new SqlCommand(qry, con);
SqlDataReader dr = cmd.ExecuteReader();
if ((dr.HasRows))
{
    while (dr.Read)
    {       
        DataRow drr = null;
        drr = dt.NewRow();
        drr["field1"] = dr("field1").ToString;
        drr["field2"] = dr("field2").ToString;
        dt.Rows.Add(drr);       
    }
}
con.Close();
ddl_Temp.DataSource = dt;
ddl_Temp.DataValueField = "field1";
ddl_Temp.DataTextField = "field2";
ddl_Temp.DataBind();


Using VB. Net

Dim qry As String = "Select * from table"
con.Open()
Dim dt As New DataTable()
dt.Columns.Add("field1")
dt.Columns.Add("field2")
Dim cmd As New SqlCommand(qry, con)
Dim dr As SqlDataReader = cmd.ExecuteReader()
If (dr.HasRows) Then
 While dr.Read
  Dim drr As DataRow = Nothing
  drr = dt.NewRow()
  drr("field1") = dr("field1").ToString
  drr("field2") = dr("field2").ToString
  dt.Rows.Add(drr)
 End While
End If
con.Close()
ddl_Temp.DataSource = dt
ddl_Temp.DataValueField = "field1"
ddl_Temp.DataTextField = "field2"
ddl_Temp.DataBind()

Monday, May 9, 2011

Query to find nth max value of a column

Consider the following Employee table with a single column for salary.
                          +------+
                          | Sal  |
                          +------+
                          | 3500 | 
                          | 2500 | 
                          | 2500 | 
                          | 5500 |
                          | 7500 |
                          +------+
The following query will return the Nth Maximum element.
select SAL from EMPLOYEE E1 where 
 (N - 1) = (select count(distinct(SAL)) 
            from EMPLOYEE E2 
            where E2.SAL > E1.SAL )
For eg. when the second maximum value is required,
  select SAL from EMPLOYEE E1 where 
     (2 - 1) = (select count(distinct(SAL)) 
                from EMPLOYEE E2 
                where E2.SAL > E1.SAL )
 
                    +------+
                    | Sal  |
                    +------+
                    | 5500 |
                    +------+
 
The following query will return the Nth Minimum element.
select SAL from EMPLOYEE E1 where
 
(N - 1) = (select count(distinct(SAL))
           
from EMPLOYEE E2
           
where E2.SAL < E1.SAL )
For eg. when the second Minimum value is required,
  select SAL from EMPLOYEE E1 where
     
(2 - 1) = (select count(distinct(SAL))
               
from EMPLOYEE E2
               
where E2.SAL < E1.SAL )

 
                    +------+
                    | Sal  |
                    +------+
                    | 3500 |
                    +------+
 
 
Second Way:---


DECLARE @SalaryPosition INT
SET @SalaryPosition = 2
SELECT *
FROM Employee E1
WHERE @SalaryPosition =  
          (
            SELECT COUNT(DISTINCT E2.Salary) 
            FROM Employee E2
            WHERE E2.Salary >= E1.Salary
          ) 
 
 
SELECT TOP 1 salary

FROM (

SELECT DISTINCT TOP 6 salary

FROM employee

ORDER BY salary DESC) a

ORDER BY salary

You can change and use it for getting  nth highest salary from Employee table as follows

SELECT TOP 1 salary

FROM (

SELECT DISTINCT TOP n salary

FROM employee

ORDER BY salary DESC) a

ORDER BY salary

where n > 1 (n  is always greater than one) 

Thursday, May 5, 2011

Fixing the localhost authentication problem in FireFox

For some time I had a strange problem; I could load sites from http://localhost in MSIE, but whenever I tried FireFox, it asked me for an user name and password. I've tried it all but I couldn't authenticate.
If you happen to have the same problem, here's a quick and simple workaround:

  1. In Firefox type about:config in the addressbar
  2. It will show you a warning message ignore it and click on the button.
  3. Find the preference named network.automatic-ntlm-auth.trusted-uris
  4. Doubleclick and type localhost
  5. Enter and you're done

Wednesday, May 4, 2011

How to Remove Startup Entries from MSConfig

Do you have obsolete startup entries that flood your MSConfig list? Did you know you can remove them through your registry? Here is how, 9 steps to remove unused entries…
MSConfig
Note: This is for Windows XP only.
  1. Open your msconfig (you type “msconfig” in your Run from your start menu)
  2. Switch to “Startup or services tab”
  3. Uncheck the services or startup programs to stop it from running on windows startup
  4. Open your registry editor (you type “regedit” in your Run from your start menu)
  5. Select “My Computer”under the list in Registry Editor
  6. Select Edit > Find (or Ctrl+F)
    MSConfig2
  7. Check on “Keys” while unchecking everything else, and hit Enter to search for “msconfig
    MSConfig3
  8. When done searching, it will bring you to this directory in the Registry Editor (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig)
    MSConfig4

    Note: Only unchecked entries will appear in startupfolder/startupreg/services.
  9. Delete those folders under startupfolder/startupreg, or services.
  10. You are done!
    MSConfig5

    Note: Unchecked entries were deleted.