Contact

admin

About Me · Send mail to the author(s) E-mail · Twitter

At GROSSWEBER we practice what we preach. We offer trainings for modern software technologies like Behavior Driven Development, Clean Code and Git. Our staff is fluent in a variety of languages, including English.

Feed Icon

Tags

Open Source Projects

Archives

Blogs of friends

Now playing [?]

Error retrieving information from external service.
Audioscrobbler/Last.fm

ClustrMap

Outlook Macro: Mark All Items Read In Subfolders

Posted in Office at Thursday, 18 September 2008 17:29 W. Europe Daylight Time

Mailing lists Recently my mailing lists subscriptions grew to an extend not seen before, largely due to my grown interest in ALT.NET and open source projects. Having an eye on the dev or user mailing lists is often very valuable to stay on top of recent developments, identify best practices and to post or answer the occasional question.

However, that doesn't come without drawbacks. One increasing hassle is to keep up with the constant flow of information such that I see myself forced to reset once in while. After getting back from a 3-day vacation this summer I had 200+ unread feed items and uncounted unread mailing lists messages. I do not claim to read everything that lands in my inbox(es) so a quick "mark all as read" is a very relieving act. FeedDemon, my feed reader, even has a panic button to support this discomforting situation.

Unfortunately Outlook does not support marking all items read in a certain folder and all of its subfolders. On the other hand, there is this ancient VBA language that you can use to program Outlook…

Sub MarkAllRead()
    Dim resultFolder As folder
    Dim folder As folder
    Dim item As MailItem
        
    Set resultFolder = GetFolder("path\to\your\mailing\lists\root\folder")
    
    For Each folder In resultFolder.folders
        For Each item In folder.Items.Restrict("[unread] = true")
            item.UnRead = False
        Next
    Next
             
    Set resultFolder = Nothing
    Set folder = Nothing
    Set item = Nothing
End Sub

