Northwind database: small and useful… what’s not to like?

Er.. a lot. I’ll leave the link and page in, but the AdventureWorks is more recent here.

NorthWind01

Get it here:

NorthWind02

The executable sql script looks promising…

NorthWind03

For whatever reason, the encoding on my file was wierd. I recommend opening the file in NotePad++, copy that content and then paste it into SSMS. As they say, you will need to create the database for this route. I got an access denied on the sqlcmd route, so apart from some cursory checks on file permissions, I just abandoned that path.

NorthWind05

Link to the SQL script download.

Link to the backup download.

Link to the ERD download:

NorthWind04

Advertisements

Powershell – sending email with attachments

Email, even with attachments, is pretty simple in PowerShell:

email01

And the proof that it does stuff…

email02

$mailServer = "smtp.live.com"
$sender = 'FannyAdams@outlook.com'
$recipient = 'AdamFanny@hotmail.co.uk'

$content = "Some basic content, on this day: [$(Get-Date)]."
$attachmentPath = "C:\FrenchThings\FrenchGcse01.PNG"
$subject = "Testing Things and so on"

$credentials = Get-Credential

Send-MailMessage `
    -smtpServer $mailServer  `
    -Credential $credentials `
    -UseSsl `
    -from $sender `
    -to $recipient `
    -subject $subject `
    -BodyAsHtml `
    -Body $content `
    -Attachments $attachmentPath

The section…

$credentials = Get-Credential

… interrupts script execution to prompt you for your credentials (obviously). Sure, you could save the encrypted credentials away, but this is for a stock reply that I need to run once a month, so it’s not worth the risk:

email03

 

The Help About is quite useful, as is Help generally for PowerShell, in my view:

email04

Composition using EZKeys

Starting with an idea on the piano (although this took a minute to record, it took an hour to get it off the app on Windows Phone)…

I then plugged that idea into EZKeys, without the ahem melody. So the root and the key is C Major, and it was worth the purchase almost alone to grasp the idea that, given the Circle of Fifths, the farther away a chord is from the root, the less “right” it sounds. In the case of my song, C is the root, and let’s say the immediately “acceptable” chords are C, F,G,Am,Em,Dm, and some minor variations thereon:

CircleOfFifths02

That suggested this sequence to me:

Gospel01

And this is how it sounds, with a Gospel slant:

Dimension Pro

So now I really am starting to have too many VSTs, but I love a bargain. Dimension Pro reduced to £9.99 – that is just to good too ignore, and the instruments are great: I was looking for a bass, and decent strings – I already have the Lite version, but they don’t seem to be as good as this, to my ear.

DimProPurchase

So I threw together a very quick track – 2 acoustic guitar tracks (through a Pod), drums from EZDrummer, and the bass. In places out of tune, out of time, doesn’t matter:

 Notes on composition

From  a Cakewalk blog.

 

 

Circle of Fifths

I’m using this as a handy place to keep the diagram of the Circle of Fifths.

This particular example comes from EzKeys, which I’ve just bought. I don’t particularly like their piano engine, I’m more interested in the compositional stuff.

CircleOfFifths

 

And very much for my own reference, the settings that sound best with the Merida electro-acoustic:

9d – phasing / acoustic
6c – rockabilly
5b – ok distortion
2d – bit of phase and distortion

 

Prism: MEF in a Silverlight context

This post is about using MEF in Silverlight, and specifically getting going using the quick starts in the Prism (4.1 in my case) download.

I’ve mentioned the Prism Developer’s Guide. For MEF and Silverlight it points you to the .bat highlighted below, which just starts up that solution.

QuickStartUpgrade05

I’m using Visual Studio 2012, whereas the Prism 4.1 Quickstarts assume VS2010. Hence I get a bunch of upgrade alerts:

QuickStartUpgrade02

QuickStartUpgrade01

 

Nothing to worry about, as it all compiles and runs fine:

QuickStartUpgrade04 QuickStartUpgrade03

 

 

ModuleTrackingState.cs

Browsing through the code, we see that, in places anyway, the Quickstart has implemented its own INPC, rather than just using the Prism version:

QuickStartUpgrade06

 

If I remove the System.ComponentModel using, to force the issue, then we can see where we need to update things:

QuickStartUpgrade07

QuickStartUpgrade08

We replace INPC with NotificationObject from the Prism Libraries:

QuickStartUpgrade09

This then prompts us with the new Using:

QuickStartUpgrade10

I made the mistake on redoing this of looking for a specific Prism ViewModel DLL on the file system. Doh. You just want the general, Silverlight specific, Prism DLL:

prism01

With that in place, we can now just remove the helper event handler and method.

Also remove the string constants, as we’ll be replacing these with lambdas:QuickStartUpgrade11

 

Now we have broken stuff…

QuickStartUpgrade12

 

… until we make the change to a lamdba (a minor performance overhead, as everyone notes):

QuickStartUpgrade13

, and then generally tidy up:

QuickStartUpgrade14

Finally make sure it still all runs (you’ll just have to take my word this is a fresh screenshot):

QuickStartUpgrade15

quod erat demonstrandum, as we used to say, when I was a boy.