Tuesday, May 31, 2011

could not download the silver light application

For me the issue was first due to the reason that mime type for .xap was not registered and secondly
it was due to wrong .xap file path in the .aspx page
Visual studio was creating it under ClientBin\Release\**.xap folder while it was mentioned as ClientBin\**.xap in aspx file .

Monday, May 30, 2011

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.


found this error while deploying an application to 2k8 web server and resolved it by adding the following section in my application's web.config file .










It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS

Some times we get this error when we have two more than one configuration files either at the root level or  in any sub directory of the application.

Thursday, May 26, 2011

Skype Crashes

If your skype is crashed , you can simple put it to work by

Deleting Shared.xml file from your documents and settings folder

C:\Documents and Settings\%username%\Application Data\Skype\shared.xml

Wednesday, May 18, 2011

potentially dangerous request.form value was detected from the client

Some times when we try to post a data  to asp.net forms in the form of some script or xml Asp.net blocks that request do not forward it
if we are developing our own project or its a .aspx page then we can simply avoid it by using ValidateRequest=false in page directive
but if had not developed anything and are just deploying that on our server
so for that we can use ValidateRequest =false in our web.config file also
like
'<'pages validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/'>'
but some times this also do not work for ur
because validationmode property is not  set to correct values especially in the case when we have multiple dot net frameworks running appliations on IIS
so we can use  validation mode to avoid this error
like


'<' httpRuntime requestValidationMode="2.0"/  '>'
under the System.web node.




Tuesday, May 17, 2011

On Which Port Sql Server Is listening on

though SQL server's default instance listen on port 1433
but some how if we want to check or know on which port an instance is running we can use

select local_tcp_port from sys.dm_exec_connections where local_tcp_port is not null
command to know the port number

we can also check it by using the Error log information
Managment Studio -> Managment ->SQL Server Logs->Current
and then looking for the Entry
Sql server is listening on 127.0.0.1 ipv4 1434

or we can use the following procedure (even the registery enteries)

DECLARE @tcp_port nvarchar(5)
EXEC xp_regread


@rootkey = 'HKEY_LOCAL_MACHINE',

@key = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP',

@value_name = 'TcpPort',

@value = @tcp_port OUTPUT

SELECT @tcp_port


if any of the above does not work then make sure
TCP\IP protocol is enabled , if it is disabled the enable it first
 

Monday, May 9, 2011

Transpose Columns to Rows in Sql Server 2005 using UNPIVOT

In Sql Server 2000, it was very hard converting column based values to transpose into row based values and vice versa.


PIVOT and UNPIVOT did the trick in Sql server 2005.



Below is the sample that transpose values from column to rows in sql server using UNPIVOT relational operator.



Sample input table





view plaincopy to clipboardprint?

01.create table #temptable(rowid int,colorname varchar(25),Hexa varchar(7)

02.,R tinyint,G tinyint,B tinyint)

03.GO

04.insert into #temptable values(1,'Violet','#8B00FF',139,0,255);

05.insert into #temptable values(2,'Indigo','#4B0082',75,0,130);

06.insert into #temptable values(3,'Blue','#0000FF',0,0,255);

07.insert into #temptable values(4,'Green','#00FF00',0,255,0);

08.insert into #temptable values(5,'Yellow','#FFFF00',255,255,0);

09.insert into #temptable values(6,'Orange','#FFA500',255,165,0);

10.insert into #temptable values(7,'Red','#FF0000',255,0,0);

11.GO

12.select * from #temptable

13.GO

create table #temptable(rowid int,colorname varchar(25),Hexa varchar(7)

,R tinyint,G tinyint,B tinyint)

GO

insert into #temptable values(1,'Violet','#8B00FF',139,0,255);

insert into #temptable values(2,'Indigo','#4B0082',75,0,130);

insert into #temptable values(3,'Blue','#0000FF',0,0,255);

insert into #temptable values(4,'Green','#00FF00',0,255,0);

insert into #temptable values(5,'Yellow','#FFFF00',255,255,0);

insert into #temptable values(6,'Orange','#FFA500',255,165,0);

insert into #temptable values(7,'Red','#FF0000',255,0,0);

GO

select * from #temptable

GO



The sample table contains colorname with "R","G" & "B" column with specific values.



Our goal is to convert "R","G" & "B" as rows with specific values in single column.



Main requirement of transposing columns to rows is to have identical datatypes of converting columns.

In the sample the datatype of "R", "G" & "B" being tinyint.





The T-SQL query to convert columns to rows is




01.SELECT rowid,colorname,hexa,rgb,rgbvalue

02. FROM

03. (SELECT rowid,colorname,hexa,r,g,b

04. FROM #temptable) p

05. UNPIVOT

06. (rgbvalue FOR rgb IN (r,g,b))

07. AS unpvt;

SELECT rowid,colorname,hexa,rgb,rgbvalue

FROM

(SELECT rowid,colorname,hexa,r,g,b

FROM #temptable) p

UNPIVOT

(rgbvalue FOR rgb IN (r,g,b))

AS unpvt;

The output would be







In the above sample "rowid,colorname,hexa" columns remains unchanged. "R", "G" & "B" columns are converted to rows with new column "rgb" and its specific values are added to new column "rgbvalue".



syntax for understanding:




01.select [<>],<>,<>

02.from

03.(

04. select [<>],<> from <>

05.) <>

06.UNPIVOT

07.(

08. <> FOR

09. <> IN (<>)

10.)

11.AS <>