text:
require "google-cloud-debugger"
require "google/cloud/debugger/project"
require "google/cloud/config"
require "google/cloud/env"
require "stackdriver/core"

module Google
  module Cloud
    ##
    # # Stackdriver Debugger
    #
    # Stackdriver Debugger is a feature of the Google Cloud Platform that lets
    # you inspect the state of an application at any code location without using
    # logging statements and without stopping or slowing down your applications.
    # Your users are not impacted during debugging. Using the production
    # debugger you can capture the local variables and call stack and link it
    # back to a specific line location in your source code. You can use this to
    # analyze the production state of your application and understand the
    # behavior of your code in production.
    #
    # See {file:OVERVIEW.md Debugger Overview}.
    #
    module Debugger
      # rubocop:disable all

      ##
      # Creates a new debugger object for instrumenting Stackdriver Debugger for
      # an application. Each call creates a new debugger agent with independent
      # connection service.
      #
      # For more information on connecting to Google Cloud see the
      # {file:AUTHENTICATION.md Authentication Guide}.
      #
      # @param [String] project_id Project identifier for the Stackdriver
      #   Debugger service you are connecting to. If not present, the default
      #   project for the credentials is used.
      # @param [String, Hash, Google::Auth::Credentials] credentials The path to
      #   the keyfile as a String, the contents of the keyfile as a Hash, or a
      #   Google::Auth::Credentials object. (See {Debugger::Credentials})
      # @param [String] service_name Name for the debuggee application.
      #   Optional.
      # @param [String] service_version Version identifier for the debuggee
      #   application. Optional.
      # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
      #   the set of resources and operations that the connection can access.
      #   See [Using OAuth 2.0 to Access Google
      #   APIs](https://developers.google.com/identity/protocols/OAuth2).
      #
      #   The default scope is:
      #
      #   * `https://www.googleapis.com/auth/cloud_debugger`
      #   * `https://www.googleapis.com/auth/logging.admin`
      #
      # @param [Integer] timeout Default timeout to use in requests. Optional.
      # @param [Hash] client_config A hash of values to override the default
      #   behavior of the API client. Optional.
      # @param [String] project Project identifier for the Stackdriver Debugger
      #   service.
      # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud:
      #   either the JSON data or the path to a readable file.
      #
      # @return [Google::Cloud::Debugger::Project]
      #
      # @example
      #   require "google/cloud/debugger"
      #
      #   debugger = Google::Cloud::Debugger.new
      #   debugger.start
      #
      def self.new project_id: nil, credentials: nil, service_name: nil,
                   service_version: nil, scope: nil, timeout: nil,
                   client_config: nil, project: nil, keyfile: nil
        project_id ||= (project || default_project_id)
        project_id = project_id.to_s # Always cast to a string

        service_name ||= default_service_name
        service_name = service_name.to_s

        service_version ||= default_service_version
        service_version = service_version.to_s

        raise ArgumentError, "project_id is missing" if project_id.empty?
        raise ArgumentError, "service_name is missing" if service_name.empty?
        if service_version.nil?
          raise ArgumentError, "service_version is missing"
        end

        scope ||= configure.scope
        timeout ||= configure.timeout
        client_config ||= configure.client_config

        credentials ||= (keyfile || default_credentials(scope: scope))
        unless credentials.is_a? Google::Auth::Credentials
          credentials = Debugger::Credentials.new credentials, scope: scope
        end

        Debugger::Project.new(
          Debugger::Service.new(project_id, credentials,
                                timeout: timeout, client_config: client_config),
          service_name: service_name,
          service_version: service_version
        )
      end

      # rubocop:enable all

      ##
      # Configure the Stackdriver Debugger agent.
      #
      # The following Stackdriver Debugger configuration parameters are
      # supported:
      #
      # * `project_id` - (String) Project identifier for the Stackdriver
      #   Debugger service you are connecting to. (The parameter `project` is
      #   considered deprecated, but may also be used.)
      # * `credentials` - (String, Hash, Google::Auth::Credentials) The path to
      #   the keyfile as a String, the contents of the keyfile as a Hash, or a
      #   Google::Auth::Credentials object. (See {Debugger::Credentials}) (The
      #   parameter `keyfile` is considered deprecated, but may also be used.)
      # * `service_name` - (String) Name for the debuggee application.
      # * `service_version` - (String) Version identifier for the debuggee
      #   application.
      # * `root` - (String) The root directory of the debuggee application as an
      #   absolute file path.
      # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
      #   the set of resources and operations that the connection can access.
      # * `timeout` - (Integer) Default timeout to use in requests.
      # * `client_config` - (Hash) A hash of values to override the default
      #   behavior of the API client.
      # * `allow_mutating_methods` - (boolean) Whether expressions and
      #   conditional breakpoints can call methods that could modify program
      #   state. Defaults to false.
      # * `evaluation_time_limit` - (Numeric) Time limit in seconds for
      #   expression evaluation. Defaults to 0.05.
      #
      # See the [Configuration
      # Guide](https://googleapis.github.io/google-cloud-ruby/docs/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION)
      # for full configuration parameters.
      #
      # @return [Google::Cloud::Config] The configuration object the
      #   Google::Cloud::Debugger module uses.
      #
      def self.configure
        yield Google::Cloud.configure.debugger if block_given?

        Google::Cloud.configure.debugger
      end

      ##
      # @private Default project.
      def self.default_project_id
        Google::Cloud.configure.debugger.project_id ||
          Google::Cloud.configure.project_id ||
          Google::Cloud.env.project_id
      end

      ##
      # @private Default service name identifier.
      def self.default_service_name
        Google::Cloud.configure.debugger.service_name ||
          Google::Cloud.configure.service_name ||
          Google::Cloud.env.app_engine_service_id ||
          "ruby-app"
      end

      ##
      # @private Default service version identifier.
      def self.default_service_version
        Google::Cloud.configure.debugger.service_version ||
          Google::Cloud.configure.service_version ||
          Google::Cloud.env.app_engine_service_version ||
          ""
      end

      ##
      # @private Default credentials.
      def self.default_credentials scope: nil
        Google::Cloud.configure.debugger.credentials ||
          Google::Cloud.configure.credentials ||
          Debugger::Credentials.default(scope: scope)
      end

      ##
      # Allow calling of potentially state-changing methods even if mutation
      # detection is configured to be active.
      #
      # Generally it is unwise to run code that may change the program state
      # (e.g. modifying instance variables or causing other side effects) in a
      # breakpoint expression, because it could change the behavior of your
      # program. However, the checks are currently quite conservative, and may
      # block code that is actually safe to run. If you are certain your
      # expression is safe to evaluate, you may use this method to disable
      # side effect checks.
      #
      # This method may be called with a block, in which case checks are
      # disabled within the block. It may also be called without a block to
      # disable side effect checks for the rest of the current expression; the
      # default setting will be restored for the next expression.
      #
      # This method may be called only from a debugger condition or expression
      # evaluation, and will throw an exception if you call it from normal
      # application code. Set the `allow_mutating_methods` configuration if you
      # want to disable the side effect checker globally for your app.
      #
      # @example Disabling side effect detection in a block
      #   # This is an expression evaluated in a debugger snapshot
      #   Google::Cloud::Debugger.allow_mutating_methods! do
      #     obj1.method_with_potential_side_effects
      #   end
      #
      # @example Disabling side effect detection for the rest of the expression
      #   # This is an expression evaluated in a debugger snapshot
      #   Google::Cloud::Debugger.allow_mutating_methods!
      #   obj1.method_with_potential_side_effects
      #   obj2.another_method_with_potential_side_effects
      #
      # @example Globally disabling side effect detection at app initialization
      #   require "google/cloud/debugger"
      #   Google::Cloud::Debugger.configure.allow_mutating_methods = true
      #
      def self.allow_mutating_methods! &block
        evaluator = Breakpoint::Evaluator.current
        if evaluator.nil?
          raise "allow_mutating_methods can be called only during evaluation"
        end
        evaluator.allow_mutating_methods!(&block)
      end
    end
  end
