First, make sure you have the xslt.xsd file in the C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas folder. If not, copy it from VS2005.
Next, add a new string value to the registry named 'XsltIntellisense' under 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\XmlEditor' and set the value to 'True'. This will enable some other nice features to the standard tag completion stuff.
Registry info from the Signs on the Sand blog.
Saturday, 29 November 2008
Friday, 28 November 2008
XmlSerializer - invalid characters
Using the XmlSerializer class, I got the following error:
Use at your own risk!
'', hexadecimal value 0x0F, is an invalid character.
This was down to some dodgy legacy database data that contained ascii control characters (0 - 31). I wrote this SQL script to remove all ascii chars 0 - 31 from all character columns in a table:I used this T-SQL Beautifier to make the SQL look nice
Use at your own risk!
DECLARE @table varchar(50)
SET @table = 'MyTable'
SET NOCOUNT ON
DECLARE @column varchar(50)
DECLARE column_cursor CURSOR FOR
SELECT column_name
FROM information_schema.columns
WHERE table_name = @table
AND data_type LIKE '%char'
OPEN column_cursor
FETCH NEXT FROM column_cursor INTO @column
WHILE @@FETCH_STATUS = 0 BEGIN
DECLARE @charCode int
SET @charCode = 0
WHILE @charCode < 32 BEGIN
DECLARE @sql varchar(max)
SET @sql = 'UPDATE ' + @table + ' SET ' + @column +
' = REPLACE(' + @column + ', char(' + CAST(@charCode AS varchar) + '), '''')' +
' WHERE ' + @column + ' LIKE ''%'' + char(' + CAST(@charCode AS varchar) + ') + ''%'''
--PRINT @sql
DECLARE @rowcount int
EXEC(@sql)
SET @rowcount = @@rowcount
IF @rowcount > 0
PRINT 'char ' + CAST(@charCode AS varchar) + ' replaced ' +
CAST(@rowcount AS varchar) + ' times in column ' + @column
SET @charCode = @charCode + 1
END
FETCH NEXT FROM column_cursor INTO @column
END
CLOSE column_cursor
DEALLOCATE column_cursor
SET NOCOUNT OFF
Thursday, 27 November 2008
C# Google Maps Polyline encoder
I've started the csharp-polyline-encoder project to encode polylines using C# after reading this post. It is just a direct translation of the Java version of the original polyline encoder.
One thing to watch out for - the main class escapes backslashes in the encoding for when the data is output to javascript. If you are using something like Json.NET to write out the encoded polylines, it will escape the backslashes again causing the line to be plotted incorrectly. I'll take out the escaping code at some point...
One thing to watch out for - the main class escapes backslashes in the encoding for when the data is output to javascript. If you are using something like Json.NET to write out the encoded polylines, it will escape the backslashes again causing the line to be plotted incorrectly. I'll take out the escaping code at some point...
Wednesday, 26 November 2008
Populating Umbraco styles dropdown
Make sure you check the "Related stylesheets" under Developer -> Data Types -> Richtext Editor
Subscribe to:
Posts (Atom)