Skip to content

Instantly share code, notes, and snippets.

View wadewegner's full-sized avatar

Wade Wegner wadewegner

View GitHub Profile
@wadewegner
wadewegner / gist:3849535
Created October 7, 2012 20:43
This is a short test that will ensure that controller dependencies are bound appropriately for Ninject. For this to work, you either have to make the bootstrapper public or mark it internal and add the InternalsVisibleTo attribute to the assembly.
[Test]
public void ensure_controller_dependencies_are_bound()
{
var assemblyName = "MvcApplication4";
var assembly = Assembly.Load(assemblyName);
var parameters = (from type in assembly.GetTypes().Where(
t => t.IsAbstract == false && typeof (Controller).IsAssignableFrom(t))
from constructor in type.GetConstructors()
from parameter in constructor.GetParameters()
Service cannot be started. System.IO.FileLoadException: Mixed mode assembly is built against version
'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration
information.
at Microsoft.MediaCenter.Store.ObjectStore.Open(String fileName, String providerName, String password, Assembly callingAssembly, Boolean isCollecting)
at Microsoft.MediaCenter.Store.ObjectStore.Open(String fileName, String providerName, String password, Boolean isAdminRequested)
at Microsoft.MediaCenter.Store.ObjectStore.AddObjectStoreReference()
at Microsoft.MediaCenter.Store.ObjectStore.get_DefaultSingleton()
at Microsoft.MediaCenter.TV.Scheduling.Internal.EventScheduleHandler..ctor(RecordingChangeEventHandler recordingChangeHandler, RequestedProgramChangeEventHandler requestedProgramChangeHandler)
at Microsoft.MediaCenter.TV.Scheduling.EventSchedule..ctor()
at Microsoft.HomeServer.Archive.TransferService.ScheduleMonitor.Start()
[TestMethod]
public void PublicFeedIsNotNull()
{
PublicFeedRootObject result = null;
var mre = new ManualResetEvent(false);
untapped = new UntappdService();
untapped.PublicFeed(publicFeed =>
{
@wadewegner
wadewegner / gist:3404785
Created August 20, 2012 14:40
Create a base 64 encoded sequence of 256 bits
byte[] b = new byte[32];
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
randomNumberGenerator.GetBytes(b);
string result = Convert.ToBase64String(b);
@wadewegner
wadewegner / addselftosqlsysadmin.cmd
Created January 25, 2012 18:35
Script to add the current user to the sysadmin role in SQL Server
@echo off
rem
rem ****************************************************************************
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.
rem This code is licensed under the Microsoft Public License.
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.