Tuesday, December 18, 2007

Script sql muito simples para eliminar todos os registos de um BD

--Não é nada de especial. É só uma nota para não fica esquecido.

USE Database

DECLARE @Table_Name nvarchar(200)
DECLARE Table_Cursor CURSOR FOR
SELECT name
FROM sysobjects
WHERE (xtype = 'U')

OPEN Table_Cursor

FETCH NEXT FROM Table_Cursor
INTO @Table_Name

EXEC ('DELETE FROM ' + @Table_Name )

WHILE @@FETCH_STATUS = 0
BEGIN

FETCH NEXT FROM Table_Cursor
INTO @Table_Name

EXEC ('DELETE FROM ' + @Table_Name )
END

CLOSE Table_Cursor
DEALLOCATE Table_Cursor

Friday, December 07, 2007

C# procurar strings desprezando os acentos. String search with case and accent insensitive

using System;
using System.Collections.Generic;
using System.Globalization;

public class StringHelper
{

public static int IndexOfWithCaseAndAccentInsensitive (string source, string stringToSearch)
{
CompareInfo ci = new CultureInfo("en-US").CompareInfo;
CompareOptions co = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace;
return ci.IndexOf(source, stringToSearch, co);
}

public static void Main()
{
RL();

WL(IndexOfWithCaseAndAccentuationIncensite("zzzzzzzzzzzÁbc", "a"));

RL();
}

#region Helper methods

private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}

private static void RL()
{
Console.ReadLine();
}

private static void Break()
{
System.Diagnostics.Debugger.Break();
}

#endregion
}

Obrigado João, pode vir a ser útil.

Monday, November 19, 2007

How to generate a insert script for your SQL DataBase?

Microsoft SQL Server Database Publishing Wizard 1.1:

http://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en

Very nice tool

You can use this to convert a DataBase from Sql Server 2005 into Sql Server 2000.

Tuning your Sql Server DataBase performance

Tuning your Sql Server DataBase performance:
1. Using Sql Profiler. Using the "Tunning template" record a trace file. Don't forget that if you trace a long period of time you get better tips, but the processing time of such task is not the same (you could always test for yourself).
2. Save the trace file and run it against the Tunning Advisor( included with in the SQL package).
3. Use other tools in order to take numbers about processing time and total # of uses.
4. Apply your modifications and start over until....

You can also make use of a sql stress tool in order to make better use of the Tunning Advisor: http://www.datamanipulation.net/SQLQueryStress/

Thursday, October 25, 2007

Diff DataBases

Just a memo for the good tablediff command.

C:\Program Files\Microsoft SQL Server\90\COM>tablediff -sourceserver "SQL2005" -
sourcedatabase "MyDB1" -sourcetable "ABC" -destinationserver "SQL2005" -destinat
iondatabase "MyDB2" -destinationtable "ABC" -f "c:\Diff"

Quick example can be found at:
http://www.databasejournal.com/features/mssql/article.php/3594926

Tuesday, October 23, 2007

SQL string compare with accent-insensitive

I'm always forgetting the collation name used for this prupose.
How to compare strings without caring about accents:

select *
from t1 inner join t2 on t1.description collate SQL_Latin1_General_Cp850_CI_AI like t2.description collate SQL_Latin1_General_Cp850_CI_AI

Friday, September 21, 2007

Convert WSDL to HTML

I was searching for a good xslt to convert a wsdl to a html, doc, rtf ou pdf.
It's not rocket science but it is hard to find.
http://tomi.vanek.sk/xml/wsdl-viewer.xsl

Cheers

Friday, September 14, 2007

Vs.net 2005 Xml Documentation

Try this link:
http://www.sandcastledocs.com/

Monday, September 03, 2007

How to copy files from GAC

cd C:\WINDOWS\assembly
xcopy GAC c:\tmp\ /E
xcopy GAC_MSIL c:\tmp\ /E
xcopy GAC_32 c:\tmp\ /E



Then explore the c:\tmp\ directory.

Tuesday, August 21, 2007

Programa para facilitar o copy paste

Esta tool possibilita fazer o paste como objecto StringBuilder ;).
http://weblogs.asp.net/Alex_Papadimoulis/archive/2004/05/25/141400.aspx

Muito bom...
Mais uma nota.

Wednesday, July 25, 2007

DotNet Assembly Binding

This tool will help you to trace assembly (ddl) binding problems.

Assembly Binding Log Viewer (Fuslogvw.exe)
Cool ;)

Wednesday, May 09, 2007

Flash Tips

Dica do João, grande tripeiro, que resolvi registar no meu pequeno e triste bloco de notas... para mais tarde recordar...

Remover aquela chatice de ter de activar o flash para depois usar.

Flash activation is going, bye... bye.

http://www.milonic.com/activateflash.php

Friday, April 27, 2007

Configurar o Visual Source Safe sobre Http/Https

Nada de mais...
Instalar o plugin, configurar a base de dados do Source Safe para permitir acesso vi HTTP.
Depois verificar se o web service do VSS está UP AND RUNNING.

Mais detalhes: http://alinconstantin.homeip.net/webdocs/scc/VSS_Internet.htm

Friday, February 16, 2007

Script vbs create users in Active Directory from csv

You can find the original script on http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=204384&start=0.

The script was changed in order to....run and do all the job :)
....
Set oContainer = GetObject(LDAP://OU=Teste,DC=local)
.....
oNewUser.SetInfo
' Change the users password
oNewUser.SetPassword sPassword
oNewUser.Put "pwdLastSet", -1
oNewUser.SetInfo
' Enable the user account
oNewUser.Put "userAccountControl", 512
oNewUser.SetInfo
...
oRecordSet.MoveNext
Loop
oRecordSet.Close
oConnection.Close
' --------- End of user account creation

Tuesday, January 30, 2007

Documentação de Xml Schemas

DocFlex Software.
Existem várias versões, a seguinte é gratuita:
docflex-xml-kit-1.6.5.

O site http://www.filigris.com/

PR