September 27, 2018

Resources for Exceptions in .NET

  —Exceptions in .NET and C#

Some resources for exception handling in .NET:

ADVANCED EXCEPTIONS IN .NET nice, recent introduction to the exeption handling mechanisms in the CLR. References Handling and throwing exceptions in .NET.

ECMA C# and Common Language Infrastructure Standards. Exceptions are discussed in:

  • ECMA-334 defines the standard exception classes and when they are thrown. It also includes a description of the try-catch mechanism used by the language.
  • ECMA-335 defines the exception handling model used by the CLR.

Collecting User-Mode Dumps defines a registry key to enable application dumps.

Application Recovery and Restart defines a mechanism for collecting application information on unhandled exceptions. It is intended for C and C++ developers.

Capturing unhandled exceptions in a mixed native/CLR environment discusses how to manage unhandled exceptions in the CLR and native code.

Tools for Exploring .NET Internalsr: curated list of resources for debugging .NET applications.

September 21, 2018

Global Warming and Climate Change

  —What's the difference between global warming and climate change?

During a conversation about the weather with a colleague I mentioned global warming. They immediately corrected me, stating we were experiencing climate change.

Since that conversation, I’ve worried about my understanding of these terms and gotten a glimpse how words can shape our thinking.

By shifting the conversation from global warming to climate change my colleague attempt to reframe the conversation in a way that presented recent weather patterns as a natural phenomena.

The difference between these two terms is embedded in whether humanity has some responsibility for the change in climate.

Turning to Wikipedia:

Climate change is a change in the statistical distribution of weather patterns when that change lasts for an extended period of time (i.e., decades to millions of years). Climate change may refer to a change in average weather conditions, or in the time variation of weather around longer-term average conditions (i.e., more or fewer extreme weather events). Climate change is caused by factors such as biotic processes, variations in solar radiation received by Earth, plate tectonics, and volcanic eruptions. Certain human activities have also been identified as significant causes of recent climate change, often referred to as global warming.

It looks like global warming is attributed to human activity and contributes to climate change, but climate change is not entirely the result of human activity.

In my colleague’s mind, the temperature increases over the last 18 months are a change in average and longer-term average weather conditions.

In effect, I associate new weather patterns with human activity. My colleague much less so (perhaps, not at all).

I don’t know what scares me more:

  • accepting that humans can’t influence global warming, or
  • that people think these trends are a natural phenomena.

Only time will tell.

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.