Friday, November 26, 2010

TextGen v0.2 released: COM interop

Recently I released TextGen v0.2 on CodePlex.

There are two major things added to this version:

Interface for COM Clients

TextGen now provides an interface for the usage by COM clients.

Since the original public API is partially based on generics, the API exposed to COM had to provide different methods for those parts.

To get started with the API visible to COM, please refer to the Access demo file that is included in the package. Shell scripts to create and register/unregister the TypeLib are included.

Download Package

With v0.2 a zip-file with all necessary files is available. So there’s no need to compile yourself. Just use TextGen from your application.

Have fun and provide feedback!

Thursday, November 25, 2010

Podcast “Anwendungsentwicklung mit WPF” veröffentlicht

(This is a German post since it is about a podcast in German language.)

Mein Arbeitgeber TechTalk bietet unter dem Titel “On TechTalk’s Mind” eine Serie von Podcasts an.

Es freut mich, dass ich den dritten in dieser Serie veröffentlichten Podcast zum Thema “Anwendungsentwicklung mit der Windows Presentation Foundation” ankündigen darf.

In dieser Folge spreche ich mit meiner Kollegin Claudia Oster, Usability-Expertin bei TechTalk und mit meinem Kollegen Stephan Zehetner über die Auswirkungen des Einsatzes von WPF auf das Zusammenspiel zwischen Usability-Experten, Designern und Entwicklern in einem großen Softwareentwicklungs-Projekt. Wir sprechen darüber ob die mit WPF wieder einmal versprochene Trennung dieser Aspekte der Anwendungsentwicklung nun tatsächlich funktioniert.

Die Vorbereitung, Durchführung und Nachbearbeitung dieses Podcasts waren sehr spannend und haben großen Spaß gemacht. Ich habe viel Zeit und Energie hineingesteckt, aber auch sehr viel gelernt.

Die nächste Folge ist in Vorbereitung!

Workshop “Testen in Access”

(This post is in German since it is about a workshop held in German)

Nach meinen Vorträgen zum Thema “Pragmatisches Testen in Access” auf der diesjährigen AEK freut es mich auch einen Workshop zum Thema “Testen in Access” anbieten zu können.

Dieser Workshop findet am 26./27. Jänner 2011 in Hannover statt.

