I’m Eric Tummers, Technical Consultant at Valid, and this is how I work

me and big chick
Eric Tummers likes challenges and sharing the solutions with others. His work is focused on the Microsoft .NET framework. He writes unit tests when he develops. Not all developers he has worked with share this necessity for unit tests and he has made it his task to convince them otherwise.
For 2014 Eric hopes to participate in a big Windows Azure project. That would give him enough to write about on his blog. We’ll see what comes his way.

Location: Sittard, NL
Current Gig: Technical Consultant, Valid
Word that best describes how you work: unittesting.
Current mobile device: iPhone 5
Current computer: HP Probook 6570b

What apps/software/tools can’t you live without? Why?

As a Microsoft developer I can’t work without Visual Studio. Recently we started using http://visualstudio.com for our projects, before we used on-premise Team Foundation Server. I like that SAAS (Software as a service) takes the sting out of staying up-to-date.

The entire family of Evernote (clipper, clearly, iPhone app) Since last november I’m a premium user to keep me from running out of upload allowance. I log interesting articles, emails I need to hold on to and scan most of the paper that comes in.

iSmoothrun is my preferred activity tracking app. My recent half marathon is a result of the history of captured data. Just logs everything I want and syncs with other online services like runkeeper.

What’s your workspace setup like?

Work setup

Work setup

Docking station with external monitor, keyboard and mouse. Powers my laptop (I don’t even carry my adapter in the bag anymore)

As a consultant I’m mostly on the go and this is a flex desk, so no papers laying around.

Good coffee is a must.

Home setup

Home setup

At home I have a wireless keyboard / mouse setup. The laptop is tilted and raised for better viewing. This is where my power adapter lives.

More clutter here, but I don’t mind.

What’s your best time-saving shortcut/life hack?

Avoid traffic by starting early. Also gives you a good hour of silent working before everybody gets in screaming about the horrible commute.

What’s your favorite to-do list manager?

Actually I use different to-do lists for my tasks. I use Trello for daily taskboard and for projects. Wunderlist for recurring tasks/chores like clean the sink or check the fire alarm. For longer running tasks, or tasks with content/documents The Secret Weapon in Evernote.

Besides your phone and computer, what gadget can’t you live without and why?

My Apple TV2 (jailbroken) hooked up to my NAS for movies and series. Also hooked to my stereo for music streaming. Awesome device!

What everyday thing are you better at than everyone else? What’s your secret?

Unit testing. Is that an everyday thing? Yes. The advantage of unit testing is the work it saves in the end. But you’ll have to put in the extra work in the beginning. With my experience from other projects I think “How can I unit test this” every time I program something. Reviewing code from others gives me great ideas how to do things better.

What do you listen to while you work?

When everything is working out like planned, silence is the working sound I prefer. But when the sh*t hits the fan: I’m a drum-and-bass fan. My latest powersong is also my ringtone: Run riot by Camo & Krooked.
run riot on soundcloud

What’s your sleep routine like?

My alarm clock is set to 7 AM when I’m working from home, to beat traffic it is set to 6 AM. When I wake before that my day is great. Also in the weekends I tend to get up as soon as I awake and it’s light outside.

Fill in the blank: I’d love to see _________ answer these same questions.

Have to go with Scott Hanselman. He’s the guy that gets 27 hours out of a day.

What’s the best advice you’ve ever received?

someecards.com - Make a shit first draft you cannot edit a blank page
I believe this is a variant on a Hemingway quote.

Original idea from Lifehacker.com.

Posted in Uncategorized | Tagged , , , , , , , , , | Leave a comment

Case sensitive dacpac for coding standards

In our project we have coding standards for SQL objects. But when a code review made us update casing we noticed the dacpac did not contain the changes after a schema compare. What happend?

Seems that our sql server databases are case in-sensitive by default. That is a good thing since everything keeps working, even with broken coding standards. I’ve never seen a case sensitive database and wonder if they even exist.

The dacpac is configured to be case in-sensitive too. But that is about to change. Why? Because making the dacpac case sensitive was the solution. On the properties of the SqlProject there is a Database Settings button. Click it and set the Database collation to something with CS in it. (CS = Case Sensitive) Now the casing updates are synced to our SqlProject and compiled into the dacpac.

sqlproject_case_sensitive

Make sure to disable the deployment of database settings. That could break the software. You can exclude this by specifying the commandline option

/p:ScriptDatabaseOptions=false
Posted in Development | Tagged , , , , | Leave a comment

