TheShed

Test Coverage

Category: Library
#Engineering #Test #Code Coverage

What's the right amount of test coverage? Test Coverage and Post-Verification Defects: A Multiple Case Study](https://onedrive.live.com/redir?resid=493B8BCE8FC1C3DA!26920&authkey=!AFbVeq8YcyR0jDQ&ithint=file%2cpdf) provides some insights. Interestingly, they find:

that the test effort increases exponentially with test coverage, but that the reduction in field defects increases linearly with test coverage.

In other words, it takes more and more effort to reduce field issues. Based on their study most of the benefit accrues up to around 80% code coverage.

Seth's tips for better online surveys

Category: Quote
#Seth #Blog

I quote this a lot so here's a link: Tips for Better Online Surveys

1.Every question you ask is expensive. 2.Every question you ask changes the way your users think. 3.Make it easy for the user to bail. 4.Make the questions entertaining and not so serious, at least some of them. Boring surveys deserve the boring results they generate. 5.Don't be afraid to shake up the format.

cURL on Windows (thanks Git)

Category: Tools
#Programming

cURL is a nifty little tool for doing things with the web (like HTTP Requests). It's expecially useful for playing with REST APIs...

A coleague was having some fun calling into the REST API of our issue tracking system. A perfect job for cURL I thought, until I remembered that I was VPN'd on a Windows box from a hotel bar...

Fortunately, the Git windows tool set includes Git Bash which includes... cURL

curl -D- -X PUT --data '{ "fields": {"assignee":{"name":"me"}}}' -H "Content-Type:application/json" https://testserver/rest/api/2/issue/Issue-135

curl -D- -X GET -H "Content-Type: application/json" https://testserver/rest/api/2/issue/Issue-134

to the rescue :-)

(Don't forget -u)

PS: I just stumbled on the fact that Git Bash also includes scp. What goodness\tm!

OneDrive from Python

Category: Tools
#programming #python #onedrive

A nice commandline tool (based on a Python wrapper for the OneDrive REST API) for working with OneDrive.

pywin32 0. Setup a Python Virtual Environment 1. On Windows, install pywin32 . From the venv use easy_install http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download (with the path to the right pywin32 for your system and Python version...) 2. pip install pyyaml 3. pip install python-onedrive[standalone] 4. Register your app with the OneDrive service (to get the client and secret keys). MSDN details 5. Create a configuration file with the client ID and secret:

client:
  id: <client id here>
  secret: <secret key here>
  1. Auth dance onedrive-cli auth

Then use. For example onedrive-cli ls to list content stored in OneDrive.

Bonus thought

The OneDrive web service now has some basic Markdown support in the webage text editor, but http://dillinger.io/ is nice too ;-)

Send to Kindle

Category: Tools
#python #Kindle

A nice little Python Script to send documents to Amazon Kindle via a command line.

(It works too :-)

Virtual Python

Category: Programming
#python

A quick starter on Python Virtual Environment

Create:

mkdir workingdir
cd workingdir
virtualenv venv

On Unix/Mac OS X use:

source venv/bin/activate

On Windows use:

venv\Scripts\activate.bat

Finish:

deactivate

To move the environment somewhere else:

  1. In existing (active) environment; grab a list of dependencies with pip freeze > requirements.txt
  2. In new (active) environment; install from the dependency list with pip install -r requirements.txt

To set a specific Python version. On Mac:

  1. First find the path to the version we want with which python3
  2. Activate the environment and run mkvirtualenv --python=<path to python> <venv> For example mkvirtualenv --python=/usr/local/bin/python3 myenv

More Mac OS Tips

Category: Tools
#Mac OS X #Tips

Some Mac Tips...

Copy and Paste

to open the go to dialog, then:

CTRL + V

to paste.

Links

Create a link to an application so I can easily run from a shell:

ln -s "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Bash

Bash setting are in the .profile file.

To set a path:

export PATH=~/bin:$PATH

To create an alias to a command:

alias qc="~/bin/qc.sh"

Then reload the .profile using the following from your home directory:

. ./.profile

(Use ls -a to show . files)

Making Word documents from Markdown

Category: Tools
#text #markdown #documents

Markdown is awesome.

So awesome that there's even a standardization effort to create one common markdown. XKCD on standards

Aside

Aside: James asked what the big appeal was. For me it's a plain text format that has built in context with minimal distracting markup. As example:

# I am a title in **Markdown**

\chapter{I am a chapter title in \textbf{\LaTeX}}

<h1>I am a heading title in <strong>HTML</strong></h1>

End Aside

Markdown in Sublime text distraction free mode might be the best authoring environment, but it's far from the best reading (especially for non-Markdown fanatics). Fortunately, pandoc exists to make conversions between formats easy. For example, to create co-worker friendly documents form .md files I use:

pandoc -s --reference-docx=reference\reference.docx -o %1.docx %1

Where reference.docx is a regular OOXML file (from MS Word) that sets up my default styles so that, for example, Markdown regular text uses the Segoe UI Light font family.

Nice.

Reference

Good Cops

Category: Quote
#Simo #T-Shirt Quotes

There are good cops Simo.

Top cat cartoon of Officer Dibble

Q.E.D.

Excel Macro Munging

Category: Programming
#Excel #VBA #macro

The problem:

A set of items in VSO where we wanted the ID as part of the title text.

(It's a long-ish story, but the default VSO board shows only title and assigned to so we adopted a convention of adding the ID to the title text too).

Over time, we'd gathered a number of MVPs on the board where the ID wasn't included. Rather than hand editing, I slurped the query into Excel using the TFS team extensions and ran a little macro to update the items. Here's the code:

Sub fixMissingIDInTitle()

Dim MyCell As Range, MyRange As Range
Dim count, total As Long
Dim sTitle As String
Dim sID As String
Dim iIDLength As Integer


' grab the starting point and then extend to get the range of items
Set MyRange = Sheets("All MVPs").Range("C3")
Set MyRange = Range(MyRange, MyRange.End(xlDown))

total = 0
count = 0

' iterate over the range
For Each MyCell In MyRange

    sTitle = MyCell.Value
    sID = MyCell.Offset(0, -2).Value
    iIDLength = Len(sID)

    If (Left(sTitle, iIDLength) = sID) Then
        ' do nothing - ID already at start
        ' Q: but is it the right ID?
    Else
        MyCell.Value = sID + " - " + sTitle
        count = count + 1
    End If

    total = total + 1

Next MyCell

MsgBox ("Updated " + CStr(count) + " of " + CStr(total) + " items.")

End Sub