7-Zip compression levels in Azure DevOps Archive Files task

In an attempt to make my artifacts smaller, I recently chose to use 7-Zip compression, or archiveType: 7z, in an Archive Files task of an Azure DevOps YAML pipeline. 7-Zip provides 5 compression levels: 1 (fastest), 3 (fast), 5 (normal), 7 (maximum) and 9 (ultra), as well as option 0, which doesn’t compress anything.

I like YAML pipelines, because they live in my repo and I can use templates. However, the online editing experience is not particularly great. Sure, the online editor « assists » you when editing a simple file, but if you’re referencing templates, you’re out of luck (or at least I haven’t found a way to edit a template and use the « assistant ».)

Long story short, I’m editing a template (in a text editor) and I want to specify the compression level in my task. The official Archive Files task documentation page unfortunately doesn’t document the property that defines this. Luckily, a dummy pipeline and the « assistant » allowed me to quickly figure out that I wanted to set the sevenZipCompression property of the task. Of course, since the property wasn’t documented, neither were the values that it accepted. So with a little patience and using the task’s source code to confirm, I quickly came up with a table, which I decided to persist here for future reference:

LevelDescriptoinsevenZipCompression valueDefault
0No compression‘none’
1Fastest compressing‘fastest’
3Fast compressing‘fast’
5Normal compressing‘normal’yes
7Maximum compressing‘maximum’
9Ultra compressing‘ultra’
7-zip compression levels for the Azure Pipelines Archive files task

A complete example of the task would look something like this:

- task: ArchiveFiles@2
  displayName: 'Compress Files'
    rootFolderOrFile: '$(Build.BinariesDirectory)'
    includeRootFolder: false
    archiveType: '7z'
    sevenZipCompression: 'maximum'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber).zip'
    replaceExistingArchive: true

Illustration: Emballages compressés by Daniel Hennemand is licensed under CC BY-NC-ND 2.0

Miss Peregrine’s Home for Peculiar Children

About a month ago I saw the trailer for Tim Burton’s upcoming movie Miss Peregrine’s Home for Peculiar Children and it immediately caught my attention. It turns out it’s originally a book, so I went over to Amazon, downloaded the first few pages and ended up buying the whole thing. It’s exactly the kind of fantastic universe I like to immerse myself into.

The Kindle version that I bought included three novels actually: Miss Peregrine’s Home for Peculiar Children and its two sequels, Hollow City and Library of Souls. I liked the first one a lot, enjoyed the second one OK, but just wanted to get through the third one to see how the story ended. This seems to happen to me often with series that had a successful first book or first few books, but where you can feel that either pressure from success and/or from the editors drives the sequels rather than a well told story…

I already noticed from the trailer that the movie is a loose adaptation of the books. I just hope it tells the whole story (which can definitely be told in less than 2 hours), rather than try to capitalise on multiple films. But still, I have a feeling that it will be way better in my head, despite Burton’s talent.

I particularly enjoyed the fact that the author went through the trouble of making the books themselves peculiar by using unusual photographs to illustrate (and kind of drive) the story. If you like reading stories of adolescents with special powers running around the UK and through time, the books are really enjoyable and a quick read, so I strongly recommend them.

Accessing Windows Azure Diagnostics Logs With LINQPad

If you are using Windows Azure Diagnostics with the DiagnosticMonitorTraceListener you will most likely have a table in your storage account called WADLogsTable with a ton of data in it. It can be a bit overwhelming.

A colleague and I wanted to get two simple pieces of information: an event’s date and the corresponding message. Furthermore, we only wanted events that had happened today. Here’s what we came up with using LINQPad and the Azure Storage Driver.

First, make sure you’re using a table storage account as your database. In my case, my connection is called mycloudstorageaccount.

Then simply perform your query. If you want to copy/paste, here’s the text version:

from l in WADLogsTable
where l.PartitionKey.CompareTo(DateTime.Today.Ticks.ToString("d19")) > 0
select new
	DateTime = new DateTime(l.EventTickCount.Value),

Oh, and don’t forget to check out the SQL tab if you are interested in the « low level stuff. » It will show the actual URL that was used to query Windows Azure.

LINQPad Driver for Azure Table Storage

I promise, this is the last you will see on this subject today (from my part, anyway). It’s for those who were not online yesterday and/or are in a different time zone and/or didn’t see my post from yesterday and/or don’t speak French.

I’ve been working quite a bit with Windows Azure lately and particularly with Table Storage. I used to use SQL Server Mangement Studio to work with SQL Server and I found Azure Storage Explorer (screenshot on the left), which is actually pretty good for working with all three storage options: queues, tables and blobs.

However, I’m a pretty heavy user of LINQPad (which has completely replaced SSMS for me for a while) and, although it’s totally possible to access Azure table storage with « standard LINQPad, » I was missing a few essential features, so I whipped up a LINQPad driver to easily query Azure Table Storage.

What does it do? It allows you to add storage accounts as connections in LINQPad. It supports the local emulator as well as actual cloud storage. With every connection, you get all the right references as well as a typed data context based on the account’s tables.

I think I included everything you can expect from a typed data context, which will work like a charm with auto-completion if you have a LINQPad license. For anything that’s not already there, the data context exposes a TableClient property that is a CloudTableClient instance. That should be enough to do anything you want.

There’s also a couple of other « bonus » features, such as displaying the requested URL in the « SQL » tab of LINQPad:

The whole thing is open sourced and available on GitHub. It’s even compiled and packaged if you’re interested but don’t want to deal with code.

If you work with Table Storage and LINQPad (if you haven’t adopted LINQPad yet, it might be the right excuse to test it), don’t hesitate to check the driver out. It would be nice if it got thoroughly tested and if I had feedback.

Partially Coloured TextBlock

I stumbled upon an interesting question on StackOverflow where someone is using a series of TextBlocks in a StackPanel to show them side by side and would like part of the displayed text to be coloured with one colour and the rest with another.

There has got to be a thousand ways to do this, but it got me thinking of how I would do it, and especially, how to do it quickly because I have a job besides StackOverflow Smile with tongue out

Here’s my take on the problem. Lire la suite « Partially Coloured TextBlock »

What’s in a name?

What’s in a name? That which we call a rose
By any other name would smell as sweet.

— Romeo and Juliet (II, ii, 1-2)

This morning I learnt through Engadget that what was known until now as Project Natal is now called Kinect for Xbox 360, as revealed just before E3 by none other than a 76-person cast of Cirque du Soleil. I had two reactions:

  1. Why wasn’t I invited? 😛
  2. Who came up with that horrible name?! Lire la suite « What’s in a name? »

Keyboard shortcuts for Visual Studio 2010


For those of you who really appreciate the time gained by not moving your hand away from your keyboard and towards the mouse, Microsoft released 4 keybinding reference cards (cheet sheets if you will) for Visual Studio 2010 in the form of high-quality PDFs.

In these foldable cards you’ll find the default keyboard shortcuts for:

  • Visual Basic .NET
  • Visual C++
  • Visual C#
  • Visual F#

Available on MSDN Downloads.