Start-SqlJobAndWait

We have some SqlJobs that we run in our regression tests. To automate this we need something that can start the job and wait for it to finish.

Based on this post we know we need to poll the sysjobhistory table. Wrapping it in a powershell module lets us use it in all our regression tests. The code is listed below.

function Start-SqlJobAndWait {

param (
    [string] $servername,
    [string] $jobname
    )
    # connection to database
    $connectionstring = "Data Source=$servername;Initial Catalog=msdb;Integrated Security=TRUE;"
    $conn = New-Object System.Data.SqlClient.SqlConnection $connectionstring
    $conn.Open()

    # create temp stored procedure to start and wait for the job
    $cmd = $conn.CreateCommand()
    $cmd.CommandText = Get-StoredProcedureDropScript
    $cmd.ExecuteNonQuery()
    $cmd.CommandText = Get-StoredProcedureCreateScript
    $cmd.ExecuteNonQuery()
    $cmd.Dispose()

    # call temp stored procedure
    $cmd = $conn.CreateCommand()
    $cmd.CommandTimeout = 600 # 10 minutes
    $cmd.CommandText = "EXEC #usp_Start_And_Wait_For_Job N'$jobname'"
    $cmd.ExecuteNonQuery()
    $cmd.Dispose()

    # connection close removes the temp stored procedure
    $conn.Close()
    $conn.Dispose()
}

function Get-StoredProcedureDropScript {
"
IF object_id(N'tempdb..#usp_Start_And_Wait_For_Job') is not null
    DROP PROCEDURE #usp_Start_And_Wait_For_Job
"
}

function Get-StoredProcedureCreateScript {
"
CREATE PROCEDURE #usp_Start_And_Wait_For_Job (@jobName SYSNAME)
AS

SET NOCOUNT ON
DECLARE @jobID UNIQUEIDENTIFIER, @maxID INT, @status INT, @rc INT

IF @jobName IS NULL
BEGIN
 RAISERROR('Parameter @jobName have no value.', 16, 1)
 RETURN -100
END

SELECT @jobID = job_id FROM msdb..sysjobs WHERE name = @jobName

IF @@ERROR <> 0
BEGIN
 RAISERROR('Error when returning jobID for job %s.', 18, 1, @jobName)
 RETURN -110
END

IF @jobID IS NULL
BEGIN
 RAISERROR('Job %s does not exist.', 16, 1, @jobName)
 RETURN -120
END

SELECT @maxID = MAX(instance_id) FROM msdb..sysjobhistory WHERE job_id = @jobID AND step_id = 0

IF @@ERROR <> 0
BEGIN
 RAISERROR('Error when reading history for job %s.', 18, 1, @jobName)
 RETURN -130
END

SET @maxID = COALESCE(@maxID, -1)

EXEC @rc = msdb..sp_start_job @job_name = @jobName

IF @@ERROR <> 0 OR @rc <> 0
BEGIN
 RAISERROR('Job %s did not start.', 18, 1, @jobName)
 RETURN -140
END

WHILE COALESCE((SELECT MAX(instance_id) FROM msdb..sysjobhistory WHERE job_id = @jobID AND step_id = 0), -1) = @maxID
      WAITFOR DELAY '00:00:01'

SELECT @maxID = MAX(instance_id) FROM msdb..sysjobhistory WHERE job_id = @jobID AND step_id = 0

IF @@ERROR <> 0
BEGIN
 RAISERROR('Error when reading history for job %s.', 18, 1, @jobName)
 RETURN -150
END

SELECT @status = run_status FROM msdb..sysjobhistory WHERE instance_id = @maxID

IF @@ERROR <> 0
BEGIN
 RAISERROR('Error when reading status for job %s.', 18, 1, @jobName)
 RETURN -160
END

IF @status <> 1
BEGIN
 RAISERROR('Job %s returned with an error.', 16, 1, @jobName)
 RETURN -170
END

RETURN 0"
}

Export-ModuleMember -function Start-SqlJobAndWait
Posted in Test, Tooling | Tagged , , , | Leave a comment

Entity Framework Fake ObjectContext Realization Tool

With Effort (Entity Framework Fake ObjectContext Realization Tool) I can create integration tests for the datalayer in my project. The tool has an Entity Framework provider that works on an in-memory database. This means I can call SaveChanges without mocking it or having a dependency on a real database. It can be run during build.

Installation is easy with the package manager from visual studio.