Themen:

  • Grobüberblick UnitTesting/TDD
  • Anwendung testbar machen
  • Was konkret testen?
  • Wie testen?
  • Wie Änderungen implementieren?
  • Features von AccUnit
  • Details und Anmeldung sind hier möglich: http://www.techtalk.at/About-us/News/Events/Workshop--Testen-in-Access.aspx

    Message from MSTest: No tests were run because no tests are loaded or the selected tests are disabled.

    Today, MSTest annoyed me again, as it did once before (see the post Message in Visual Studio 2010: Changes to your tests are no longer automatically displayed).

    When running the test-suite of TextGen, I discovered, that one test was not run at all.

    The test seemed to be ok. Neither the test class nor the test method were ignored:

    TestClass with TestMethod, both not ignored

    But when I tried to execute the test, Visual Studio issued the following message, and the test was not run:

    Message "No tests were run because no tests are loaded or the selected tests are disabled."

    Message from MSTest: “No tests were run because no tests are loaded or the selected tests are disabled.”

    I did not understand that and Google did not provide any satisfactory answers, just some conjectures.

    So I played around a bit: If I changed just a single character of the method’s name, MSTest executed the test again. If I renamed that test, but added a new test method with the name in question, it resulted in the same message.

    Thus, it’s all about the test method’s name!

    Somewhere it must be stored that a test method with that name shall be treated as disabled. Smells like test run configuration, which sounds like the vsmdi-file in the context of MSTest. Doubleclicking my vsmdi-file showed me a list of all my tests (“test list”) – and my test was shown in gray:

    Test shown in gray in MSTest's test list

    But why that?

    Now the path left to go was not all too long: Inspecting the properties of the test revealed the guilty, the test was disabled:

    Property TestEnabled set to false

    I’ve had no idea why this property was set to false, since I was not aware of it’s very existence, but that was the reason.

    Again – easy if you know. But one can fall into despair, when you just want to run your neat little test but you can’t.

    BTW, ReSharper-test runner for MSTest ran the test nevertheless. But – test first is much faster with the native MSTest test runner.

    Tuesday, November 16, 2010

    TextGen 0.1 released

    It is a pleasure to announce that recently I released version 0.1 of TextGen – Another Template Based Text Generator on CodePlex (textgen.codeplex.com).

    The main impetus for TextGen was the need to have a library for doing code generation as simple as possible. Since I didn’t like very much what I saw with things like T4, I decided to write my own library.

    For the moment it is feature rich enough to provide template based generation of simple classes (a UnitTest for a VB6 class module is included in the sources).

    Apropos UnitTests: I did the project almost strictly test-first. “Almost” because there are for example getters in Exception-classes that I wrote (or better: let ReSharper generate for me) because I wanted to have them and that are so trivial to be almost tested by inspection (just kidding).

    I will provide additional information in the future. But for now, that’s it for the very first announcement.

    Have fun (and give feedback)!

    Tuesday, October 26, 2010

    PDF-Export in PowerPoint 2010: Beware of accessibility Option!

    In Office 2010, the export to PDF is included out-of-the-box simply via the Save as feature.

    That’s nice and neat, but be aware that by default, the resulting PDF is enhanced by accessibility tags. These tags may result in unwanted tooltip windows on hovering an image in Adobe Reader:

    PDF with tooltips for images

    You can overcome this by invoking the Options dialog directly from the Save as dialog:

    PowerPoint SaveAs Dialog: Options-Button

    Here you can deselect the corresponding option:

    PowerPoint PDF export option for accessibility

    Unfortunately this has to be done before every export.

    Sunday, October 17, 2010

    Four simple Things to please your Audience when Presenting with Code

    If you have to show source code in a presentation, there are a few easy things you can do to improve your audience’s experience:

    Use a larger Font

    It’s obvious that for many people reading source code presented with a font size of 10 Pt might be a problem. In mid to large size rooms it will be next to impossible for many of your listeners to decipher it.

    Visual Studio 2010 with default font

    Visual Studio 2010 with default font

    In my presentation when showing source code directly from some IDE, I use a font size of 14 Pt. Even with large rooms there never was a problem with that size.

    Visual Studio 2010 with font in 14pt

    Visual Studio 2010 with font in 14pt

    Set you Selection Back color to yellow

    A typical mistake with novice presenters is to select portions of source when they want to emphasize on that code. What works well on the laptop’s screen turns out to be even counterproductive. For the audience, the typical white letters on darkblue background just produce an unreadable mess of pixels.

    Visual Basic for Applications IDE with selected text in default color scheme

    Visual Basic for Applications IDE with selected text in default color scheme

    When recently watching some video of Roy Osherove I had a real epiphany: when he showed sourcecode in Visual Studio, he highlighted it with a bright yellow background. Not only does this not infer the readability of the code. Moreover it is rather intuitive since we are used to that textmarker-like effect.

    Visual Basic for Applications IDE with selected text with yellow textmarker-like selection color

    Visual Basic for Applications IDE with selected text with yellow textmarker-like selection color

    Hide unneeded Tools

    Modern IDEs provide a vast amount of features and tools resulting in a number of toolwindows and commandbars. For the purpose of the demo you are doing just a few of the toolwindows in your IDE may be really needed.

    Visual Studio 2010 with many open tool windows

    Visual Studio 2010 with many open tool windows

    Thus, just hide them so that your audience can focus the code you’re showing. I recommend not just to collapse the unneeded tools – also hide the tool’s tabs.

     

     

    Visual Studio 2010 with almost no tool windows

    Visual Studio 2010 with almost no tool windows

    Use Full Screen Mode

    Even after hiding the tool windows there remains a lot of clutter consuming screen real estate, such as the commandbars. If you feel the need to remove that distraction as well, your IDE may provide some full screen mode.

    In Visual Studio you can enter the full screen mode by pressing Ctrl+Alt+Enter.

    Visual Studio 2010 in full screen mode

    Visual Studio 2010 in full screen mode

    I hope I could show you that even when presenting with code directly from you IDE, the usability of your demo can be greatly advanced by considering simple tips.

    Saturday, October 16, 2010

    Commenting with ReSharper 5 and Visual Studio 2010

    No doubt, ReSharper is great. ReSharper 5 for with Visual Studio 2010 is even greater.

    Unfortunately with the new default keyboard shortcuts in ReSharper 5 at least one convenient shortcut has been changed.

    In previous versions of ReSharper, by pressing Ctrl+7 (not the function key F7!)  the current line (or lines if several were selected) have been commented out using the double slash single line comment. If the selected lines already were commented out, that slashes had been removed.

    Bookmarking overruled commenting

    With ReSharper 5 by default the shortcut Ctrl+7 is assigned to a new feature – bookmarking. To go to a specific numbered bookmark you now can press any the keys 0 to 9 while holding down the Ctrl-key.

    So when you first try to use your line commenting feature by pressing Ctrl+7 as you’ve grown accustomed to, you will get that annoying hint:

    Could not go to bookmark #7. Bookmark is not set.

    Could not go to bookmark #7. Bookmark is not set.

    If you’re like me you’ll probably like to change that shortcut back to the function it provided with earlier version of ReSharper.

    Changing Visual Studio’s keyboard shortcuts

    Thanks to Visual Studios extensibility model all the keyboard shortcuts, even those provided by third party addins such as ReSharper, can be manipulated in Visual Studio’s dedicated dialog.

    You can open that dialog via Tools – Options – Keyboard:

    Visual Studio's options dialog with selection of "Keyboard"-section

    If you want to see what commands currently are assigned to a specific keyboard-shortcut, you simple have to set the focus to the textbox labeled “Press shortcut keys:”

    image

    Here you see the guilty, the command ReSharper_Bookmarks_GoToBookmark7. Now you might think it should be straight forward to reassign that shortcut to our beloved line comment feature.

    But – before you get frustrated mind the following: the currently assigned command is not displayed in a simple textbox, but in a combobox. That gives us the hint that in Visual Studio a single shortcut can be applied to several commands. That means that just assigning another command to a shortcut will in general not replace the old assignment, but add to it.

    This feature does make sense to assign a shortcut to several specific commands depending on the context that shortcut is used. That context can be specified by selecting an entry in the drop down “Use new shortcut in:”. By default the entry “Global” is used indicating that the shortcut applies to all kinds of editors, be it text or graphical editors. For example with selecting the proper entry you can constrain the assignment of a shortcut to a specific command for the use in some special editor as the editor for UML activity diagrams, the XML schema designer or just the text editor.

    Step by step instructions

    So let’s go back to our original intention, restoring the shortcut Ctrl+7 to ReSharper line comment feature:

    1. Remove the current assignment
      1. Find the name of the currently assigned command
        Press the shortcut while the focus is on the field “Press shortcut keys:” (Ctrl+7). The current shortcut assignments are shown in “Shortcut currently used by:”
      2. Select the currently assigned command in the command list
        Select the command in the command list (ReSharper_Bookmarks_GoToBookmark7 in our case). You might want to use the filter text box to narrow-down the list (for example “rk7”).
      3. Select the shortcut to remove
        In the dropdown “Shortcuts for selected command:” select the command you want to remove.
        In our case this is “Ctrl+7 (Global)”
      4. Remove the assignment
        Press the button labeled “Remove”
    2. Add the new assignment
      1. Select the command to be assigned in the command list
        In our case this is “ReSharper.ReSharper_LineComment”. Use “comment” for filtering to find that entry quicker.
      2. Assign the command to the shortcut key
        Make sure the desired shortcut (Ctrl+7 for our case) is still shown in “Press shortcut keys:” and klick the button labeled “Assign”

    Hope that helps some needy soul in despair. :)

    Sunday, September 12, 2010

    About the Value of controlling Word Wrap in a Presentation

    When you create a presentation you want to transport your message as good as possible. On the places where you use text for that purpose it is worth thinking of the graphical layout of your text.

    Say you are have a presentation with the title "Pragmatic Testing of Legacy Applications". Depending on the font size this title may be too long to fit on a single line. Surely, your presentation software will wrap the text to fit to the space you have to devoted to the title of the presentation.

    So, why care?

    There are good chances that your title will be wrapped like this:

    Fine. No?

    If the text box for the title is smaller, the text may be wrapped like this:

    Is fine as well, so why would you want to think more about that?

    Let's see what the difference is.

    To dive into that, you have to be aware of the three parts of the sentence "Pragmatic Testing of Legacy Applications":

    • The first part "Pragmatic Testing" is the main part. It's all about testing in a pragmatic way.

    • The third part "Legacy Applications" determines the specific emphasis of that talk. It's not about testing in well set up project, but about testing in some sub-optimal (or maybe completely ugly) context.

    • The second part, the little word "of" inbetween the two main parts does not really convey information one would not grasp without it. From what we are interested in, you may consider it as some necessary linguistic glue.

    If you compare the visual appearance of the two alternative wrappings, you may get the impression that "of" detoriates that main part of the text it is sharing the line with. But what that also implies is much more important: it leaves the other main part unpolluted, giving it more focus:

    Thus, the first version emphasises the pragmatic testing aspect of the title:


    The second version on the other hand puts more focus on the fact that the talk is dealing with legacy application with some respect:


    You don't care about that all? You think that's just all equal? Leave a comment and let's discuss it!

    My battery recreated well while asleep

    Wow! That minute I was impressed how well the battery recreated while my Lenovo notebook was asleep over night:


    And it even feels about being able to be double this impressive time!

    But, unfortunately, that lasted just a few seconds after wakeup.... ;)

    Wednesday, September 1, 2010

    Message in Visual Studio 2010: Changes to your tests are no longer automatically displayed

    Today I had one of these dispensable experiences when working with computers. Things that I've had done again and again before, and knew they usually work, showed weird results.

    Every time I made a change in a test (MSTest) in Visual Studio 2010, a message box popped up:

    Changes to your tests are no longer automatically displayed. Click Refresh to display your changes in the Test View or Test List Editor.

    Yes, thanks. But - why? I've changed tests many times before, but that message was totally new to me.

    Additionally, in Test View a new message showed up in the notification area:

    Changes were made to the tests, click Refresh to update.

    Every time I pressed the Refresh button, the solution was built but the list of tests in the Test View did not always refresh properly.

    Moreover, the testrunner in my beloved ReSharper failed on running new unit tests:


    That showed the direction to the problem: the new test was written, but the testrunner can't find it? Well, then the test did not make it from the code to the assembly. Looks as if the assembly has not been built properly.

    The reason

    Looking into the current configuration unveiled the reason: the test project was not configured to be included in the build for the current configuration. So, I could type as many tests I wanted, they never made it to the assembly to be actually run.

    The solution

    Now the solution was easy. I just had to configure the current configuration to also build the test project.

    For that call the configuration manager:

    and check the Build checkbox for the test project.


    Since I could not find anything on the web regarding that topic, I hope this post can help some desperate minds.