Function GetFolder(strFolderPath As String) As MAPIFolder
    ' strFolderPath needs to be something like
    '   "Public Folders\All Public Folders\Company\Sales" or
    '   "Personal Folders\Inbox\My Folder"
    
    Dim colFolders As Outlook.folders
    Dim objFolder As Outlook.MAPIFolder
    Dim arrFolders() As String
    Dim i As Long
    On Error Resume Next
    
    strFolderPath = Replace(strFolderPath, "/", "\")
    arrFolders() = Split(strFolderPath, "\")
    
    Set objFolder = Application.GetNamespace("MAPI").folders.item(arrFolders(0))
    If Not objFolder Is Nothing Then
        For i = 1 To UBound(arrFolders)
            Set colFolders = objFolder.folders
            Set objFolder = Nothing
            Set objFolder = colFolders.item(arrFolders(i))
            If objFolder Is Nothing Then
                Exit For
            End If
        Next
    End If
    
    Set GetFolder = objFolder
    Set colFolders = Nothing
End Function

Thanks to Lars Keller for the hint to filter unread items with Restrict()!

ReSharper Type Members Layout for MSpec 0.2

Posted in BDD | ReSharper at Tuesday, 16 September 2008 19:35 W. Europe Daylight Time

A couple of days ago Aaron Jensen released MSpec 0.2, a BDD-style testing framework. Since I got hooked on BDD during my last work project (readable test names!) I was eager giving MSpec a shot. MSpec comes with support for TestDriven.NET so using inside of Visual Studio is a no-brainer once you installed the MSpec support for TD.NET. The release contains everything you need.

Today I wrote my first couple of MSpec specifications and had a very good initial experience. However, there's one caveat with ReSharper's absolute killer feature (well, one of its many killer features): Code Cleanup. I usually like to type code without caring too much about its layout and then do a quick re-format to make it align with my formatting conventions.

ReSharper formatted the specification like this:

[Concern(typeof(StringExtensions), "String testing")]
public class When_a_null_string_is_tested_to_have_a_value : String_testing_specification
{
    Establish context = () => { Sut = null; };

    It it_should_not_hold_a_value = () => HasValue.ShouldBeFalse();

    Because of = () => HasValue = Sut.HasValue();
}

The code structure should follow order in which the specification is run, like so:

[Concern(typeof(StringExtensions), "String testing")]
public class When_a_null_string_is_tested_to_have_a_value : String_testing_specification
{
    Establish context = () => { Sut = null; };

    Because of = () => HasValue = Sut.HasValue();

    It it_should_not_hold_a_value = () => HasValue.ShouldBeFalse();
}

Luckily, ReSharper supports defining a custom type member layout to control in which order members are placed in a reformatted code file. Just add the following lines to ReSharper/Options/Languages/C#/Type Members Layout (uncheck "Use Default Patterns"), under the Patterns element:

<!-- Order Machine.Specifications methods: Members, Establish, Cleanup, Because, It -->
<Pattern>
    <Match>
        <And Weight="100">
            <Kind Is="class"/>
            <HasAttribute CLRName="Machine.Specifications.ConcernAttribute"
                          Inherit="true"/>
        </And>
    </Match>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Or>
                    <Access Is="protected"/>
                    <Static/>
                </Or>
            </And>
        </Match>
    </Entry>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Name Is="context_once"
                      IgnoreCase="true"/>
            </And>
        </Match>
    </Entry>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Name Is="context"
                      IgnoreCase="true"/>
            </And>
        </Match>
    </Entry>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Name Is="after_each"
                      IgnoreCase="true"/>
            </And>
        </Match>
    </Entry>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Name Is="after_all"
                      IgnoreCase="true"/>
            </And>
        </Match>
    </Entry>
    <Entry>
        <Match>
            <And>
                <Kind Is="field"/>
                <Name Is="of"
                      IgnoreCase="true"/>
            </And>
        </Match>
    </Entry>
    <!--All other members-->
    <Entry/>
</Pattern>

Rezept: Rucola mit warmen Birnen und Blauschimmelkäse

Posted in Recipes (German) at Sunday, 14 September 2008 15:07 W. Europe Daylight Time
  • pro Person 1 große mittelreife Birne
  • Rucola
  • Feldsalat
  • Blauschimmelkäse
  • Butter
  • Koriandersamen
  • Balsamico
  • brauner Zucker

Die Salate waschen, putzen und auf einem Teller gleichmäßig verteilen. Den Blauschimmelkäse in kleine Würfel schneiden und gleichmäßig auf dem Salatbett anrichten. Die Birnen schälen, entkernen und vierteln. 2-3 EL Butter in einer beschichteten Pfanne zerlassen und die Birnen hineingeben. Mit etwas Zucker bestreuen und von jeder Seite vorsichtig anbraten bis sie leicht braun werden. Vor dem Wenden auf die letzten Seite 2 TL grob zermörserten Koriander darüberstreuen. Im Anschluss mit einem kräftigen Schuss Balsamico ablöschen und einkochen bis das Essigaroma fast verflogen ist und sich eine dicke, dunkle und kräftig-süße Soße gebildet hat.

Die gebratenen Birnen auf dem Teller anrichten und die heiße Balsamico-Soße über den Birnen und den Käsestückchen verteilen.

Rezept: Orangensuppe

Posted in Recipes (German) at Friday, 12 September 2008 15:24 W. Europe Daylight Time

Zutaten für 6 Personen:

  • 220g Hartweizengries
  • 2 Eier
  • 1/2 l Milch
  • 2 EL Zucker
  • eine Prise Salz
  • 1 Vanilleschote
  • 1 l Orangensaft
  • 1/2 l lieblicher Weißwein
  • Soßenbinder (hell) oder Mehl zum Andicken
  • 4-5 Orangen

Die Milch mit einer Prise Salz, dem Zucker und dem Mark der Vanillaschote kurz aufkochen. Den Gries einrühren bis eine feste Masse entsteht und abkühlen lassen. Anschließend die Eier mit dem Knethaken einrühren. Salzwasser in einem Topf aufkochen. Mit zwei Teelöffeln kleine Klöschen aus der Griesmasse ausstechen und in das Wasser geben. 10-15 Minuten ziehen lassen bis die Klöschen oben schwimmen.

Während die Griesmasse abkühlt: Orangen filetieren (Schale abschneiden, dann das Fruchtfleisch mit einem scharfen Messer herauslösen). Orangensaft und Weißwein in einem Topf aufkochen und andicken.

Zum Servieren die Suppe auf einen Teller geben, dazu 4-5 Griesklöschen und ein paar Orangenfilets obenauf.

Good Deed For The Day

Posted in NonTech at Friday, 12 September 2008 15:10 W. Europe Daylight Time

Over the last couple of months I read Peopleware by Tom DeMarco and Timothy Lister (yeah, I know, I'm a slow reader). Peopleware is a book focusing on the human issues of software development, not the technical ones. The book is an excellent read, stuffed with little anecdotes from the authors' past experience with their clients. It has been very influential to me with regards to thinking about my workplace and the things we could do to become a better team (the authors call these "jelled" teams). I also found ideas for a couple of questions I will definitely ask at my next job interview. (I'm not looking for a new employer, BTW.)

Even though Peopleware is not a technical book per se, I strongly encourage you, dear reader, to buy a copy for yourself. The key takeaways will not only help you become a better developer in terms of communication skills, but will also make your life easier once you make the transition into project management. Not only then you would want to make sure your colleagues work in a great environment that actually makes them more productive.

As Ed Yourdon suggests on the back cover, you should not only read the book yourself, but rather buy a copy for your boss. That's exactly what I did today, along with a note from us developers:

Peopleware