Wednesday, March 14, 2012

SVN Upgrade Project Error ("Insufficient NODES rows for...)

In the last upgrade of our SVN from 1.6 to 1.7 I got the following error trying to upgrade the source folders on my machine using the VisualSVN "Upgrade Working Copy" menu command:

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

TortoiseSVN
---------------------------
Insufficient NODES rows for 'C:\[YOUR SOURCE PATH HERE]'
Try a 'Cleanup'. If that doesn't work you need to do a fresh checkout.
---------------------------
OK
---------------------------

to resolve the issue, search your source folder for files named [dir-prop-revert] they will be very small, and only contain a single line with the word "END" in it.
Delete these files and try the menu command again. it should do the trick.
 
*** make sure your search criteria includes hidden files ***

Thursday, January 12, 2012

Elegant solution for splitting a Comma Delimited string in SQL

came across this elegant simple solution for splitting a Comma Delimited string in SQL.
This will only work with SQL 2005 and up but it's so simple and elegant i had to share it.


There can be different types of Delimiters also : like Comma ' , ', vertical bar ' | ', Single space or a Tab.
For example here is our Sample Table -

Id

AllNames

1

A,B,C

2

A,B

3

X,Y,Z

And here is the expected output -

Id

Names

1

A

1

B

1

C

2

A

2

B

3

X

3

Y

3

Z
Create Sample Data :

-- Create Table for  Sample Data 

CREATE TABLE Test 

( 

ID INT, 

AllNames VARCHAR(100) 

) 

GO 

-- Load Sample Data 

INSERT INTO test SELECT 

1, 'A,B,C' UNION
ALL SELECT
 

2, 'A,B'  UNION
ALL SELECT
 

3, 'X,Y,Z' 

GO

-- Verify the Sample Data 

SELECT Id,
AllNames 

FROM Test
And here is the query for How to split a comma
delimited string :

;WITH Cte AS
( 

    SELECT 

        id, 

        CAST('<M>'
+ REPLACE(
Allnames,  ',' , '</M><M>') + '</M>' AS XML) AS Names 

    FROM Test 

) 

SELECT 

    ID, 

    Split.a.value('.', 'VARCHAR(100)') AS Names 

FROM Cte 

CROSS APPLY Names.nodes('/M') Split(a)





---------------------------------------------------------
Acknowledgement : SQL WITH MANGAL  

Sunday, October 2, 2011

Debugging VBS with Visual Studio

If you must use VBS scripts (I can't think of a reason why you would WANT to use them) then there is an easier way to debug these (other than the old school printouts).

from the command prompt run:

cscript.exe test.vbs //X

this will pop up the debugger choice with the list of Visual Studio apps available (2003/05/08/10 etc.) and will allow you to step in and debug line by line.

Apppools on Windows Server 2008

If you need to set a flag on the apppool in server 2008 you can also do that via script. Here is an example of how to set the "Enable 32bit application support" flag to "true" in server 2008 apppool:

cd %windir%\system32\inetsrv\
appcmd set apppool /apppool.name:CPOSBackOfficeWS /enable32BitAppOnWin64:true

Friday, November 12, 2010

Task failed because “sgen.exe” was not found, or the correct Microsoft Windows SDK is not installed.

If you started using Visual Studio 2008 and didn't have a previous version of it then you will get this error trying to compile project that reference a web service. It only happens if you use .NET 2.0 version and compile in Release mode.

it's actually looking for a 2.0 component from the 2.0 SDK that is not being installed with your VS2008.

The solution:
Download and install .NET 2.0 SDK (from the Microsoft website) then copy the sgen.exe file from C:\Program Files\Microsoft.NET\SDK\v2.0 to C:\Windows\Microsoft.NET\Framework\v3.5

Thursday, November 11, 2010

Call stack window missing from VS2008?

I get asked that a lot recently so I thought I'll share it with the world. No Microsoft didn't remove the Call Stack window from Visual Studio 2008. they just moved it to another menu entry.

You can find it under Debug->Windows->Call Stuck

Keep coding...

Monday, September 13, 2010

Migrating databases from SQL 7/2000 to 2005/2008 version

When you migrate a database from a SQL server 7 or 2000 to a SQL server 2005 & Up it's important to check that the database's Auto_Close flag is set to "FALSE" OR "OFF" (binary 0).

In order to find out which databases have it set to "TRUE" or "ON" (Binary 1) run this script:


SET NOCOUNT ON


SELECT [name] AS DatabaseName
, CONVERT(varchar(100),DATABASEPROPERTYEX([Name] , 'Recovery')) AS RecoveryType
, CONVERT(varchar(10),DATABASEPROPERTYEX([Name] , 'IsAutoClose')) AS AutoClose
, CONVERT(varchar(10),DATABASEPROPERTYEX([Name] , 'IsAutoShrink')) AS AutoShrink
FROM master.dbo.sysdatabases
Order By DatabaseName

Then in order to set a flag to "FALSE" / "OFF" run the following script:
ALTER DATABASE [DB_NAME_HERE] SET AUTO_CLOSE OFF WITH NO_WAIT

Here is Microsoft Best practice recommendation:
http://technet.microsoft.com/en-us/library/bb402929.aspx