August 29, 2018

Microsoft's Structured and Vectored Exception Handling

  —Structured exception handling mechanisms.

Structured exception handling is a mechanism for handling both hardware and software exceptions. The key advantage of SEH is that is allows the programmer to treat all exceptions in an uniform manner.

Vectored Exception Handling (VEH) is an extension to structured exception handling. The key advantage of VEH is that is allows the programmer to register one or more handlers in an application.

An exception is an event that occurs during the execution of a program, and requires the execution of code outside the normal flow of control. There are two types of exceptions.

  • Hardware exceptions are initiated by the CPU.
  • Software exceptions are initiated explicitly by applications or the operating system. That is, user- and kernel-mode exceptions.

An exception can be continuable or noncontinuable. A noncontinuable exception arises when the event is not continuable in the hardware, or if continuation makes no sense. A noncontinuable exception does not terminate the application.

Structured Exception Handling

The Microsoft C/C++ Optimizing Compiler provides the following keywords:

  • __try keyword that identifies a guarded body of code. This statement identifies a guarded body of code.

  • __except keyword that identifies an exception handler. This statement identifies a filter expression.

  • __finally keyword that identifies a termination handler. This statement identifes code that is always executed whenever the flow of control leaves a guarded body of code, regardless of whether the guarded body terminated normally or abnormally.

These keywords are for frame-based exceptions. A frame-based exception handler allows you to deal with the possibility that an exception may occur in a certain sequence of code. It consists of the following elements.

  • A guarded body of code. The guarded body of code is a set of one or more statements for which the filter expression and the exception-handler block provide exception-handling protection. The Microsoft C/C++ Optimizing Compiler, a guarded body is enclosed by braces ({}) following the __try keyword.

  • A filter expression. The filter expression of a frame-based exception handler is an expression that is evaluated by the system when an exception occurs within the guarded body.

  • An exception-handler block. With an exception-handler block, in contrast, execution continues sequentially from the exception handler rather than from the point of the exception.

__try
{
// guarded code
}
__except ( filter_expression )
{
// exception handler code
}
__finally
{
// termination code that is always executed when flow of control exits the guarded code
}

A filter expression has the following effect.

  • The system stops its search for an exception handler, restores the machine state, and continues thread execution at the point at which the exception occurred.
  • The system continues its search for an exception handler.
  • The system transfers control to the exception handler, and thread execution continues sequentially in the stack frame in which the exception handler is found.

Vectored Exception Handling

Vectored exception handlers are an extension to structured exception handling. An application can register a function to watch or handle all exceptions for the application. Vectored handlers are not frame-based, therefore, you can add a handler that will be called regardless of where you are in a call frame.

References

August 23, 2018

Blogging using GNU Emacs, Org-Mode and Jekyll

  —Remedies for gotcha's with GNU Emacs, Org-Mode and Jekyll.

Remedies for gotcha’s encountered while setting up Org-Mode and Jekyll.

Performed on a Mid-2013 MacBook Pro (OS X El Captain 10.11.6).

Steps

  1. Install RVM.

    Install script obtained from Secure Installation.

    Validate RVM installation.

    Error: shell_session_update: command not found

    Remedy: Install RVM from HEAD. See /bin/bash: shell_session_update: command not found #210.

  2. Install Jekyll.

    https://jekyllrb.com/docs/installation/

    Install Ruby Gems after using RVM to set up Ruby blogging environment. Doing so ensures that gem update --system does not affect the Ruby installation installed by Apple.

  3. Install MacPorts nodejs6.

  4. Setup a Python Virtual Environment for the blog.

    Not necessary, but I like to keep my Python environments separate.

  5. Install Jekyll.

    Used ‘gem install jekyll’.

  6. Using org to Blog with Jekyll

    Error: org-publish-org-to-html is nil

    Remedy: Change org-publish-org-to-html to org-html-publish-to-html.

  7. In Emacs, type C-c C-e P x. Prepares my blog entries for use by Jekyll.

  8. Install a theme. I choose the Jekyll-Clean theme.

  9. Run

    jekyll serve –baseurl=’’

Tool Chain

  • RVM rvm 1.27.0 (master)
  • Ruby ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
  • Ruby Gems:
    • bigdecimal (default: 1.2.8)
    • bundler-unload (1.0.2)
    • colorator (1.1.0)
    • did_you_mean (1.0.0)
    • executable-hooks (1.3.2)
    • ffi (1.9.14)
    • forwardable-extended (2.6.0)
    • gem-wrappers (1.2.7)
    • io-console (default: 0.4.5)
    • jekyll (3.2.1)
    • jekyll-sass-converter (1.4.0)
    • jekyll-watch (1.5.0)
    • json (default: 1.8.3)
    • kramdown (1.12.0)
    • liquid (3.0.6)
    • listen (3.0.8)
    • mercenary (0.3.6)
    • minitest (5.8.3)
    • net-telnet (0.1.1)
    • pathutil (0.14.0)
    • power_assert (0.2.6)
    • psych (default: 2.0.17)
    • rake (10.4.2)
    • rb-fsevent (0.9.7)
    • rb-inotify (0.9.7)
    • rdoc (default: 4.2.1)
    • rouge (1.11.1)
    • rubygems-bundler (1.4.4)
    • rubygems-update (2.6.6)
    • rvm (1.11.3.9)
    • safe_yaml (1.0.4)
    • sass (3.4.22)
    • test-unit (3.1.5)
  • Node.js 6.5.0
  • GNU Emacs 24.5
  • GNU Emacs’ Org-Mode 20160905