end


text:
namespace google_breakpad {

StackFrameSymbolizer::StackFrameSymbolizer(
    SymbolSupplier* supplier,
    SourceLineResolverInterface* resolver) : supplier_(supplier),
                                             resolver_(resolver) { }

StackFrameSymbolizer::SymbolizerResult StackFrameSymbolizer::FillSourceLineInfo(
    const CodeModules* modules,
    const SystemInfo* system_info,
    StackFrame* frame) {
  assert(frame);

  if (!modules) return ERROR;
  const CodeModule* module = modules->GetModuleForAddress(frame->instruction);
  if (!module) return ERROR;
  frame->module = module;

  if (!resolver_) return ERROR;  // no resolver.
  // If module is known to have missing symbol file, return.
  if (no_symbol_modules_.find(module->code_file()) !=
      no_symbol_modules_.end()) {
    return ERROR;
  }

  // If module is already loaded, go ahead to fill source line info and return.
  if (resolver_->HasModule(frame->module)) {
    resolver_->FillSourceLineInfo(frame);
    return NO_ERROR;
  }

  // Module needs to fetch symbol file. First check to see if supplier exists.
  if (!supplier_) {
    return ERROR;
  }

  // Start fetching symbol from supplier.
  string symbol_file;
  char* symbol_data = NULL;
  SymbolSupplier::SymbolResult symbol_result = supplier_->GetCStringSymbolData(
      module, system_info, &symbol_file, &symbol_data);

  switch (symbol_result) {
    case SymbolSupplier::FOUND: {
      bool load_success = resolver_->LoadModuleUsingMemoryBuffer(frame->module,
                                                                 symbol_data);
      if (resolver_->ShouldDeleteMemoryBufferAfterLoadModule()) {
        supplier_->FreeSymbolData(module);
      }

      if (load_success) {
        resolver_->FillSourceLineInfo(frame);
        return NO_ERROR;
      } else {
        BPLOG(ERROR) << "Failed to load symbol file in resolver.";
        no_symbol_modules_.insert(module->code_file());
        return ERROR;
      }
    }

    case SymbolSupplier::NOT_FOUND:
      no_symbol_modules_.insert(module->code_file());
      return ERROR;

    case SymbolSupplier::INTERRUPT:
      return INTERRUPT;
  }
}

WindowsFrameInfo* StackFrameSymbolizer::FindWindowsFrameInfo(
    const StackFrame* frame) {
  return resolver_ ? resolver_->FindWindowsFrameInfo(frame) : NULL;
}

CFIFrameInfo* StackFrameSymbolizer::FindCFIFrameInfo(
    const StackFrame* frame) {
  return resolver_ ? resolver_->FindCFIFrameInfo(frame) : NULL;
}

}  // namespace google_breakpad

redpajama_set_name: RedPajamaGithub


text:
My config of ubuntu/trusty64. It has
 * Emacs
 * Go
 * Docker
 * curl
 * htop
 * tmux
 * vim
already installed.

## Installation

Download and run `vagrant up`

## License

Copyright © 2014 Joey Gibson <joey@joeygibson.com>

Distributed under the MIT license.


text:
from __future__ import unicode_literals

import datetime
from django.db import migrations, models
from django.utils.timezone import utc

class Migration(migrations.Migration):

    dependencies = [
        ('smarthouse', '0002_auto_20160715_0942'),
    ]

    operations = [
        migrations.CreateModel(
            name='Sensors',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_arduino', models.CharField(max_length=50)),
                ('type', models.CharField(max_length=20)),
            ],
        ),
        migrations.AddField(
            model_name='arduino',
            name='crypto_key',
            field=models.CharField(default=datetime.datetime(2016, 7, 15, 17, 36, 57, 669859, tzinfo=utc), max_length=40),
            preserve_default=False,
        ),
    ]


text:
	premake.extensions.cmake = {}

	local cmake = premake.extensions.cmake
	local solution = premake.solution
	local project = premake.project

---
-- The CMake action, with support for the new platforms API
---

	newaction {
		trigger         = "cmake",
		shortname       = "CMake",
		description     = "Generate CMake files",

		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },

		valid_languages = { "C", "C++", "C#", "D" },

		valid_tools     = {
			cc     = { "msc", clang", "gcc" },
			dc     = { "dmd", "gdc", "ldc" },
			dotnet = { "mono", "msnet", "pnet" }
		},

		onsolution = function(sln)
			premake.escaper(cmake.esc)
			premake.generate(sln, cmake.getmakefilename(sln, false), cmake.generate_solution)
		end,

		onproject = function(prj)
			premake.escaper(cmake.esc)
			local cmakefile = cmake.getcmakefilename(prj, true)
			if project.isdotnet(prj) then
				premake.generate(prj, cmakefile, cmake.cs.generate)
			elseif project.isd(prj) then
				premake.generate(prj, cmakefile, cmake.d.generate)
			elseif project.iscpp(prj) then
				premake.generate(prj, cmakefile, cmake.cpp.generate)
			end
		end,

		oncleansolution = function(sln)
			premake.clean.file(sln, cmake.getcmakefilename(sln, false))
		end,

		oncleanproject = function(prj)
			premake.clean.file(prj, cmake.getcmakefilename(prj, true))
		end
	}

--
-- Write out the default configuration rule for a solution or project.
-- @param target
--    The solution or project object for which a cmake file is being generated.
--

	function cmake.defaultconfig(target)
		-- find the right configuration iterator function for this object
		local eachconfig = iif(target.project, project.eachconfig, solution.eachconfig)
		local iter = eachconfig(target)

		-- grab the first configuration and write the block
		local cfg = iter()
		if cfg then
			_p('ifndef config')
			_x('  config=%s', cfg.shortname)
			_p('endif')
			_p('')
		end
	end

---
-- Escape a string so it can be written to a cmake file.
---

	function cmake.esc(value)
--		result = value:gsub("\\", "\\\\")
--		result = result:gsub(" ", "\\ ")
--		result = result:gsub("%(", "\\%(")
--		result = result:gsub("%)", "\\%)")

		-- leave $(...) shell replacement sequences alone
--		result = result:gsub("$\\%((.-)\\%)", "$%(%1%)")
--		return result
		return value
	end

--
-- Get the cmake file name for a solution or a project. If this object is the
-- only one writing to a location then I can use "cmakelist.txt". If more than one object
-- writes to the same location I use name + ".???" to keep it unique.
--

	function cmake.getcmakefilename(this, searchprjs)
		local count = 0
		for sln in premake.solution.each() do
			if sln.location == this.location then
				count = count + 1
			end

			if searchprjs then
				for _, prj in ipairs(sln.projects) do
					if prj.location == this.location then
						count = count + 1
					end
				end
			end
		end

		if count == 1 then
			return "cmakelist.txt"
		else
			return ".txt"
		end
	end

--
-- Output a cmake file header.
--
-- @param target
--    The solution or project object for which the cmake file is being generated.
--

	function cmake.header(target)
		-- find the right configuration iterator function for this object
		local kind = iif(target.project, "project", "solution")

		_p('# %s %s CMake autogenerated by Premake', premake.action.current().shortname, kind)
		_p('')

		cmake.defaultconfig(target)

		_p('ifndef verbose')
		_p('  SILENT = @')
		_p('endif')
		_p('')
	end

