Running Raven DB Server from VS2012 Solution Explorer

I needed to run the full RavenDB Server as part of a development I’m currently working on. So, I knocked up a little powershell script to do that for me …

$path = (gci packages\RavenDB.Server.* | select -First 1).FullName
$exe = (gci $path -Recurse -Include Raven.Server.exe).FullName
cmd.exe /c start "$exe"

It assumes you’ve installed the nuget package into your solution. This shouldn’t be done via the package manager, as stated on the nuget page.

Use this package if you want to run RavenDB as a standalone application. This package is not intented to be used in Visual Studio. RavenDB is a document database for the .NET platform, offering a flexible data model design to fit the needs of real world systems.

PM> Install-Package RavenDB.Server

So, I added the script (at the top of this post) as a solution item. I also have an external tool defined like so …

Powershell External Tool in VS2012

So, to run my RavenDB Server I just highlight “Raven.ps1” in the solution explorer …

Solution Explorer - Solution Items - Raven.ps1

… and select Run Powershell (x64) Script (output window)

VS2012 Tools Menu

… and there you have it. Full RavenDB Server running.

I hope that helps someone else out there.

Have fun with RavenDB, it’s pretty awesome from what I’ve seen so far.

Over the last few (work) days I have been having problems getting CDC (Change Data Capture) to work. After looking in the SQL Server Agent job history and finding the error “Cannot find the principal ‘dbo’, because it does not exist or you do not have permission” a colleague suggested changing the db owner to “sa”. As soon as I did that everything (CDC related) sprung into life, without me even needed to restart the SQL Server Agent windows service.

Stanley Johns's Database Blog

There are times when a DB is created and the dbo user is mapped to another user name like ‘mike’, instead of being mapped to the sa login. Usually, sp_change_users_login can be used to change the logins of a DB user, but this SP cannot be used for dbo users. This is when sp_changedbowner will have to be used. Execute sp_changedbowner ‘sa’, and now your dbo DB user will be mapped to the sa login.

View original post

Why do motherboard manufacturers ship out-of-date drivers?

I’ve just built myself a new HTPC to replace my aging machine in the lounge. It dutifully installed all the drivers from the supplied CD, after having copied them to my USB pen drive in order to load them onto my optical disc free HTPC. I also went onto the manufacturers website to make sure I got the latest network driver as I’ve had problems with network drivers in the past.

So, I went ahead and started testing my new PC with some movies I have stored on my NAS. Everything seemed fine at first, but then a few minutes into my test movie I started getting choppy video. So, I did the usual thing of trying out a few different CODECs, but they all suffered from the same problem to varying degrees.

As a last resort I copied my test file onto the local hard drive of the PC and tried again. Eureka!

I couldn’t believe I was getting the same problem despite having updated my network driver. So, off to the realtek site I went and downloaded the driver for my network chip from there.

Here are the details of the “latest” driver on the asrock site …

Driver Date = 23/06/2010
Driver Version = 7.23.623.2010

Here are the details of the latest driver from the realtek site …

Driver Date = 26/12/2012
Driver Version = 7.67.1226.2012

What I don’t understand is that the motherboard this driver came with is just over 2.5 years out of date and from what I’ve read somewhere (but cannot find again) also predates the release date of the CPU the motherboard is built around, although I may be wrong on that last count. (Update: Wikipedia article stating E350 APU release date of 4th of January 2011)

The motherboard is an Asrock E350M1 which has an AMD Zacate E350 CPU. It has a realtek RTL8111E network chip installed.

The PC has been playing video content solidly for the last 6 hours without any problems. There is still the odd dropped frame, but I can live with that.

The latest incarnation of my TV Server

I recently wrote about how my home network has evolved over the years. Well, it happened again!

About 4 months ago a bought a HP Micro Server. It only cost about £120 after the £100 mail-in rebate. Admittedly its not got anywhere near the grunt that my old server had, but I didn’t really need that as the CPU sat idle 99.9% of the time. I invested in a black gold 4 tuner PCI Express card at the same time. So I just have that and a bunch of hard drives in there. It sits there all day recording umpteen different shows for my 3 year old boy and the odd programme for us to watch! It uses about 60 watts less power, which is a bonus, it also takes up a lot less space and produces less heat and noise. I actually ended up using the MicroATX case to house my new development PC.

The other simplification I have gone through recently is to dismantle my “home made” 19″ rack and move the switch, patch panel, router and wireless access point into a wall mounted 6U rack cabinet. Not only neater but also gives me back quite a bit of loft space!

My next job is to get rid of the patch panel. My justification for having it, apart from being “geek” cool was that I could change how I used any network port in the house. I haven’t done that once in over 5 years. So I’ve bought a label printer and am just going to put RJ45 connectors on the end of all the cat5e cables and label them all up.  I’ll still be able to change how use the network points but it will be that bit simpler.

After that I’ll have a few things to put on eBay!

