Saved for later reference

online repository of stuff I had to google for hours to figure out – and random snippets of code

Microsoft SQL Server Management Studio 2008 R2 error: Value cannot be null. Parameter name: viewInfo

Tags: , , ,

I had a strange error after updating/rebooting a server yesterday: Management Studio popped up with the error above when I tried connecting to a server, and several other messages when trying to run queries.

After some unhelpful hints from other forums, I found the real solution/problem hidden in a post: My TEMP/TMP folder(s) didn’t exist.

For some reason my variables were set to:

1
2
TEMP=C:\Users\[user]\AppData\Local\Temp\1
TMP=C:\Users\[user]\AppData\Local\Temp\1

After the update, this “1″ folder didn’t exist anymore. I could fixed this by editing the environment variables (right click Computer, Properties, Advanced, Environment Variables) and rebooting (since I didn’t know how many applications were using the wrong temporary folders).

Share

Automated uninstall of Java JRE

Tags: , , , , , ,

Recently I had to uninstall Java from a computer that had 5 different versions installed, and after some searching, and more time spent trying and failing than it strictly would take to manually uninstall each version, I ended up with the following .cmd file:

1
2
3
4
5
6
7
@echo off
echo Uninstalling old Java 6
wmic product where "name like 'Java(TM) 6%%'" call uninstall /nointeractive
echo Uninstalling old Java 7
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
echo Uninstalling old JavaFX
wmic product where "name like 'JavaFX %%'" call uninstall /nointeractive

It should be fairly obvious what these lines do, and how to extend it to uninstall other products, I think!

Bonus command line to silently install JRE without ASK toolbar:

1
jre-7u13-windows-x64.exe /s
Share

FizzBuzz with Reactive Extensions

TAGS: None

I played around with – and tried to do the “classic” FizzBuzz programming test in an obnoxious way.

Here’s what I’ve got so far, but I think it’s possible to make it more convoluted than this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reactive.Linq;

namespace FizzBuzz
{
    public delegate void NumberEventHandler(object sender, long e);

    class Program
    {
        public static event NumberEventHandler AnyNum;

        static void Main(string[] args)
        {
            var numbergenerator = Observable.Interval(TimeSpan.FromMilliseconds(1));
            var numbers = from n in numbergenerator where n > 0 && n <= 100 select n;

            var numberobs =
                    Observable.FromEvent<NumberEventHandler, long>(
                                ev => { NumberEventHandler neh = (sender, e) => { ev(e); }; return neh; },
                                ev => AnyNum += ev,
                                ev => AnyNum -= ev);

            var watchforfizz = from n in numberobs where n % 3 == 0 select "Fizz";
            var watchforbuzz = from n in numberobs where n % 5 == 0 select "Buzz";
            var watchforothers = from n in numberobs select ((n % 3 != 0 && n % 5 != 0)?n.ToString():"") + "\n";

            watchforfizz.Subscribe(x => { Console.Write(x); });
            watchforbuzz.Subscribe(x => { Console.Write(x); });
            watchforothers.Subscribe(x => { Console.Write(x); });
            numbers.Subscribe(x => AnyNum(null, x));
           
            Console.ReadKey();
        }
    }
}

Key features are the number generator, and the three filter event handlers. I feel like there should a better way of handling the “regular” numbers, but close enough.

Share

© 2009 Saved for later reference. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.