install-package effort.ef6

Data used in the tests can be loaded from all kinds of sources. I’m loading my testdata from CSV files. The proces is based on naming convention. So the name of the csv file is the name of the table the data is loaded into.

// Load CSV files
var directory = AppDomain.CurrentDomain.BaseDirectory;
var importer = new CsvDataLoader(directory);
// create connection to the in-memory database
return Effort.DbConnectionFactory.CreateTransient(importer);

Remember to deploy the csv files on build by setting “copy if newer” and adding the DeploymentItem attributes on the TestClass/TestMethod. This way I can store the files in a subfolder and deploy them to the BaseDirectory for easy loading.

[TestClass]
[DeploymentItem(@"initialData\table1.csv")]
public class MetaDataToolContextTest {
    // ... 
}
Posted in Development | Tagged , , | Leave a comment

Skype for business mac preview

We’ve been using Lync for some time on Windows and Mac. Microsoft has moved on with Skype for business on the Windows platform. Now a preview for the Mac is available and I decided to sign up for the preview at https://www.skypepreview.com

After been accepted I dowloaded the latest build and started using it. The App has a “check-for-updates” menu item, so no more searching for the download link.

skypeforbusiness-download

Little snitch reports connections to hockeyapp.com, microsoft.com and microsoftonline.nl. This is expected with preview / beta software. Other connections go to lyncdiscover.valid.nl and autodiscover.valid.nl to connect to my colleagues at valid.nl.

Everything works like on the Windows platform. Some features are missing, but the core functionality is there. Like chatting, voice / video and screen sharing.

skypeforbusiness-screensharing

My experience is good. I mainly use the chat to communicate with colleagues and that just works. We’re planning to do monthly virtual meetups and then it’ll have to prove worthy.

Posted in Tooling, Uncategorized | Tagged , , , | 2 Comments

Week 38 roundup

Last week recap and links:
Image courtesy of kanate / FreeDigitalPhotos.net

  • Powershell syntax in Sublime Text 2, the method is for Windows but also applies to Mac
  • We used the build definition settings (TFS2015) to use a two digit month and dayOfTheMonth buildnumber. The key is to use the Date token in stead of Month and DayOfMonth: $(Year:yyyy).$(Date:MM).$(Date:dd)$(Rev:.rr)
  • Continuous deployment with TFS and Azure Websites can be customised. Applies to all real-life, multiple-websites-solution and more-advanced-than-the-demo projects.

Image courtesy of kanate / FreeDigitalPhotos.net

What are your best reads this week? Leave them in the comments below.

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Spark as alternative to Cloudmagic

Cloudmagic used to be my email client on iOS. But with the introduction of Newton it became a paid service. Since there are free alternatives I decided to switch. My new favourite is Spark.

sparkapp

What I want

My list of requirements is short but specific:

  • Support for IMAP, iCloud and GMail
  • Integration with Evernote
  • Free or one-time-purchase

Spark

Setup was simple. Spark recognised my (dutch) provider and only needed my email address and password. Integration with 1Password made entering the credentials a no-brainer.
The integration with Evernote is great. Just grant access via the Evernote App and now you can swipe an email to Evernote. Swipe actions are customisable.
The interface needs some getting used to and I’m not sure if I’ll ever use the quick reply feature.

Alternatives

In my quest I noticed Boxer. Swipe actions just like Spark. Paid app usually mean great support but setup of IMAP failed miserably.
Outlook is praised everywhere. The integration is limited to Calendar events for Evernote reminders. So no chocolate.

Further reading

50 getting started tips for new Spark users on 9to5mac.com
Vimeo promotional video

Posted in Tooling | Tagged , , | Leave a comment

Allow only release build to be published

We have a WPF application that we distribute with click-once deployment. The update feature is exactly what we need for our product. Getting the new build from Development into Production is easy, just publish.

The problem is that we only want Release builds to be published. Config transformation, code optimisation and custom icons are some of the main reasons we want to publish a Release build. Sometimes we forget to change the configuration and a Debug build is released into the wild.

As a safety net we added the BeforePublish build target to the project.

<Target Name="BeforePublish">
    <Error Condition="'$(Configuration)'!='Release'" 
           Text="Only Release build can be published" />
</Target>

Now when we try to publish without setting the configuration to Release the build fails.

publish.debug.fails

Since this is a very small project we haven’t setup automated build. The errors should keep us safe for now.

Posted in Development | Tagged , , | Leave a comment