Friday, November 17, 2017

How to use the Parameters filter "controls" in Microsoft SQL Server Report Builder's SSRS reports.

Basically, these are going to fill the place the declared variables with leading @ symbols in your T-SQL query. Just write queries that have dummy values for these at the top of the script and then when it is time to copy and paste your script into Microsoft SQL Server Report Builder just leave off the top of the script where the variables are declared and set.

setting dates in T-SQL from magic strings

The dates here represent wide adoption of Gregorian calendar in Sweden and the comet Swift–Tuttle passing close to Earth:

SET @StartDate = (CASE WHEN @StartDate is null THEN '1753-01-01' ELSE
      @StartDate END)
SET @EndDate = (CASE WHEN @EndDate is null THEN '2126-08-05' ELSE
      @EndDate END)


'1753-01-01 00:00:00.000' is the long form.

Make some controls for a report in Microsoft SQL Server Report Builder.

At the "Report Data" pane in Report Builder where "folders" are titled Built-in Fields, Parameters, Images, Data Sources, and Datasets, the Parameters folder will hold controls. Right-click here and pick "Add Parameter..." to make your own control for filtering.

Thursday, November 16, 2017

How do I cast an IHttpActionResult from a controller to something sane in C#?

IHttpActionResult actionResult = await myController.Whatever();
var result = actionResult as OkNegotiatedContentResult<string>;

loop through the properties on a JSON object in JavaScript

I stole this from here. I can't find my previous blog post on this topic.

var obj = {
   name: "Simon",
   age: "20",
   clothing: {
      style: "simple",
      hipster: false
for(var propt in obj){
   alert(propt + ': ' + obj[propt]);

A struct is going to be mutable not immutable in C#.

This has a way around that. Basically you take in all parameters as settings at the constructor and then make the getsetters only expose getting. Simple types you don't make yourself like int and DateTime are immutable value types even if the structs you roll yourself are not.

Tuesday, November 14, 2017

blanket turn off push notifications in Google Chrome?

Per this:

  1. In Google Chrome, click on that button that looks like three dots in a vertical line at the upper right.
  2. Scroll down to: "Advanced"
  3. Expand: "Advanced"
  4. In the "Privacy and security" subsection click on "Content settings" line item
  5. Click on: "Notifications"
  6. Turn off "Ask before sending (recommended)" so that setting just says: "Blocked"