Archive for Settembre 17th, 2007

Recursive Directory Search

Settembre 17th, 2007

Description: Example of recursively searching a directory and its child directories for a file

Link: http://www.codekeep.net/snippets/c8afe5a0-f23f-45d1-bcf7-7e58e89fac85.aspx

List<string> fileHolder = new List<string>();

void DirSearch(string sDir)
{
        try
	{
	   foreach (string d in Directory.GetDirectories(sDir))
	   {
		foreach (string f in Directory.GetFiles(d, txtFile.Text))
		{
		   fileHolder.Add(f);
		}
		DirSearch(d);
	   }
	}
	catch (System.Exception excpt)
	{
		Console.WriteLine(excpt.Message);
	}
}

Enable Rhino Mocks to mock internal types

Settembre 17th, 2007

Description: Unit tests often are required to mock types defined in other assemblies. If those types are marked as Internal then it will fail to mock them. Enter InternalsVisibleToAttribute …

Link: http://www.codekeep.net/snippets/0b3da5af-819b-4289-88d2-c70cb8d8c6e7.aspx

[assembly :InternalsVisibleTo("Rhino.Mocks")]	// obviously the Rhino Mocks assembly
[assembly :InternalsVisibleTo("DynamicProxyGenAssembly2")]	// Rhino Mocks uses Castle DynamicProxy for the heavy lifting
[assembly :InternalsVisibleTo("<unit test assembly name>")]	// your unit test assembly

XML-Enabled Applications

Settembre 17th, 2007

This week you’ll learn how to use XML in PHP and Oracle when building XML-enabled PHP/Oracle applications. Topics covered include: constructing XML with the PHP DOM extension, navigating XML with XPath, generating XML from relational data with Oracle SQL/XML functions, and more. By Yuli Vasiliev. 0917