New Development PC (2012/2013)

My development PC was starting to get a bit “creaky”, so I decided it was time for a new one!

Lately I’d been getting quite a few instances of low memory, so that was the main reason for the new build. My motherboard already had it’s maximum 8GB of memory installed. I used to run a 4 disk RAID-10 back in the olden days when I had spinning drives, but since I’ve made the move to SSDs I’ve only had the one hard drive in there. So, the 4U rack case it was housed in was a slight case (pun not intended) of overkill! I looked around at the available mini-ITX boards, but the maximum amount of RAM I could install was 16GB. While that seems like a lot I didn’t want to restrict myself to only doubling up. I already had a micro-ATX case, originally intended for a new server build but now unused as I bought a HP micro server instead. When I looked at the available micro-ATX board I saw that they mostly supported 32GB RAM, decision made.

I’m sure my current SSD would have been just fine, but when building a new “production” machine I prefer to buy all new bits and re-purpose the old ones. The reason being that I like to keep the old machine running in parallel to the new one for a while so I can iron out any kinks and transfer all my data over the network. If I forget anything, it’s not big deal as I can just power up the old machine and pull the missing data across. It also allows me to transfer any settings over while still getting the benefit of a minty fresh windows install.

This is the parts list I decided to go with …

Type Make & Model Cost (inc VAT)
Motherboard Gigabyte GA-B75M-D3H Intel B75 (Socket 1155) Micro-ATX £42.95 (£51.54)
CPU Intel Core i7-3770 3.40Ghz (Ivy Bridge) Socket LGA1155 £181.66 (£217.99)
Memory 32GB Mushkin Enhanced Blackline Frostbyte £99.99 (£119.99)
Hard Drive OCZ Vertex 4 256GB SATA-III Solid State Hard Drive £141.66 (£169.99)
Case Fractal Design Core 1000 MicroATX Case n/a

The other benefit of building a new PC is that I get SATA3/USB3 interfaces.

Components

Components

Case

Case

Motherboard

Motherboard

CPU

CPU

I installed Windows 7 Ultimate from my USB Pen Drive (which I keep on my keyring). I can highly recommend creating a bootable USB Pen Drive as it speeds up the install drastically. I’ve heard of someone putting the install on an SSD, which speeds it up even more. So, about 15 minutes later I had a usable machine. The next step was to install all my required software. I used chocolatey for quite a lot of it, but some I had to use the full installer and click on buttons, pah!

Chocolatey is awesome. I needed subversion on my machine yesterday, so I fired up powershell, ran cinst sliksvn, restarted powershell and I was using command line subversion inside a couple of minutes later.

My powershell profile (a few time savers)

Recently, I’ve been using powershell on a day-to-day basis for general things, not just writing scripts to perform laborious tasks. I’ve start putting some of those things in to my profile. First is a quick way to edit my profile …

function pro
{
    notepad $profile
}

Simple enough, but save a bit of time 🙂

Now for some more useful stuff

Get all the folders within the current folder which contain Visual Studio solutions …

function Get-Projects
{
    Get-ChildItem -Filter *.sln -Recurse | ForEach-Object { Split-Path -Parent $_.FullName }
}

Okay, so once I’ve moved into one of those folders how do I load the solution in Visual Studio. Well I could do this …

  • *.sln
  • (tab)
  • (enter)

or I could have another powershell function to do that …

function Load-Solution
{
    $sln = (Get-ChildItem -Filter *.sln | Select -First 1).FullName
    Write-Host "Loading $sln ..."
    $shell.ShellExecute("$sln","","","")
}

I also have this in my profile to provide the $shell object

 $shell = New-Object -com shell.application
 

Add a few other things and some aliases in to the mix and this is my profile …

Import-Module ByBoxAppFabric

function pro
{
    notepad $profile
}

function Get-Projects
{
    Get-ChildItem -Filter *.sln -Recurse | ForEach-Object { Split-Path -Parent $_.FullName }
}

function Get-MinutesUntilMidnight
{
    [Math]::Round(([DateTime]::Today.AddDays(1) - [DateTime]::Now).TotalMinutes)
}

function Standup
{
    notepad "C:UsersantonyDocumentsByBox FilesStandup.txt"
}

function HgWorkbench
{
    & "C:Program FilesTortoiseHgthgw.exe"
}

function Load-Solution
{
    $sln = (Get-ChildItem -Filter *.sln | Select -First 1).FullName
    Write-Host "Loading $sln ..."
    $shell.ShellExecute("$sln","","","")
}

$shell = New-Object -com shell.application

Import-Module DistributedCacheAdministration
Use-CacheCluster

New-Alias proj Get-Projects
New-Alias sln Load-Solution
New-Alias hgw HgWorkbench

