SQL Server AutoClose and Errors

Rummaging through my notes again, I found that if you run into these errors:

  1. “Fatal Error 9001”
  2. “Database is in transition”
  3. The log for database ‘database_name’ is not available.

You might want to check to see if the Auto-Close property on the database was set to “true”.  Setting it to “false” can correct the problem.

ReportViewerWebControl and HTTP 404 Not Found

I was digging through some old notes today and found this tip that might be helpful to someone in the future.  If you’re getting a HTTP 404 Not Found or HTTP Handler related error with the ASP.NET Report Viewer Control, you can try to changing the Application Pool Pipeline Mode from Integrated to Classic to fix the problem.

Capitalizing the First Letter in All Keys of a JSON Object using C#

It took me some time to get this right, drawing from discussions on StackOverflow, but here is code that will capitalize the first letter of every key in a JSON object.

public static JObject Capitalize(JObject obj)
{
  JObject newObj = new JObject();
  foreach (var o in obj)
    {
      string key = o.Key;
      string newKey = char.ToUpper(key[0]) + key.Substring(1);
      JToken value = o.Value;
      if (value.HasValues)
      {
        try
        {
          JObject child = JObject.Parse(value.ToString());
          JObject newValue = Capitalize(child);
          value = newValue;
        }
        catch (Exception)
        {
        }
      }
      newObj[newKey] = value;
    }
  return newObj;
}