Zum PortalStatistikMeine LinksMein PhotostreamMein Xing ProfilMein FaceBookMeine Galerie
 
AboutEquipmentWeblogSit Back & Joy » Snippets
Weblog
 

Visual Studio 2003, Subversion and Web-Projects

Today I ran into an error using VS2003 ASP.NET Projects and SVN for version control. The error I got when I opened a SVN-controlled web-project was “Refreshing the project failed. Unable to retrieve folder information from the server.” This error occurs, because Visual Studio 2003 cannot handle folder names starting with a period (“.”). So the most pragmatic way to get is working is to write two batch files to rename all “.svn” folders before opening the project and rename them back when synchronizing with the SVN-repository:

hide-svn.cmd
@ECHO OFF
FOR /R %%f IN (.svn) DO IF EXIST "%%f" (
ATTRIB -h "%%f"
RENAME "%%f" _svn
)

restore-svn.cmd
@ECHO OFF
FOR /R %%f IN (_svn) DO IF EXIST "%%f" (
RENAME "%%f" .svn
ATTRIB +h "%%~pf\.svn"
)

Note: this is one solution taken from tigris.org.

Before using the two batch files it may be necessary to clean the VSWebCache folder. This folder contains the structure of web projects so Visual Studio can load the projects faster. It is located in the users directory (e.g. C:\Documents and Settings\Username\VSWebCache).

Create an MD5 sum of a string

Codesnippet

Use this little static method to create an MD5 hash from a string instance:

/// <summary>

/// Create an md5 sum string of this string

/// </summary>

/// <param name=”str”>the input string</param>

/// <returns>the md5 hash of the input string</returns>

static private string GetMd5Sum(string str)

{

// First we need to convert the string into bytes, which

// means using a text encoder.

Encoder enc = System.Text.Encoding.Unicode.GetEncoder();

 

// Create a buffer large enough to hold the string

byte[] unicodeText = new byte[str.Length * 2];

enc.GetBytes(str.ToCharArray(), 0, str.Length, unicodeText, 0, true);

 

// Now that we have a byte array we can ask the CSP to hash it

MD5 md5 = new MD5CryptoServiceProvider();

byte[] result = md5.ComputeHash(unicodeText);

 

// Build the final string by converting each byte

// into hex and appending it to a StringBuilder

StringBuilder sb = new StringBuilder();

for (int i=0;i<result.Length;i++)

{

sb.Append(result[i].ToString(“X2″));

}

 

// And return it

return sb.ToString();

}

Recursive file search

CodesnippetFind all files of a given pattern, loop through the results and print out the name of each file:

dir *.doc -recurse | foreach-object -process { echo $_.Name; }

Loop through argument list of a script

CodesnippetAccess to command line arguments of Powershell scripts is very easy. Thanks to the new foreach statement looping through arguments is very easy too. Create a script with the following code:

myscript.ps1:
foreach ($argument in $args) {
echo $argument
}

Invoke the script with some random arguments:

PS >> c:\scripts\myscript.ps1 hello world this is a test

The output looks like:

hello
world
this
is
a
test

Simple if-statement

CodesnippetIf-statements are just like in many languages (like C#). Note that the comparison operators are different:

if ($args[0] -eq "foo") {
echo "Argument 0 is foo..."
} else {
echo "Argument 0 is not foo..."
}

 

Suche im Blog

Letzte Kommentare

Achim (Strobist-Studio: Blitzsystem)
Hi. Also bei einem Cactus-System ist das ja egal. Da hast Du den Funksender auf der Kamera und für jeden Blitz einen Empfänger. Da kannst Du dann auch Typen mischen, weil die Blitze ja nicht mit ...
Claudia (Strobist-Studio: Blitzsystem)
Wie sieht das denn aus, wenn ich einen Nikon SB-900 hab. Kann ich den als Master für so alte Blitze wie SB-20 verwenden? Lg, Claudia
Rene (Mein Low-Budget Strobist Studio)
Also ich denke die Größe kommt immer auf den Einsatzzweck an. Ich selber habe noch ein kleineres Studio eingerichtet, da ich allerdings hauptsächlich Produkt- und Portraitaufbahmen mache, ist di...
Achim (Strobist-Studio: Blitzsystem)
Hallo Torsten, genau so ist es. Entscheidender Unterschied: die Blitze sind komplett manuell zu steuern (also i.d.R. Reflektoreinstellung und Blitzleistung). Über die Funkauslöser wird nur das A...
Torsten (Strobist-Studio: Blitzsystem)
Hallo, sehe ich das jetzt richtig, das der Funkauslöser Cactus Wireless Trigger V2s an stelle eines Blitzes auf die Kamera gesteckt wird und somit jede Kamera mit Blitzaufsatz nun mehrer Blitze tr...

Archiv

Jahr 2011 (4)
Jahr 2010 (13)
Jahr 2009 (29)
Jahr 2008 (70)
Jahr 2007 (42)
 
 
 
© 1999-2010 by speedesign.de - Alle Rechte vorbehalten
powered by Wordpress und dem SitBackAndJoy-Theme v1.5
Theme Icons (Diagona Iconset) by pinvoke.com

Entwickelt mit Eclipse auf einem Mac
Danke an Nicole für die ehrliche und schonungslose Kritik.