cd C:DevByBox
  • Adding AppFabric caching modules to allow me to administer my caches without having to load up the AppFabric powershell each time
  • Standup function, to load of my to-do list. It’s called Standup.txt as it just started life as note for my daily standup meeting
  • HgWorkbench function to quickly load of Hg Workbench for the current folder
  • Change directory to my development folder

I have powershell load up on startup, so I can quickly get going without having to wait for all my sidebar gadgets to load up (I have a file launcher gadget too!)

Visual Studio 2010 failing to uninstall extensions

So, I finally decided to update my Nuget Package manager to the latest version (2.0) today. I loaded up the extension manager and clicked the uninstall button. Nothing ….

After bit of google-fu and I found this stackoverflow answer. Which then produced an error message in the log file …

01/08/2012 11:24:39 – Uninstalling ‘NuGet Package Manager’, version 1.8.30524.9000.
01/08/2012 11:24:39 – System.IO.IOException: Cannot create a file when that file already exists.

at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.Uninstall(IInstalledExtension extension)
at VSIXInstaller.App.UninstallExtensionFromSKU(String vsixID, SupportedVSSKU sku)

Some more google-fu and I came across this answer on the microsoft forums. Which basically describes how to remove a couple of files in order to allow the extension to be removed. So, I fired up powershell (it could just as easily be done in a standard command prompt) and ran the following commands …

cd “C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEExtensionsMicrosoft CorporationNuGet Package Manager1.8.30524.9000”

Remove-Item *.deleteme

 

I then re-ran the vsixinstaller (via the Visual Studio Command Prompt)

c:Program Files (x86)Microsoft Visual Studio 10.0VC>vsixinstaller.exe /uninstall:NuPackToolsVsix.Microsoft.67e54e40-0ae3-42c5-a949-fddf5739e7a5

and the extension is gone. So I’m now going to reinstall it.

 

Those “ghost” deleteme files may also explain why I went through a spell recently of the extension uninstalling itself every time I loaded up visual studio!

AppFabric Cache and Powershell Profile

I’ve been working with AppFabric caching for a recent project and have been managing it on my work machine by using the Cache Administration Powershell Console that it adds to the start menu as part of the installation process. Rather than having to load that powershell console up I decided to add it to my profile. I’d never had a use to the profile before now. So a quick google found Setting up a Profile script in PowerShell.

So I opened up my powershell console (which I have pinned to my taskbar) …

PS C:Usersantony> notepad $profile

I then added the following to my (current blank) profile ..

set COMPLUS_ApplicationMigrationRuntimeActivationConfigPath=%SystemRoot%System32AppFabric
Import-Module DistributedCacheAdministration
Use-CacheCluster

Now, when I open up my standard powershell console I can administer AppFabric

New Desk, New Office, Old PC!

My employer has very kindly bought me a sit/stand desk for my new home office. I say office, it’s actually just an area in a spare bedroom. First a little background…

My “old” office was kitted out with a huge corner desk. Well, it actually took up 2 sides of the room. The dimensions of the room are 10’2″ x 8’6″ (3.09m x 2.59m) and the desk took all but 30cm or so of each wall. It dates back to the old days of CRT monitors, of which I had two hue 19″ monster! So, I need the real estate in the corner for the monitors. But things have more on now and I’ve not had CRT monitors for many years. I’m a bit of a silent PC freak too, but I could never achieve it with the tech of the CRT days. I also don’t like having a massive box whirring away in my office. So, I put all my computer equipment in the loft with HDMI and USB cables running down the walls to my monitors and peripherals.

The “New Office” part of this post means that I’ve moved from one side of the house to the other, so rather than run extra long USB and HDMI cables and run the risk of signal loss/degradation I decided to move the equipment to the loft area just above where my “New Desk” is. I can tell you lugging a 2U rackmount 1400VA UPS across the loft space was no easy task. I’ve also got my work PC housing in a 4U rack mount case, pretty heavy and awkward but much easier than the UPS.

So, I now have my PC and UPS in the loft with some trunking in the corner of the spare bedroom running down to desk level. This houses 2 HDMI cables and 2 active USB3.0 extension leads. I’m still using USB2.0, but I figured I’d make it easy to upgrade in the near future.

I also had to move my monitors, speakers, keyboard, mouse, power switch, usb hub, etc etc to the desk and wire it all up. The next day I visited IKEA and bought the GALANT desk cable tidy, screwed it to the underside of the desk. In the process I had to remove the motor from the desk and ended up just resting it in the GALANT cable tidy.

So, this is how things look now. Bear in mind I am still in the process of finding a home for everything, so there is a bit of clutter. I also need to sort out the cabling on top of the desk to make it look neater. I’m still thinking about whether I need a dual monitor arm which will free up a lot of space under the monitors.

    

The desk can be adjusted via the control panel and has 3 memories. To set a memory it’s just a case of moving the desk to the desired height and pressing the S button following by one of the dotted (.    ..    …) buttons. Then it’s just a matter of holding down the dotted button to move the desk to the saved height.