Konstantin Vlasenko

An engineer is someone who can make for a dollar what any fool could make for two. – Alan Kay

Enable SQL protocol by using PowerShell

A stand-alone installation of SharePoint usually utilizes SQL Server Express. The instance name is SHAREPOINT. (This is true for SharePoint 2013). You must enable TCP protocol to access the SharePoint back-end.
SQLTCP

PS> function EnableSQLProtocol($instance, $proto)
{
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | out-null
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer').
$uri = "ManagedComputer[@Name='$(hostname)']/ServerInstance[@Name='$instance']/ServerProtocol[@Name='$proto']"
$p = $wmi.GetSmoObject($uri)
$p.IsEnabled = $true
$p.Alter()
}

PS> 'Tcp','Np' | % {EnableSQLProtocol SHAREPOINT $_}

SharePoint 2013 on Windows Azure VM five times more expensive than on AWS instance

Something wrong with Windows Azure! I decided to run a SharePoint 2013 on Windows Azure. Just to give Azure a chance;) But! What is going on there? Does someone really use it?
SharePoint 2013 requires minimum 8GB of RAM.

AWS

$0.066

AWS

Azure

$0.32

azure

PowerSlim vs Fitnesse vs SpecFlow

PowerSlim Fitnesse (SLIM) SpecFlow
Web Access GreenCheck_16 GreenCheck_16 Delete_16x16
Test In/Out WYSIWYG WYSIWYG Gherkin scripts are used to generate test fixtures. Actual test results you can view by using Visual Studio Test View interface.
Verification Code Verification done by framework itself. You just need to provide the results. Verification done by framework itself. You just need to provide the results. You need to duplicate your specification statements again for underlying testing framework (MSTest, NUnit)
Built in Fixtures GreenCheck_16 Delete_16x16 Delete_16x16
Visual Studio Integration GreenCheck_16
Force HLT GreenCheck_16 Delete_16x16 Delete_16x16

Test In/Out

PASSED

TestInOut

FAILED

TestInOutRed

Verification Code

SpecFlow - check CompareToInstance or CompareToSet examples.

Fitnesse - check method query(). It just returns the results. There are no comparisons/expectations/asserts. Finesse does it for you because of  In/Out (see above).

Built in Fixtures

  •  Built in possibility to call product through public interface
  •  Built in possibility to see results of such a call

PowerSlim already implemented Fitnesse fixtures (Script, X Query, Scenario, Decision ) for you. So you don’t need to write any test classes to make a glue between your test and production (SUT). All you need is to find a way how to setup testing environment or to call your production through a public interface (command line, PowerShell CMDLets, REST, HTTP).   PowerSlim will send the results back to Fitnesse by using SLIM protocol. And the good things is that Fitnesse by himself is responsible for different type of verifications (see Verification Code above).

Example: get-service is all what you need to put in your test to get the idea about the state of a particular service.

Subset Query:Local get-service
ServiceName Status DisplayName
SENS Running GO SENS GO

Visual Studio Integration

I really want to put something for SpecFlow. They did the great job by integrating with Visual Studio ;)

HLT

The requirement to test/call your product through a public interface is still the #1, even if I don’t completely agree with myself back to 2010 http://vlasenko.org/2010/03/17/beyond-acceptance-testing-framework/. It is not an Acceptance Tests if you need to mock part of your product. Probably this one is not a bad unit test (Stop Mocking, Start Testing)

Тестируем с помощью Fitnesse+PowerSlim

Canada Work Permit: Firts year tax return in Canada

All about your tax return
Unless you resided in Canada all year, you also need one or more of the following publications
Newcomers to Canada 2012 – I assume this document doesn’t apply for you if you are staying in Canada by using Work Permit.

This pamphlet is for you if you left another country to settle in Canada in 2012.
This pamphlet will introduce you to the Canadian tax system and help you to complete your first income tax and benefit return as a resident of Canada.
If you are in Canada temporarily in 2012, this pamphlet does not apply to you. Instead, see Guide T4058, Non Residents and Income Tax