August 21, 2018

Is Your Team Self-Organizing?

  —A test for self-organization.

In Self-Organizing Teams for the Rest of Us (Another Look), I discuss why I prefer the definition of self-directed team over self-organizing team. A self-directed team embodies my notion of a good team much better because its more concrete.

Is your team self organized? explores the question of self-organization from the team’s perspective. It proposes

If you really want to test if your team is self-organized, simply remove the Scrum Master from the team and you will see what their level is.

I’m not sure I like this proposal. It may not even be the correct question to ask.

If you view a team as a complex adaptive system, then changing the behaviour of this system requires changing one of the conversation, responsibilities or people. This proposal changes all three. That seems problematic in terms of an experiment. Can this be done differently and with better effect?

Let’s ignore changing people. I’ve discussed what I like in a Scrum Master:

A good team dynamic is too important to risk a change to the Scrum Master.

I prefer changing the conversation or responsibilities. Neither of which involves the removal of the Scrum Master.

If you change responsibilties, even subtly, your team will pick up those responsibilities if they deem them important to continue. This is a key characteristic of self-organization: let people figure out what they need to do to accomplish the job. That’s a better result for the entire organization.

So, is your team self-organizing? I’ll posit that whether your team is self-organzing or not is irrelevant.

The fact is that your team is at the level of self-organization that it’s at. Accept this. Move on. Seek ways to improve their level of self-organization but don’t get hung up on it. Effective teams don’t need to be self-organizing and they self-organize at different levels.

July 31, 2018

The Daily Stand Up

  —Developing positive communication patterns.

The software team I work with had a long discussion on poor communication habits. The team shows up to stand up pretty much on time every day. Attendance is good. People talk.

The issue with communication fell into two main categories: we aren’t getting the information we need and there are pockets of communication we aren’t privy too.

In the first example, not getting information we need, it turns out that the people doing the talking weren’t answering the questions people had. To make matters worse, the people listening weren’t asking questions. There is no winning in this situation. Turns out that people felt entitled to information but not responsible for asking for it and sharing what they knew.

Ask questions was my response. Hold each other to a higher standard of communication. If someone says they were in meeting but doesn’t elaborate, ask what the meeting was about.

In the second example, side conversations developed on topics of interest to individuals. These conversations were valuable to the individuals involved but didn’t promote communication in the team. The people asking questions during these conversations got answers but didn’t bring the answers back to the team.

Stop siloing conversations was my response. Move these conversations into the stand up so others can hear the question and the answer.

Then things got interesting. We have only a minute for our stand up, they said. Huddle after stand up I respond.

A huddle is a conversation involving interested parties that occurs after the stand up. I like to organize my stand up so that we action huddles, including the people who want to participate in them immediately after the stand up ends. The idea of the huddle is that it gets people out of the stand up who have something more important to do while permiting indepth conversation on topics relevant to the work we are doing.

In my opinion, getting meaningful communication to occur in the stand up is critical to its success. Changing team communication patterns so that communication goes through the stand up in a meaningful way is paramount to making the stand up useful to everyone.

July 25, 2018

Emacs Org-Mode Doesn't Generate Images

  —A remedy to get Emacs to generate images in Org-Mode.

I've recently installed org-mode into my Emacs editor and ran into a problem. I wanted to generate an equation and view it using LaTeX preview mode. No luck.

Initially, what I was presented with in Org-Mode was an empty box where the equation should have been. My *Messages* buffer showed the following.


Wrote /Users/brian/Desktop/Notebooks/temp/foo.org
Creating images for section...
Failed to create dvi file from /var/folders/0l/75r2j43x6f1_5k3l9st73j480000gq/T/orgtex19727pJV.tex
Creating images for section...done
Unable to load image (image :type png :file /Users/brian/Desktop/Notebooks/temp/ltxpng/foo_057ff709818f1d42b80c9f41f8ebc70d5d4bb806.png :ascent center) [16 times]
Cool. DVI file failed to be created. But why?

Manually building the above LaTeX file yielded another hint:
! LaTeX Error: File `ulem.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Cool. A missing package.

Installed texlive using MacPorts. Problem solved.