Windows 7: Search for folders by name

Problem:
You search for a folder by name and get all files and folders with that term anywhere in the path. What you really want is a list of folders that you can blow away in one shot, such as hidden ".svn" folders...

Solution:
kind:folder foldername:.svn

StringTemplate 4 .NET C# - Getting Started

Here's the basic idea for rendering a template in C#. String Template has weak .NET/C# documentation from what I can tell.

Resources
Visual Studio Project References
  • Antlr3.Runtime.dll
  • Antlr4.StringTemplate.dll
C# Code
Returns template output.
using System;
using System.IO;
using Antlr4.StringTemplate;

public namespace YourNamespace
{
 public class Tester
 {
  public string HelloWorld()
  {
   Template template;

   var path = @"C:\templates\template.st";
   var file = new FileInfo(path);
   using (StreamReader reader = file.OpenText())
    template = new Template(reader.ReadToEnd(), '$', '$'); // custom delimeter (defaults are "<" and ">")

   template.Add("string", "Hello World!");
   template.Add("array", new string[] { "Record A", "Record B", "Record C" });
   template.Add("object", new { PropertyA = "A", PropertyB = "B" });

   return template.Render();
  }
 }
}
Template File
$! file: C:\templates\template.st !$
String: 
 $string$

Array:
 $array:{it|$it$ ($i$)};separator=", "$

Object:
 Property A = $object.PropertyA$
 Property B = $object.PropertyB$

Gotchas
Upgrading from 3.2 to 4 today has been an unpleasant experience.
  • Curly braces need to be escaped with a backslash within loops, I don't remember having to do this before.
    $items:{item|
    \t{ ... item.property ... \}
    }$
    
  • Speaking of loops, the "it" alias no longer works. You have to alias them every time now.
    Good:
    $items:{it| $it.property$ }$
    Bad:
    $items:{ $it.property$ }$
  • This was likely invalid before but you can't put your $ variables in if statements anymore.
    Good:
     $if(mybool)$ ... $endif$
    Bad:
     $if($mybool$)$ ... $endif$

IIS: A connection was successfully established with the server, but then an error occurred during the pre-login handshake

Problem:
Server Error in '/' Application.


A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The client and server cannot communicate, because they do not possess a common algorithm.)

Solution:
Make sure your web.config has Persist Security Info=True. I don't know or care what the implications are if it's set this way so don't judge. I'm a developer, I just want things to work.