Non-Residents and Income Tax 2012

Were you a non-resident in 2012?

You were a non-resident of Canada for tax purposes in 2012 if one of the following situations applies to you:

you did not have significant residential ties in Canada and you lived outside Canada throughout the year, except if you were a deemed resident of Canada. For example, you could be a deemed resident of Canada if you were an employee of the Government of Canada posted abroad. For more information, go to International and non-resident taxes;
you did not have significant residential ties in Canada and you stayed in Canada for less than 183 days in the year. Any day or part of a day spent in Canada counts as a day. If you lived in the United States and commuted to work in Canada, do not include commuting days in the calculation; or
you were deemed not to be resident in Canada under the Income Tax Act because of the provisions of a tax treaty Canada has with another country.

NR7-R Application for Refund Part XIII Tax Withheld
General Income Tax and Benefit Guide for Non-Residents and Deemed Residents of Canada – 2012

Terminate EC2 Spot/On-Demand instance by name

Declare function to terminate instance by Id

function ec2-terminate-instance($instid){
$ec2.TerminateInstances((new-object Amazon.EC2.Model.TerminateInstancesRequest).WithInstanceId($instid)).TerminateInstancesResult.TerminatingInstance[0]
}

Get instance by name and terminate it

$filter = (new-object Amazon.EC2.Model.Filter).WithName('tag:Name').WithValue('YourInstanceName')
(Get-EC2Instance -Filter $filter -Region 'us-east-1').RunningInstance | % { ec2-terminate-instance $_.InstanceId }

Stop EC2 On-Demand instance by name

$filter = (new-object Amazon.EC2.Model.Filter).WithName('tag:Name').WithValue('YourInstanceName')
(Get-EC2Instance -Filter $filter -Region 'us-east-1').RunningInstance | % { Stop-EC2Instance $_.InstanceId -Region 'us-east-1'}

New-ASLaunchConfiguration with IAM Role

This post is good addition to my previous post Schedule your Amazon EC2 spot instance startup time.
You can slightly modify call to New-ASLaunchConfiguration cmdlet to use the powerfull IAM roles feature.
roles

New-ASLaunchConfiguration Fitnesse -ImageId ami-00000000 -IamInstanceProfile Fitnesse -SecurityGroups Fitnesse -InstanceType t1.micro -SpotPrice 0.011

Schedule your Amazon EC2 spot instance startup time

Here I want to explain how to start your Amazon EC2 instance recurrently by scheduling.


I have used the AWS Tools for Windows PowerShell. You can use java command line or python library. The main goal is to explain the idea:

I am going to automate the starting of my Fitnesse server.

Create launch configuration

New-ASLaunchConfiguration Fitnesse -ImageId ami-00000000 -SecurityGroups Fitnesse -InstanceType t1.micro -SpotPrice 0.011

Create Auto Scaling group with MinSize=MaxSize=0

New-ASAutoScalingGroup Fitnesse-AS -LaunchConfigurationName Fitnesse -AvailabilityZones us-east-1a -MinSize 0 -MaxSize 0

Set the Start scheduling action
The core thing is the MinSize=MaxSize=1 and the -Recurrence argument which is in the cron scheduler time format

Write-ASScheduledUpdateGroupAction -AutoScalingGroupName Fitnesse-AS -ScheduledActionName Start -MinSize 1 -MaxSize 1 -Recurrence '15 13 * * *'

Optionl (stop event)

Write-ASScheduledUpdateGroupAction -AutoScalingGroupName Fitnesse-AS -ScheduledActionName Stop -MinSize 0 -MaxSize 0 -Recurrence '59 23 * * *'

Installing AWS Tools for Windows PowerShell through PowerShell

AWS Tools for Windows PowerShell

(new-object System.Net.WebClient).DownloadFile('http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi', ‘c:\downloads\AWSToolsAndSDKForNet.msi’)
(start c:\downloads\AWSToolsAndSDKForNet.msi '/qn' -wait -PassThru).ExitCode
Follow

Get every new post delivered to your Inbox.