--
-- Rules for file ops based on the shell type. Can't use defines and $@ because
-- it screws up the escaping of spaces and parethesis (anyone know a solution?)
--

	function cmake.mkdirRules(dirname)
		_p('%s:', dirname)
		_p('\t@echo Creating %s', dirname)
		_p('ifeq (posix,$(SHELLTYPE))')
		_p('\t$(SILENT) mkdir -p %s', dirname)
		_p('else')
		_p('\t$(SILENT) mkdir $(subst /,\\\\,%s)', dirname)
		_p('endif')
		_p('')
	end

--
-- Format a list of values to be safely written as part of a variable assignment.
--

	function cmake.list(value)
		if #value > 0 then
			return " " .. table.concat(value, " ")
		else
			return ""
		end
	end

--
-- Convert an arbitrary string (project name) to a cmake variable name.
--

	function cmake.tovar(value)
		value = value:gsub("[ -]", "_")
		value = value:gsub("[()]", "")
		return value
	end

---------------------------------------------------------------------------
--
-- Handlers for the individual cmake file elements that can be shared
-- between the different language projects.
--
---------------------------------------------------------------------------

	function cmake.objdir(cfg)
		_x('  OBJDIR = %s', project.getrelative(cfg.project, cfg.objdir))
	end

	function cmake.objDirRules(prj)
		cmake.mkdirRules("$(OBJDIR)")
	end

	function cmake.phonyRules(prj)
		_p('.PHONY: clean prebuild prelink')
		_p('')
	end

	function cmake.buildCmds(cfg, event)
		_p('  define %sCMDS', event:upper())
		local steps = cfg[event .. "commands"]
		local msg = cfg[event .. "message"]
		if #steps > 0 then
			msg = msg or string.format("Running %s commands", event)
			_p('\t@echo %s', msg)
			_p('\t%s', table.implode(steps, "", "", "\n\t"))
		end
		_p('  endef')
	end

	function cmake.preBuildCmds(cfg, toolset)
		cmake.buildCmds(cfg, "prebuild")
	end

	function cmake.preBuildRules(prj)
		_p('prebuild:')
		_p('\t$(PREBUILDCMDS)')
		_p('')
	end

	function cmake.preLinkCmds(cfg, toolset)
		cmake.buildCmds(cfg, "prelink")
	end

	function cmake.preLinkRules(prj)
		_p('prelink:')
		_p('\t$(PRELINKCMDS)')
		_p('')
	end

	function cmake.postBuildCmds(cfg, toolset)
		cmake.buildCmds(cfg, "postbuild")
	end

	function cmake.settings(cfg, toolset)
		if #cfg.cmakesettings > 0 then
			for _, value in ipairs(cfg.cmakesettings) do
				_p(value)
			end
		end

		local value = toolset.getcmakesettings(cfg)
		if value then
			_p(value)
		end
	end

	function cmake.shellType()
		_p('SHELLTYPE := msdos')
		_p('ifeq (,$(ComSpec)$(COMSPEC))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('')
	end

	function cmake.target(cfg)
		_x('  TARGETDIR = %s', project.getrelative(cfg.project, cfg.buildtarget.directory))
		_x('  TARGET = $(TARGETDIR)/%s', cfg.buildtarget.name)
	end

	function cmake.targetDirRules(prj)
		cmake.mkdirRules("$(TARGETDIR)")
	end


text:
package org.msgpack.util.json;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import org.msgpack.io.Output;
import org.msgpack.io.StreamOutput;
import org.msgpack.MessagePack;
import org.msgpack.MessageTypeException;
import org.msgpack.packer.Packer;
import org.msgpack.packer.AbstractPacker;
import org.msgpack.packer.PackerStack;

public class JSONPacker extends AbstractPacker {
    private static final byte[] NULL = new byte[] { 0x6e, 0x75, 0x6c, 0x6c };
    private static final byte[] TRUE = new byte[] { 0x74, 0x72, 0x75, 0x65 };
    private static final byte[] FALSE = new byte[] { 0x66, 0x61, 0x6c, 0x73, 0x65 };

    private static final byte COMMA = 0x2c;
    private static final byte COLON = 0x3a;
    private static final byte QUOTE = 0x22;
    private static final byte LEFT_BR = 0x5b;
    private static final byte RIGHT_BR = 0x5d;
    private static final byte LEFT_WN = 0x7b;
    private static final byte RIGHT_WN = 0x7d;
    private static final byte BACKSLASH = 0x5c;
    private static final byte ZERO = 0x30;

    private static final int FLAG_FIRST_ELEMENT = 0x01;
    private static final int FLAG_MAP_KEY = 0x02;
    private static final int FLAG_MAP_VALUE = 0x04;
    // private static final int FLAG_MAP = FLAG_MAP_KEY | FLAG_MAP_VALUE;

    protected final Output out;
    private int[] flags;

    private PackerStack stack = new PackerStack();
    private CharsetDecoder decoder;

    public JSONPacker(OutputStream stream) {
        this(new MessagePack(), stream);
    }

    public JSONPacker(MessagePack msgpack, OutputStream stream) {
        this(msgpack, new StreamOutput(stream));
    }

    protected JSONPacker(MessagePack msgpack, Output out) {
        super(msgpack);
        this.out = out;
        this.stack = new PackerStack();
        this.flags = new int[PackerStack.MAX_STACK_SIZE];
        this.decoder = Charset.forName("UTF-8").newDecoder()
                .onMalformedInput(CodingErrorAction.REPORT)
                .onUnmappableCharacter(CodingErrorAction.REPORT);
    }

    @Override
    protected void writeBoolean(boolean v) throws IOException {
        beginElement();
        if (v) {
            out.write(TRUE, 0, TRUE.length);
        } else {
            out.write(FALSE, 0, FALSE.length);
        }
        endElement();
    }

    @Override
    protected void writeByte(byte v) throws IOException {
        beginElement();
        byte[] b = Byte.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeShort(short v) throws IOException {
        beginElement();
        byte[] b = Short.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeInt(int v) throws IOException {
        beginElement();
        byte[] b = Integer.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeLong(long v) throws IOException {
        beginElement();
        byte[] b = Long.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeBigInteger(BigInteger v) throws IOException {
        beginElement();
        byte[] b = v.toString().getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeFloat(float v) throws IOException {
        beginElement();
        Float r = v;
        if (r.isInfinite() || r.isNaN()) {
            throw new IOException(
                    "JSONPacker doesn't support NaN and infinite float value");
        }
        byte[] b = Float.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeDouble(double v) throws IOException {
        beginElement();
        Double r = v;
        if (r.isInfinite() || r.isNaN()) {
            throw new IOException(
                    "JSONPacker doesn't support NaN and infinite float value");
        }
        byte[] b = Double.toString(v).getBytes(); // TODO optimize
        out.write(b, 0, b.length);
        endElement();
    }

    @Override
    protected void writeByteArray(byte[] b, int off, int len) throws IOException {
        beginStringElement();
        out.writeByte(QUOTE);
        escape(out, b, off, len);
        out.writeByte(QUOTE);
        endElement();
    }

    @Override
    protected void writeByteBuffer(ByteBuffer bb) throws IOException {
        beginStringElement();
        out.writeByte(QUOTE);
        int pos = bb.position();
        try {
            escape(out, bb);
        } finally {
            bb.position(pos);
        }
        out.writeByte(QUOTE);
        endElement();
    }

    @Override
    protected void writeString(String s) throws IOException {
        beginStringElement();
        out.writeByte(QUOTE);
        escape(out, s);
        out.writeByte(QUOTE);
        endElement();
    }

    @Override
    public Packer writeNil() throws IOException {
        beginElement();
        out.write(NULL, 0, NULL.length);
        endElement();
        return this;
    }

    @Override
    public Packer writeArrayBegin(int size) throws IOException {
        beginElement();
        out.writeByte(LEFT_BR);
        endElement();
        stack.pushArray(size);
        flags[stack.getDepth()] = FLAG_FIRST_ELEMENT;
        return this;
    }

    @Override
    public Packer writeArrayEnd(boolean check) throws IOException {
        if (!stack.topIsArray()) {
            throw new MessageTypeException(
                    "writeArrayEnd() is called but writeArrayBegin() is not called");
        }

        int remain = stack.getTopCount();
        if (remain > 0) {
            if (check) {
                throw new MessageTypeException(
                        "writeArrayEnd(check=true) is called but the array is not end: " + remain);
            }
            for (int i = 0; i < remain; i++) {
                writeNil();
            }
        }
        stack.pop();

        out.writeByte(RIGHT_BR);
        return this;
    }

    @Override
    public Packer writeMapBegin(int size) throws IOException {
        beginElement();
        out.writeByte(LEFT_WN);
        endElement();
        stack.pushMap(size);
        flags[stack.getDepth()] = FLAG_FIRST_ELEMENT | FLAG_MAP_KEY;
        return this;
    }

    @Override
    public Packer writeMapEnd(boolean check) throws IOException {
        if (!stack.topIsMap()) {
            throw new MessageTypeException(
                    "writeMapEnd() is called but writeMapBegin() is not called");
        }

        int remain = stack.getTopCount();
        if (remain > 0) {
            if (check) {
                throw new MessageTypeException(
                        "writeMapEnd(check=true) is called but the map is not end: " + remain);
            }
            for (int i = 0; i < remain; i++) {
                writeNil();
            }
        }
        stack.pop();

        out.writeByte(RIGHT_WN);
        return this;
    }

    @Override
    public void flush() throws IOException {
        out.flush();
    }

    @Override
    public void close() throws IOException {
        out.close();
    }

    public void reset() {
        stack.clear();
    }

    private void beginElement() throws IOException {
        int flag = flags[stack.getDepth()];
        if ((flag & FLAG_MAP_KEY) != 0) {
            throw new IOException("Key of a map must be a string in JSON");
        }
        beginStringElement();
    }

    private void beginStringElement() throws IOException {
        int flag = flags[stack.getDepth()];
        if ((flag & FLAG_MAP_VALUE) != 0) {
            out.writeByte(COLON);
        } else if (stack.getDepth() > 0 && (flag & FLAG_FIRST_ELEMENT) == 0) {
            out.writeByte(COMMA);
        }
    }

    private void endElement() throws IOException {
        int flag = flags[stack.getDepth()];
        if ((flag & FLAG_MAP_KEY) != 0) {
            flag &= ~FLAG_MAP_KEY;
            flag |= FLAG_MAP_VALUE;
        } else if ((flag & FLAG_MAP_VALUE) != 0) {
            flag &= ~FLAG_MAP_VALUE;
            flag |= FLAG_MAP_KEY;
        }
        flag &= ~FLAG_FIRST_ELEMENT;
        flags[stack.getDepth()] = flag;
        stack.reduceCount();
    }

    private void escape(Output out, byte[] b, int off, int len) throws IOException {
        escape(out, ByteBuffer.wrap(b, off, len));
    }

    private void escape(Output out, ByteBuffer bb) throws IOException {
        // TODO optimize
        String str = decoder.decode(bb).toString();
        escape(out, str);
    }

    private final static int[] ESCAPE_TABLE;
    private final static byte[] HEX_TABLE;

    static {
        ESCAPE_TABLE = new int[128];
        for (int i = 0; i < 0x20; ++i) {
            // control char
            ESCAPE_TABLE[i] = -1;
        }
        ESCAPE_TABLE['"'] = '"';
        ESCAPE_TABLE['\\'] = '\\';
        ESCAPE_TABLE[0x08] = 'b';
        ESCAPE_TABLE[0x09] = 't';
        ESCAPE_TABLE[0x0C] = 'f';
        ESCAPE_TABLE[0x0A] = 'n';
        ESCAPE_TABLE[0x0D] = 'r';

        char[] hex = "0123456789ABCDEF".toCharArray();
        HEX_TABLE = new byte[hex.length];
        for (int i = 0; i < hex.length; ++i) {
            HEX_TABLE[i] = (byte) hex[i];
        }
    }

    private static void escape(Output out, String s) throws IOException {
        byte[] tmp = new byte[] { (byte) '\\', (byte) 'u', 0, 0, 0, 0 };
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            int ch = chars[i];
            if (ch <= 0x7f) {
                int e = ESCAPE_TABLE[ch];
                if (e == 0) {
                    // ascii char
                    tmp[2] = (byte) ch;
                    out.write(tmp, 2, 1);
                } else if (e > 0) {
                    // popular control char
                    tmp[2] = BACKSLASH;
                    tmp[3] = (byte) e;
                    out.write(tmp, 2, 2);
                } else {
                    // control char uXXXXXX
                    tmp[2] = ZERO;
                    tmp[3] = ZERO;
                    tmp[4] = HEX_TABLE[ch >> 4];
                    tmp[5] = HEX_TABLE[ch & 0x0f];
                    out.write(tmp, 0, 6);
                }
            } else if (ch <= 0x7ff) {
                // 2-bytes char
                tmp[2] = (byte) (0xc0 | (ch >> 6));
                tmp[3] = (byte) (0x80 | (ch & 0x3f));
                out.write(tmp, 2, 2);
            } else if (ch >= 0xd800 && ch <= 0xdfff) {
                // surrogates
                tmp[2] = HEX_TABLE[(ch >> 12) & 0x0f];
                tmp[3] = HEX_TABLE[(ch >> 8) & 0x0f];
                tmp[4] = HEX_TABLE[(ch >> 4) & 0x0f];
                tmp[5] = HEX_TABLE[ch & 0x0f];
                out.write(tmp, 0, 6);
            } else {
                // 3-bytes char
                tmp[2] = (byte) (0xe0 | (ch >> 12));
                tmp[3] = (byte) (0x80 | ((ch >> 6) & 0x3f));
                tmp[4] = (byte) (0x80 | (ch & 0x3f));
                out.write(tmp, 2, 3);
            }
        }
    }
}


text:
class AddSomeIndexes < ActiveRecord::Migration
  def change
    add_index :taxons, :permalink
    add_index :taxons, :parent_id
    add_index :taxons, :taxonomy_id
    add_index :assets, :viewable_id
    add_index :assets, [:viewable_type, :type]
    add_index :product_properties, :product_id
    add_index :option_values_variants, [:variant_id, :option_value_id]
  end
end


text:
  type(const type&);                      \
  void operator=(const type&)

#if defined(__GNUC__) || defined(__clang__)
#define OPENFST_DEPRECATED(message) __attribute__((deprecated(message)))
#elif defined(_MSC_VER)
#define OPENFST_DEPRECATED(message) __declspec(deprecated(message))
#else
#define OPENFST_DEPRECATED(message)
#endif

// MSVC2013 doesn't support 'constexpr'
#if defined _MSC_VER && _MSC_VER < 1900
  #define FST_CONSTEXPR
#else
  #define FST_CONSTEXPR constexpr
#endif

#include <fst/config.h>
#include <fst/types.h>
#include <fst/lock.h>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/icu.h>

using std::string;

void FailedNewHandler();

namespace fst {

// Downcasting.
template<typename To, typename From>
inline To down_cast(From* f) { return static_cast<To>(f); }

// Bitcasting.
template <class Dest, class Source>
inline Dest bit_cast(const Source &source) {
  static_assert(sizeof(Dest) == sizeof(Source),
                "Bitcasting unsafe for specified types");
  Dest dest;
  memcpy(&dest, &source, sizeof(dest));
  return dest;
}

// Check sums
class CheckSummer {
 public:
  CheckSummer() : count_(0) {
    check_sum_.resize(kCheckSumLength, '\0');
  }

  void Reset() {
    count_ = 0;
    for (int i = 0; i < kCheckSumLength; ++i) check_sum_[i] = '\0';
  }

  void Update(void const *data, int size) {
    const char *p = reinterpret_cast<const char *>(data);
    for (int i = 0; i < size; ++i) {
      check_sum_[(count_++) % kCheckSumLength] ^= p[i];
    }
  }

  void Update(string const &data) {
    for (int i = 0; i < data.size(); ++i) {
      check_sum_[(count_++) % kCheckSumLength] ^= data[i];
    }
  }

  string Digest() { return check_sum_; }

 private:
  static const int kCheckSumLength = 32;
  int count_;
  string check_sum_;

  CheckSummer(const CheckSummer &) = delete;
  CheckSummer &operator=(const CheckSummer &) = delete;
};

}  // namespace fst

#endif  // FST_LIB_COMPAT_H_


text:
/* { dg-options "-Wall -funit-at-a-time -fgnu-runtime" } */
/* { dg-do compile }  */
/* PR objc/27438, make sure that the decl produced by the front-end
   does not cause a warning to be produced. */

@interface NXConstantString
{
  void *isa;
  const char * const nxcsptr;
  const unsigned int nxcslen;
}
@end
NXConstantString *a =   @"NSInconsistentArchiveException"; /* { dg-bogus "defined but not used" } */


text:
package ecommerce.sales.sharedkernel

import java.util.Currency

object Money {

  val DEFAULT_CURRENCY_CODE: String = "EUR"

  def apply(value: Double, currency: Currency): Money = {
    Money(value, currency.getCurrencyCode)
  }

  def apply(value: BigDecimal, currency: Currency): Money = {
    Money(value.doubleValue(), currency.getCurrencyCode)
  }
}

case class Money(
  doubleValue: Double,
  currencyCode: String = Currency.getInstance(Money.DEFAULT_CURRENCY_CODE).getCurrencyCode) {

  val value = round(BigDecimal(doubleValue))

  def isZero(decimal: BigDecimal): Boolean = {
    decimal == BigDecimal(0)
  }

  private def compatibleCurrency(money: Money): Boolean = {
    isZero(value) || isZero(money.value) || (currencyCode == money.currencyCode)
  }

  override def equals(obj: Any) = {
    obj match {
      case money: Money =>
        compatibleCurrency(money) && (round(value) == round(money.value))
      case _ => false
    }
  }

  def determineCurrencyCode(money: Money): Currency = {
    val resultingCurrencyCode: String = if (isZero(value)) money.currencyCode else currencyCode
    Currency.getInstance(resultingCurrencyCode)
  }

  def -(money: Money): Money = {
    this.+(Money(-money.doubleValue, money.currencyCode))
  }

  def +(money: Money): Money = {
    if (!compatibleCurrency(money)) {
      throw new IllegalArgumentException("Currency mismatch")
    }
    Money((value + money.value).doubleValue(), determineCurrencyCode(money))
  }

  def >(other: Money): Boolean = {
    value.compare(other.value) > 0
  }

  def <(other: Money): Boolean = {
    value.compare(other.value) < 0
  }

  def <=(other: Money): Boolean = {
    value.compare(other.value) <= 0
  }

  private def round(decimal: BigDecimal): BigDecimal = decimal.setScale(2, BigDecimal.RoundingMode.HALF_EVEN)

  def *(multiplier: BigDecimal) = Money((value * multiplier).doubleValue(), currencyCode)

  def getCurrency: Currency = Currency.getInstance(currencyCode)

  override def toString = {
    "%0$.2f %s".format(round(value), getCurrency.getSymbol)
  }

}


text:
require 'thor'

class NormalMap::CLI < Thor
  include Thor::Actions

  desc "generate [options] COLORS NORMALS",
       "Generates a normal map from COLORS and saves it to NORMALS"
  method_option :smooth, :type => :boolean, :default => false, :aliases => '-s', :desc => "Average adjacent pixels to produce a smoother accurate map"
  method_option :diagonal, :type => :boolean, :default => false, :aliases => '-d', :desc => "Consider diagonally-adjacent pixels in normal calculations"
  method_option :wrap, :type => :boolean, :default => false, :aliases => '-w', :desc => "Wrap edge pixels to the opposite edge, to make the map more tile-friendly"
  def generate colors_fn, normals_fn
    create_file normals_fn do
      NormalMap.new(colors_fn, options).to_blob { |f| f.format = "PNG" }
    end
  end
end


text:
    1  // comment this out if you don't have D3D11 header/library files
#define SUPPORT_D3D12 \
    0  // comment this out if you don't have D3D12 header/library files
#define SUPPORT_OPENGL_UNIFIED 0
#define SUPPORT_OPENGL_CORE 1
#define SUPPORT_VULKAN 0  // Requires Vulkan SDK to be installed
#elif UNITY_IPHONE || UNITY_ANDROID || UNITY_WEBGL
#ifndef SUPPORT_OPENGL_ES
#define SUPPORT_OPENGL_ES 1
#endif
#define SUPPORT_OPENGL_UNIFIED SUPPORT_OPENGL_ES
#ifndef SUPPORT_VULKAN
#define SUPPORT_VULKAN 0
#endif
#elif UNITY_OSX || UNITY_LINUX
#define SUPPORT_OPENGL_UNIFIED 1
#define SUPPORT_OPENGL_CORE 1
#endif

#if UNITY_IPHONE || UNITY_OSX
#define SUPPORT_METAL 1
#endif

// COM-like Release macro
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(a) \
    if (a) {            \
        a->Release();   \
        a = NULL;       \
    }
#endif


text:
<link rel="import" href="../model/ct-builder.html">
<link rel="import" href="../model/ct-builder-list.html">
<link rel="import" href="ct-builder.html">

<polymer-element name="ct-builder-grid" attributes="builderList" noscript>
  <template>
    Bots:
    <template repeat="{{ builder in builderList.builders }}">
      <ct-builder builder="{{ builder }}"></ct-builder>
    </template>
  </template>
</polymer-element>


text:
using System;
using System.Xml.Serialization;

namespace Aop.Api.Domain
{
    /// <summary>
    /// AlipayOpenPublicLabelCreateModel Data Structure.
    /// </summary>
    [Serializable]
    public class AlipayOpenPublicLabelCreateModel : AopObject
    {
        /// <summary>
        /// 标签名
        /// </summary>
        [XmlElement("name")]
        public string Name { get; set; }
    }
}


text:
// <copyright file="AuthorableExtensions.cs" company="Logikfabrik">
//   Copyright (c) 2015 anton(at)logikfabrik.se. Licensed under the MIT license.
// </copyright>

namespace Logikfabrik.Umbraco.Jet.Social
{
    using System;

    /// <summary>
    /// The <see cref="AuthorableExtensions" /> class.
    /// </summary>
    public static class AuthorableExtensions
    {
        /// <summary>
        /// Sets the author.
        /// </summary>
        /// <param name="authorable">The authorable.</param>
        /// <param name="value">The author.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="value" /> is <c>null</c>.</exception>
        public static void SetAuthor(this IAuthorable authorable, Individual.Individual value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            DataTransferObjectValidator.ThrowIfNotReadOnly(value);

            authorable.AuthorId = value.Id;
            authorable.AuthorType = value.GetType();
        }

        /// <summary>
        /// Gets the author.
        /// </summary>
        /// <param name="authorable">The authorable.</param>
        /// <returns>The author.</returns>
        public static Individual.Individual GetAuthor(this IAuthorable authorable)
        {
            return authorable.AuthorType == null
                ? null
                : GetAuthor(authorable, DataTransferObjectProviders.GetProvider(authorable.AuthorType));
        }

        /// <summary>
        /// Gets the author.
        /// </summary>
        /// <param name="authorable">The authorable.</param>
        /// <param name="provider">The provider.</param>
        /// <returns>The author.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="provider" /> is <c>null</c>.</exception>
        public static Individual.Individual GetAuthor(this IAuthorable authorable, IDataTransferObjectProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            return provider.Get(authorable.AuthorId) as Individual.Individual;
        }
    }
}


text:
class NFCMailModule : public NFIMailModule
{
public:
    NFCMailModule(NFIPluginManager* p)
    {
        pPluginManager = p;
    }

    virtual ~NFCMailModule() {}

    virtual bool Init();
    virtual bool Shut();
    virtual bool Execute();
    virtual bool AfterInit();

public:
    virtual bool SendMail(const NFGUID& reciever, const int nMailType, const NFIDataList& xItemList, const std::string& strNailContent = NULL_STR);
    virtual int OnDrawMail(const NFGUID& self, const NFIDataList& var);
    virtual int OnOpenMail(const NFGUID& self, const NFIDataList& var);
    virtual int OnDeleteMail(const NFGUID& self, const NFIDataList& var);

private:
    NFIKernelModule* m_pKernelModule;
};

#endif // !NFC_MAIL_MODULE_H


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Outline — Miruken.Mediate  documentation</title>

    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/banner.css" type="text/css" />

        <link rel="index" title="Index"
              href="../../genindex.html"/>
        <link rel="search" title="Search" href="../../search.html"/>
    <link rel="top" title="Miruken.Mediate  documentation" href="../../index.html"/>
        <link rel="next" title="Configuring Castle Windsor" href="configuringCastleWindsor.html"/>
        <link rel="prev" title="Validation" href="validation.html"/>

             Miruken.Mediate

  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Table of Contents

Overview

Source Code

Installation

Mediator Pattern

Request And Response

Handler

Send

Publish

Pipeline

Validation

Outline

IMiddleWare

Logging

Validation

Decorators

Cached

OneWay

Route

Configuring Castle Windsor

Installing Mediator

Installing Validation Middleware

Inspiration

          Miruken.Mediate

Docs »

Outline

             View page source

        Next

         Previous

Outline¶

This is a high level documentation outline that is to be filled in as we progress.

IMiddleWare¶

Logging¶

Validation¶

Decorators¶

Cached¶

OneWay¶

Route¶

        Next

         Previous

        © Copyright 2017-2018, Miruken.

  Built with Sphinx using a theme provided by Read the Docs.

         Other Versions
        v: 2.0.10

Tags

1.6.3

1.6.4

1.6.5

2.0.0

2.0.1

2.0.10

2.0.11

2.0.12

2.0.13

2.0.14

2.0.15

2.0.16

2.0.17

2.0.18

2.0.19

2.0.2

2.0.20

2.0.21

2.0.22

2.0.23

2.0.24

2.0.3

2.0.4

2.0.5

2.0.6

2.0.7

2.0.8

2.0.9

Branches

develop

master


text:
<?php

namespace Behat\Behat\Gherkin\Cli;

use Behat\Gherkin\Keywords\KeywordsDumper;
use Behat\Testwork\Cli\Controller;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Translation\TranslatorInterface;

/**
 * Prints example of the feature to present all available syntax keywords.
 *
 * @author Konstantin Kudryashov <ever.zet@gmail.com>
 */
final class SyntaxController implements Controller
{
    /**
     * @var KeywordsDumper
     */
    private $keywordsDumper;
    /**
     * @var TranslatorInterface
     */
    private $translator;

    /**
     * Initializes controller.
     *
     * @param KeywordsDumper      $dumper
     * @param TranslatorInterface $translator
     */
    public function __construct(KeywordsDumper $dumper, TranslatorInterface $translator)
    {
        $dumper->setKeywordsDumperFunction(array($this, 'dumpKeywords'));
        $this->keywordsDumper = $dumper;
        $this->translator = $translator;
    }

    /**
     * Configures command to be executable by the controller.
     *
     * @param Command $command
     */
    public function configure(Command $command)
    {
        $command
            ->addOption(
                '--story-syntax', null, InputOption::VALUE_NONE,
                "Print <comment>*.feature</comment> example." . PHP_EOL .
                "Use <info>--lang</info> to see specific language."
            );
    }

    /**
     * Executes controller.
     *
     * @param InputInterface  $input
     * @param OutputInterface $output
     *
     * @return null|integer
     */
    public function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$input->getOption('story-syntax')) {
            return null;
        }

        $output->getFormatter()->setStyle('gherkin_keyword', new OutputFormatterStyle('green', null, array('bold')));
        $output->getFormatter()->setStyle('gherkin_comment', new OutputFormatterStyle('yellow'));

        $story = $this->keywordsDumper->dump($this->translator->getLocale());
        $story = preg_replace('/^\#.*/', '<gherkin_comment>$0</gherkin_comment>', $story);
        $output->writeln($story);
        $output->writeln('');

        return 0;
    }

    /**
     * Keywords dumper.
     *
     * @param array $keywords keywords list
     *
     * @return string
     */
    public function dumpKeywords(array $keywords)
    {
        $dump = '<gherkin_keyword>' . implode('</gherkin_keyword>|<gherkin_keyword>', $keywords) . '</gherkin_keyword>';

        if (1 < count($keywords)) {
            return '[' . $dump . ']';
        }

        return $dump;
    }
}


text:
namespace dbcrudgen {
    namespace db {
        namespace oracle {
            //
            // OracleUsersColumns
            // //
            class OracleUsersColumns {

            public:
                struct USERNAME {
                    static const unsigned int INDEX = 1;
                };
                struct USERID {
                    static const unsigned int INDEX = 2;
                };
                struct CREATED {
                    static const unsigned int INDEX = 3;
                };
            };

        }
    }
}

#endif //DBCRUDGEN_CPP_ORACLEUSERSCOLUMNS_H


text: from . import basic


text:
package io.quarkus.undertow.test;

import java.io.IOException;

import javax.annotation.PreDestroy;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(urlPatterns = "/destroy", loadOnStartup = 1)
public class PreDestroyServlet extends HttpServlet {

    @PreDestroy
    void stop() {
        Messages.MESSAGES.addFirst("Servlet Destroyed");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("pre destroy servlet");
    }
}


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>IndexWriter.UpdateDocument Method (Term, Document)</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            Apache Lucene.Net 2.4.0 Class Library API

IndexWriter.UpdateDocument Method (Term, Document)

 Updates a document by first deleting the document(s) containing
term
 and then adding the new document. The delete and then add are atomic as seen by a reader on the same index (flush may happen only after the add).

public virtual void UpdateDocument(
   Term term,
   Document doc
);

Parameters

          term

the term to identify the document(s) to be deleted

          doc

the document to be added

See Also

        IndexWriter Class | Lucene.Net.Index Namespace | IndexWriter.UpdateDocument Overload List

      <object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
        <param name="Keyword" value="UpdateDocument method">
        </param>
        <param name="Keyword" value="UpdateDocument method, IndexWriter class">
        </param>
        <param name="Keyword" value="IndexWriter.UpdateDocument method">
        </param>
      </object>

Generated from assembly Lucene.Net [2.4.0.2]


text:
require 'repres/bootstrap/engine'

module Repres
  module Bootstrap
  end
end


text:
namespace Microsoft.Azure.Management.NotificationHubs
{
    using System.Threading.Tasks;
   using Microsoft.Rest.Azure;
   using Models;

    /// <summary>
    /// Extension methods for NotificationHubsOperations.
    /// </summary>
    public static partial class NotificationHubsOperationsExtensions
    {
            /// <summary>
            /// Checks the availability of the given notificationHub in a namespace.
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='parameters'>
            /// The notificationHub name.
            /// </param>
            public static CheckAvailabilityResult CheckAvailability(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, CheckAvailabilityParameters parameters)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).CheckAvailabilityAsync(resourceGroupName, namespaceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Checks the availability of the given notificationHub in a namespace.
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj870968.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='parameters'>
            /// The notificationHub name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<CheckAvailabilityResult> CheckAvailabilityAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, CheckAvailabilityParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.CheckAvailabilityWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Creates/Update a NotificationHub in a namespace.
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj856303.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create/update a NotificationHub Resource.
            /// </param>
            public static NotificationHubResource CreateOrUpdate(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).CreateOrUpdateAsync(resourceGroupName, namespaceName, notificationHubName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates/Update a NotificationHub in a namespace.
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj856303.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create/update a NotificationHub Resource.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<NotificationHubResource> CreateOrUpdateAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes a notification hub associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            public static void Delete(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName)
            {
                System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).DeleteAsync(resourceGroupName, namespaceName, notificationHubName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None,  System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes a notification hub associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task DeleteAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, null, cancellationToken).ConfigureAwait(false);
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            public static NotificationHubResource Get(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).GetAsync(resourceGroupName, namespaceName, notificationHubName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<NotificationHubResource> GetAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Creates/Updates an authorization rule for a NotificationHub
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// Authorization Rule Name.
            /// </param>
            /// <param name='parameters'>
            /// The shared access authorization rule.
            /// </param>
            public static SharedAccessAuthorizationRuleResource CreateOrUpdateAuthorizationRule(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates/Updates an authorization rule for a NotificationHub
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// Authorization Rule Name.
            /// </param>
            /// <param name='parameters'>
            /// The shared access authorization rule.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<SharedAccessAuthorizationRuleResource> CreateOrUpdateAuthorizationRuleAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes a notificationHub authorization rule
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// Authorization Rule Name.
            /// </param>
            public static void DeleteAuthorizationRule(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName)
            {
                System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None,  System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes a notificationHub authorization rule
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// Authorization Rule Name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task DeleteAuthorizationRuleAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false);
            }

            /// <summary>
            /// Gets an authorization rule for a NotificationHub by name.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// authorization rule name.
            /// </param>
            public static SharedAccessAuthorizationRuleResource GetAuthorizationRule(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).GetAuthorizationRuleAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets an authorization rule for a NotificationHub by name.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// authorization rule name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<SharedAccessAuthorizationRuleResource> GetAuthorizationRuleAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            public static Microsoft.Rest.Azure.IPage<NotificationHubResource> List(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).ListAsync(resourceGroupName, namespaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Microsoft.Rest.Azure.IPage<NotificationHubResource>> ListAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets the authorization rules for a NotificationHub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            public static Microsoft.Rest.Azure.IPage<SharedAccessAuthorizationRuleResource> ListAuthorizationRules(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).ListAuthorizationRulesAsync(resourceGroupName, namespaceName, notificationHubName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets the authorization rules for a NotificationHub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Microsoft.Rest.Azure.IPage<SharedAccessAuthorizationRuleResource>> ListAuthorizationRulesAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj873988.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// The connection string of the NotificationHub for the specified
            /// authorizationRule.
            /// </param>
            public static ResourceListKeys ListKeys(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).ListKeysAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets the Primary and Secondary ConnectionStrings to the NotificationHub
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj873988.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// The connection string of the NotificationHub for the specified
            /// authorizationRule.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<ResourceListKeys> ListKeysAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Regenerates the Primary/Secondary Keys to the NotificationHub
            /// Authorization Rule
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj873988.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// The connection string of the NotificationHub for the specified
            /// authorizationRule.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to regenerate the NotificationHub Authorization Rule
            /// Key.
            /// </param>
            public static ResourceListKeys RegenerateKeys(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, PolicykeyResource parameters)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).RegenerateKeysAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Regenerates the Primary/Secondary Keys to the NotificationHub
            /// Authorization Rule
            /// <see href="http://msdn.microsoft.com/en-us/library/windowsazure/jj873988.aspx" />
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='authorizationRuleName'>
            /// The connection string of the NotificationHub for the specified
            /// authorizationRule.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to regenerate the NotificationHub Authorization Rule
            /// Key.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<ResourceListKeys> RegenerateKeysAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName, PolicykeyResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Lists the PNS Credentials associated with a notification hub .
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            public static PnsCredentialsResource GetPnsCredentials(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).GetPnsCredentialsAsync(resourceGroupName, namespaceName, notificationHubName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Lists the PNS Credentials associated with a notification hub .
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='namespaceName'>
            /// The namespace name.
            /// </param>
            /// <param name='notificationHubName'>
            /// The notification hub name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<PnsCredentialsResource> GetPnsCredentialsAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.GetPnsCredentialsWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static Microsoft.Rest.Azure.IPage<NotificationHubResource> ListNext(this INotificationHubsOperations operations, string nextPageLink)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).ListNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Lists the notification hubs associated with a namespace.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Microsoft.Rest.Azure.IPage<NotificationHubResource>> ListNextAsync(this INotificationHubsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets the authorization rules for a NotificationHub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static Microsoft.Rest.Azure.IPage<SharedAccessAuthorizationRuleResource> ListAuthorizationRulesNext(this INotificationHubsOperations operations, string nextPageLink)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((INotificationHubsOperations)s).ListAuthorizationRulesNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets the authorization rules for a NotificationHub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Microsoft.Rest.Azure.IPage<SharedAccessAuthorizationRuleResource>> ListAuthorizationRulesNextAsync(this INotificationHubsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}


text:
#ifndef __mitkAbstractToFDeviceFactory_h
#define __mitkAbstractToFDeviceFactory_h

#include "mitkToFHardwareExports.h"
#include "mitkIToFDeviceFactory.h"

// Microservices
#include <usServiceRegistration.h>
#include <usModuleResource.h>

namespace mitk
{
  /**
  * @brief Virtual interface and base class for all Time-of-Flight device factories.
  * The basic interface is in the base class: IToFDeviceFactory. This
  * AbstractToFDeviceFactory implements some generic function which are useful
  * for every device and not specific.
  *
  * @ingroup ToFHardware
  */
struct MITK_TOFHARDWARE_EXPORT AbstractToFDeviceFactory : public IToFDeviceFactory {
   public:

  /**
    * @brief ConnectToFDevice Use this method to connect a device.
    * @return A ToFCameraDevice.
    */
   ToFCameraDevice::Pointer ConnectToFDevice();

   /**
    * @brief DisconnectToFDevice Use this method to disconnect a device.
    * @param device The device you want to disconnect.
    */
   void DisconnectToFDevice(const ToFCameraDevice::Pointer& device);

  /**
    * @brief GetNumberOfDevices Get the number of devices produced by this factory.
    * This function will return the number of registered devices to account for
    * created and disconnected devices.
    *
    * @return Number of registered devices.
    */
  size_t GetNumberOfDevices();

  std::string GetCurrentDeviceName()
  {
    std::stringstream name;
    if(this->GetNumberOfDevices()>1)
    {
      name << this->GetDeviceNamePrefix()<< " "<< this->GetNumberOfDevices();
    }
    else
    {
      name << this->GetDeviceNamePrefix();
    }
    return name.str();
  }

protected:

  /**
   \brief Returns the CameraIntrinsics for the cameras created by this factory.
   *
   * This Method calls the virtual method GetIntrinsicsResource() to retrieve the necessary data.
   * Override getIntrinsicsResource in your subclasses, also see the documentation of GetIntrinsicsResource
   */
   CameraIntrinsics::Pointer GetCameraIntrinsics();

   /**
   \brief Returns the ModuleResource that contains a xml definition of the CameraIntrinsics.
   *
   * The default implementation returns a default calibration.
   * In subclasses, you can override this method to return a different xml resource.
   * See this implementation for an example.
   */
   virtual us::ModuleResource GetIntrinsicsResource();

   /**
    * @brief m_Devices A list (vector) containing all connected devices of
    * the respective factory.
    */
   std::vector<ToFCameraDevice::Pointer> m_Devices;
   /**
    * @brief m_DeviceRegistrations A map containing all the pairs of
    * device registration numbers and devices.
    */
   std::map<ToFCameraDevice*,us::ServiceRegistration<ToFCameraDevice> > m_DeviceRegistrations;
};
}
#endif


text:
using System;

namespace VSTOContrib.Core.RibbonFactory.Interfaces
{
    public interface IViewProvider : IDisposable
    {
        void Initialise();
        event EventHandler<NewViewEventArgs> NewView;
        event EventHandler<ViewClosedEventArgs> ViewClosed;
        void CleanupReferencesTo(object view, object context);
    }
}


text:
import json
import os
import pipes
import shutil
import subprocess
import sys

script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(script_dir, 'gyp', 'pylib'))
json_data_file = os.path.join(script_dir, 'win_toolchain.json')

import gyp

# Use MSVS2015 as the default toolchain.
CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2015'

def SetEnvironmentAndGetRuntimeDllDirs():
  """Sets up os.environ to use the depot_tools VS toolchain with gyp, and
  returns the location of the VS runtime DLLs so they can be copied into
  the output directory after gyp generation.
  """
  vs_runtime_dll_dirs = None
  depot_tools_win_toolchain = \
      bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
  if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
    if not os.path.exists(json_data_file):
      Update()
    with open(json_data_file, 'r') as tempf:
      toolchain_data = json.load(tempf)

    toolchain = toolchain_data['path']
    version = toolchain_data['version']
    win_sdk = toolchain_data.get('win_sdk')
    if not win_sdk:
      win_sdk = toolchain_data['win8sdk']
    wdk = toolchain_data['wdk']
    # TODO(scottmg): The order unfortunately matters in these. They should be
    # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call
    # below). http://crbug.com/345992
    vs_runtime_dll_dirs = toolchain_data['runtime_dirs']

    os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
    os.environ['GYP_MSVS_VERSION'] = version
    # We need to make sure windows_sdk_path is set to the automated
    # toolchain values in GYP_DEFINES, but don't want to override any
    # otheroptions.express
    # values there.
    gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
    gyp_defines_dict['windows_sdk_path'] = win_sdk
    os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
        for k, v in gyp_defines_dict.iteritems())
    os.environ['WINDOWSSDKDIR'] = win_sdk
    os.environ['WDK_DIR'] = wdk
    # Include the VS runtime in the PATH in case it's not machine-installed.
    runtime_path = ';'.join(vs_runtime_dll_dirs)
    os.environ['PATH'] = runtime_path + ';' + os.environ['PATH']
  return vs_runtime_dll_dirs

def FindDepotTools():
  """Returns the path to depot_tools in $PATH."""
  for path in os.environ['PATH'].split(os.pathsep):
    if os.path.isfile(os.path.join(path, 'gclient.py')):
      return path
  raise Exception("depot_tools not found!")

def GetVisualStudioVersion():
  """Return GYP_MSVS_VERSION of Visual Studio.
  """
  return os.environ.get('GYP_MSVS_VERSION', CURRENT_DEFAULT_TOOLCHAIN_VERSION)

def _GetDesiredVsToolchainHashes():
  """Load a list of SHA1s corresponding to the toolchains that we want installed
  to build with."""
  env_version = GetVisualStudioVersion()
  if env_version == '2015':
    # Update 3 final with 10.0.15063.468 SDK and no vctip.exe.
    return ['f53e4598951162bad6330f7a167486c7ae5db1e5']
  if env_version == '2017':
    # VS 2017 Update 9 (15.9.12) with 10.0.18362 SDK, 10.0.17763 version of
    # Debuggers, and 10.0.17134 version of d3dcompiler_47.dll, with ARM64
    # libraries.
    return ['418b3076791776573a815eb298c8aa590307af63']
  raise Exception('Unsupported VS version %s' % env_version)

def Update():
  """Requests an update of the toolchain to the specific hashes we have at
  this revision. The update outputs a .json of the various configuration
  information required to pass to gyp which we use in |GetToolchainDir()|.
  """
  depot_tools_win_toolchain = \
      bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
  if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
    depot_tools_path = FindDepotTools()
    # Necessary so that get_toolchain_if_necessary.py will put the VS toolkit
    # in the correct directory.
    os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
    get_toolchain_args = [
        sys.executable,
        os.path.join(depot_tools_path,
                    'win_toolchain',
                    'get_toolchain_if_necessary.py'),
        '--output-json', json_data_file,
      ] + _GetDesiredVsToolchainHashes()
    subprocess.check_call(get_toolchain_args)

  return 0

def main():
  if not sys.platform.startswith(('win32', 'cygwin')):
    return 0
  commands = {
      'update': Update,
  }
  if len(sys.argv) < 2 or sys.argv[1] not in commands:
    print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
    return 1
  return commands[sys.argv[1]](*sys.argv[2:])

if __name__ == '__main__':
  sys.exit(main())


text:
package noop.model;

import collection.mutable.{ArrayBuffer, Buffer};

/**
 * Represents the declaration of a method in source code.
 *
 * @author alexeagle@google.com (Alex Eagle)
 * @author tocman@gmail.com (Jeremie Lenfant-Engelmann)
 */
class Method(val name: String, val block: Block, val documentation: String)  {

  val returnTypes: Buffer[String] = new ArrayBuffer[String]();
  val parameters: Buffer[Parameter] = new ArrayBuffer[Parameter]();
  val modifiers: Buffer[Modifier.Value] = new ArrayBuffer[Modifier.Value]();

  override def toString() = String.format("Method %s (%s) returns %s", name, parameters, returnTypes);
}


text: from pyface.action.window_action import *


text:
Originally published: 2008-09-17 10:55:36
Last updated: 2008-09-17 11:25:48
Author: Michael

Let's say you're at a company and you're deploying a package called "tools" on all production boxes.  Normally, code on these boxes could "import tools" to use this package.

However, over time the API to tools will evolve as you release new versions that add functionality and fix bugs.  If there's lots of company code that "imports tools", then you're stuck with backward compatibility forever.

This recipe presents a method for letting client code specify on one line which version of "tools" they wish to use -- and then import from the tools package as normal.  Behind the scenes, the recipe is making sure that the client works with the version of the package that they requested.  If the client ever wants to change versions, it's a one-line change at the top of their code.


text:
function jh__command (jh) {

    return function jh__command (scope, name, options) {
        var type = jh.fn.type(scope);
        var module = jh.include('type.' + type);
        if (!module.command || !module.command[name]) {
            throw new Error('Module for type ' + type + ' has no command "' + name + '"');
        }
        var cmdOpts = module.command[name].options;
        var shortIndex = {};

        /**
         * Check for required options
         */
        Object.keys(cmdOpts).forEach(function (key) {
            var short = cmdOpts[key].short;
            shortIndex[short] = key;
            if (cmdOpts[key].required) {
                if (!options[key] && (!short || !options[short])) {
                    throw new Error('Command =type.' + type + '.' + name +
                    ' missing required option: -' + key +
                    (short ? ' (or -' + short + ')' : ''));
                }
            }
        });

        /**
         * Check that all options are valid
         */
        Object.keys(options).forEach(function (key) {
            if (shortIndex[key]) {
                options[shortIndex[key]] = options[key];
                delete options[key];
            }
            if (!cmdOpts[key] && !shortIndex[key]) {
                throw new Error('Command =type.' + type + '.' + name +
                    ' invalid option specified: -' + key);
            }
        });

        /**
         * Execute the command
         */
        return module.command[name].fn(scope, options);
    };

}