My online notes – Section 0008

Note 1: Remove diacritics (special characters) from string

private static string RemoveDiacritics(string text)
{
	string textNormalized = text.Normalize(NormalizationForm.FormD);
	StringBuilder stringBuilder = new StringBuilder();

	for (int index = 0; index < textNormalized.Length; index++)
	{
		UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(textNormalized[index]);
		if (uc != UnicodeCategory.NonSpacingMark)
		{
			stringBuilder.Append(textNormalized[index]);
		}
	}

	return (stringBuilder.ToString().Normalize(NormalizationForm.FormC));
}

Note 2: Filter nodes from TreeView with lambda expression

public static IEnumerable<TreeNode> FlattenTree (this TreeNodeCollection coll, Func<TreeNode, bool> filter = null)
 {
     if (filter != null)
     {
         return coll.Cast<TreeNode> ().Where(filter)
                     .Concat (coll.Cast<TreeNode> ()
                                 .SelectMany (x => FlattenTree (x.Nodes, filter)));
     }
     else
     {
         return coll.Cast<TreeNode> ()
                     .Concat (coll.Cast<TreeNode> ()
                                 .SelectMany (x => FlattenTree (x.Nodes)));
     }
 }

IEnumerable<TreeNode> flattenTree = myTreeView1.Nodes.FlattenTree (n => n.Nodes.Count == 0);

Note 3: Website for testing jquery/javascript
http://jsfiddle.net/

Note 4: Start VirtualBox image on boot of Windows 8.1
Create a .bat file in folder %appdata%\Microsoft\Windows\Start Menu\Programs\Startup with content

cd "C:\Program Files\Oracle\VirtualBox"
vboxmanage startvm "jede-menge-tipps"

Note 4: Camera monitoring (Überwachung)
http://www.ispyconnect.com/
http://www.aforgenet.com/
http://accord-framework.net/

Leave a Reply

Your email address will not be published. Required fields are marked *