Wednesday, June 13, 2012

showModalDialog not returning value after a postback in Chrome

There is a bug in the Chrome browser engine, which is showModalDialog fails to return window.returnValue after childpage do any postback. This issue has been there for long time and status of the this issue is still available. More information on this issue can be found here.

For a solution for this issue update panels can be used to avoid unnecessary postbacks but this solution is not extendable for all the scenarios. The best solution posted in the stackoverflow can be found here.  What has done in this solution is, it uses the window.operner return value to get the return value in the Chrome. After postbacks also window.opener property in the modal dialog points to the caller window, so the result can be directly set to the returnValue property of the caller window(parent window).

Monday, May 7, 2012

Disable auto run in Windows XP Home Edition

Have you every try to disable autorun in Windows XP Home edition, If you use a common way using Gpedit.msc you will end up like this.

Have you ever seen this message and stuck with this. Windows home edition does not contain this option, So Gpedit.msc cant be used for disabling auto run in XP Home Edition. You have to do it in the registry editor. 

Back to hardware mode... :)

Here are the steps you have to follow.... (Note: please backup the registry before you proceed)
  1. type regedit and go to - HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer   

                                     
  2. Locate the DWORD value with the name "NoDriveTypeAutoRun", if this value is not there you have to create a new one with the exact same name. To do that right click on the pane -> new -> DWORD value.
  3. Change the value data to - 0x000000b1 (177)
                         

Tuesday, May 1, 2012

Collation conflict in T-SQL

Have you ever encounter a problem when working in T-SQL like, "Cannot resolve the collation conflict between "XX_90_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the UNION operation." The reason for this error message is collation conflict has been occurred while SQL server trying to compare two columns or expressions which have different collations. This error cause most of the time when compare columns with a temporary table column, because other table columns are in the database default collation settings and temporary tables may not in the default collation. 

As I experienced to overcome this problem we can simply apply collation setting for the tempary table column with default collation settings as follows

Colname COLLATE DATABASE_DEFAULT from #temp

 

Tuesday, March 27, 2012

Operation is not valid due to the current state of the object.

Some times when using .NET web applications you have came a cross yellow pages with the stack trace some thing like bellow. 

System.InvalidOperationExceptionOperation is not valid due to the current state of the object.
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()

Reason for this exception is a recent update which has been done to the .NET framework.  In the Microsoft security update MS11-100, they limit the maximum number of form keys to 1000 in a HTTP request. Because of this update ASP.NET applications rejects the requests which have more than 1000 of form keys. So the error message will be displayed in the browser, with HTTP 500 status code.

This change was made to address mainly the Denial of Service vulnerability. 

This new limit can be override on a per application basic by putting a new "appSettings" in an ASP.NET application’s configuration file. 

Thursday, March 22, 2012

Remove New Line charactors from data in SQL

Some times we need to avoid newline characters and other characters such as tab from the data we retrieve from the SQL server. There is a easy way to do this, we just need to replace those characters with a space or what ever we need as follows.

declare @newLine char(2)
set @newLine = char(13) + char(10)

which is in SQL :
char(9) -  Tab
char(10) - Line feed
char(13)  - Carriage return

then we can directly replace these characters when ever we need.

e.g :-
select
replace(theDataBaseField,@newLine,' ' ) 
from.....

as above we can get data without any newline characters.

Saturday, January 8, 2011

Start Tomcat 6.X in Debug Mode in Windows

To start tomcat in debug mode first there are two system environment variables to set

  • variable name : JPDA_TRANSPORT, variable   value = dt_socket
  • variable name :  JPDA_ADDRESS, variable  value = 8000 (any free port)


Then open command prompt with administrator privileges and change the dilatory to Tomcat bin folder. Then start tomcat using "catalina.bat jpda start command". Now tomcat will start in debug mode. You have to use port which we set on JPDA_ADDRESS in the IDE you use for debugging. For example in eclipse 

Acrobat 9 Pro not accepting EULA

I have installed acrobat pro 9 on windows 7 and I have used it for a while. Suddenly the an End User License Agreement comes up and I was not able to accept, reject or cancel it, the an End User License Agreement comes up was there at the top and I couldn't use Acrobat reader.

 Nothing happens when click on any button.

I tried many thing to fix this issue. even I edit the registry also. But nothing helped.

As I mentioned in my previous post after resetting the Internet Explore setting this problem also solved. Now I can use acrobat reader without any problem.