text:
package io.katharsis.spring.legacy;

import io.katharsis.core.internal.dispatcher.path.JsonPath;
import io.katharsis.legacy.queryParams.context.AbstractQueryParamsParserContext;
import io.katharsis.legacy.queryParams.context.QueryParamsParserContext;
import io.katharsis.resource.information.ResourceInformation;
import io.katharsis.resource.registry.ResourceRegistry;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

public class SpringQueryParamsParserContext extends AbstractQueryParamsParserContext {

    private final Map<String, Set<String>> queryParameters = new HashMap<>();

    SpringQueryParamsParserContext(HttpServletRequest request, ResourceRegistry resourceRegistry, JsonPath path) {
        super(resourceRegistry, path);
        initParameterMap(request);
    }

    @Override
    public Set<String> getParameterValue(String parameterName) {
        if (queryParameters.containsKey(parameterName)) {
            return queryParameters.get(parameterName);
        }
        return Collections.emptySet();
    }

    @Override
    public Iterable<String> getParameterNames() {
        return queryParameters.keySet();
    }

    private void initParameterMap(HttpServletRequest request) {
        Map<String, String[]> params = request.getParameterMap();
        for (Map.Entry<String, String[]> entry : params.entrySet()) {
            queryParameters.put(entry.getKey(), new HashSet<>(Arrays.asList(entry.getValue())));
        }
    }
}


text:
typedef void TCB_t;
extern volatile TCB_t * volatile pxCurrentTCB;
extern void vTaskSwitchContext( void );

/*
 * Saves the stack pointer for one task into its TCB, calls
 * vTaskSwitchContext() to update the TCB being used, then restores the stack
 * from the new TCB read to run the task.
 */
void portSWITCH_CONTEXT( void );

/*
 * Load the stack pointer from the TCB of the task which is going to be first
 * to execute.  Then force an IRET so the registers and IP are popped off the
 * stack.
 */
void portFIRST_CONTEXT( void );

/* There are slightly different versions depending on whether you are building
to include debugger information.  If debugger information is used then there
are a couple of extra bytes left of the ISR stack (presumably for use by the
debugger).  The true stack pointer is then stored in the bp register.  We add
2 to the stack pointer to remove the extra bytes before we restore our context. */

#ifdef DEBUG_BUILD

	#pragma aux portSWITCH_CONTEXT =	"mov	ax, seg pxCurrentTCB"														\
										"mov	ds, ax"																		\
										"les	bx, pxCurrentTCB"			/* Save the stack pointer into the TCB. */		\
										"mov	es:0x2[ bx ], ss"															\
										"mov	es:[ bx ], sp"																\
										"call	vTaskSwitchContext"			/* Perform the switch. */						\
										"mov	ax, seg pxCurrentTCB"		/* Restore the stack pointer from the TCB. */	\
										"mov	ds, ax"																		\
										"les	bx, dword ptr pxCurrentTCB"													\
										"mov	ss, es:[ bx + 2 ]"															\
										"mov	sp, es:[ bx ]"																\
										"mov	bp, sp"						/* Prepair the bp register for the restoration of the SP in the compiler generated portion of the ISR */	\
										"add	bp, 0x0002"

	#pragma aux portFIRST_CONTEXT =		"mov	ax, seg pxCurrentTCB"			\
										"mov	ds, ax"							\
										"les	bx, dword ptr pxCurrentTCB"		\
										"mov	ss, es:[ bx + 2 ]"				\
										"mov	sp, es:[ bx ]"					\
										"add	sp, 0x0002"						/* Remove the extra bytes that exist in debug builds before restoring the context. */ \
										"pop	ax"								\
										"pop	ax"								\
										"pop	es"								\
										"pop	ds"								\
										"popa"									\
										"iret"
#else

	#pragma aux portSWITCH_CONTEXT =	"mov	ax, seg pxCurrentTCB"														\
										"mov	ds, ax"																		\
										"les	bx, pxCurrentTCB"			/* Save the stack pointer into the TCB. */		\
										"mov	es:0x2[ bx ], ss"															\
										"mov	es:[ bx ], sp"																\
										"call	vTaskSwitchContext"			/* Perform the switch. */						\
										"mov	ax, seg pxCurrentTCB"		/* Restore the stack pointer from the TCB. */	\
										"mov	ds, ax"																		\
										"les	bx, dword ptr pxCurrentTCB"													\
										"mov	ss, es:[ bx + 2 ]"															\
										"mov	sp, es:[ bx ]"

	#pragma aux portFIRST_CONTEXT =		"mov	ax, seg pxCurrentTCB"			\
										"mov	ds, ax"							\
										"les	bx, dword ptr pxCurrentTCB"		\
										"mov	ss, es:[ bx + 2 ]"				\
										"mov	sp, es:[ bx ]"					\
										"pop	ax"								\
										"pop	ax"								\
										"pop	es"								\
										"pop	ds"								\
										"popa"									\
										"iret"
#endif

redpajama_set_name: RedPajamaGithub


text:
ActiveRecord::Schema.define(version: 20170404021234) do

  create_table "case_documents", force: :cascade do |t|
    t.integer  "case_id"
    t.integer  "document_id"
    t.datetime "created_at",  null: false
    t.datetime "updated_at",  null: false
  end

  create_table "cases", force: :cascade do |t|
    t.string   "client_name"
    t.date     "date_submitted"
    t.string   "summary"
    t.string   "notes"
    t.string   "status"
    t.integer  "deacon_id"
    t.string   "subject"
    t.datetime "created_at",     null: false
    t.datetime "updated_at",     null: false
  end

  create_table "documents", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "attachment"
  end

  create_table "users", force: :cascade do |t|
    t.string   "first_name"
    t.string   "last_name"
    t.string   "email"
    t.string   "password_digest"
    t.string   "phone"
    t.string   "role"
    t.boolean  "is_care_deacon",  default: true
    t.boolean  "active",          default: true
    t.datetime "created_at",                     null: false
    t.datetime "updated_at",                     null: false
  end

  create_table "votes", force: :cascade do |t|
    t.integer  "deacon_id"
    t.string   "decision"
    t.integer  "case_id"
    t.date     "date_submitted"
    t.datetime "created_at",     null: false
    t.datetime "updated_at",     null: false
  end

end


text:
layout: post
title:  Learning Notes - Swift Property observers 、type property、global/Local variables
---
## Swift Property 的监控机制 Property Observers
You have the option to define either or both of these observers on a property:

- willSet is called just before the value is stored.
- didSet is called immediately after the new value is stored.

Property observers 一般用在stored properties,nooverride computed proerties由于本身实现代码块中即可包含监控代码,故一般不需要考虑property observers.

### `willSet`和`didSet`都包含一个默认constant parameter用来传递新的或者旧的属性值,parameter name可以指定,也可以不指定由系统生成默认值`newValue`或者`oldValue`(不指定参数,有系统隐含生成)
If you implement a willSet observer, it's passed the new property value as a constant parameter. You can specify a name for this parameter as part of your willSet implementation. If you don't write the parameter name and parentheses within your implementation, the parameter is made available with a default parameter name of newValue.

Similarly, if you implement a didSet observer, it's passed a constant parameter containing the old property value. You can name the parameter or use the default parameter name of oldValue. If you assign a value to a property within its own didSet observer, the new value that you assign replaces the one that was just set.

## Global/Local variables
**Global variables** are variables that are defined outside of any function, method, closure, or type context.

**Local variables** are variables that are defined within a function, method, or closure context.

However, you can also define computed variables and define **observers** for stored variables, ***in either a global or local scope***. Computed variables calculate their value, rather than storing it, and they are written in the same way as computed properties.

## Type Property
You can also define properties that belong to the type itself, not to any one instance of that type. There will only ever be one copy of these properties, no matter how many instances of that type you create. These kinds of properties are called type properties.

Type properties are useful for defining values that are universal to all instances of a particular type, such as a constant property that all instances can use (like a static constant in C), or a variable property that stores a value that is global to all instances of that type (like a static variable in C).

### Type Property Syntax
In C and Objective-C, you define static constants and variables associated with a type as global static variables. In Swift, however, type properties are written as part of the type's definition, within the type's outer curly braces, and each type property is explicitly scoped to the type it supports.

You define type properties with the **static** keyword. For ***computed type properties*** for ***class*** types, you can use the ***class*** keyword instead to allow subclasses to override the superclass's implementation.

```
struct SomeStructure {
    static var storedTypeProperty = "Some value."
    static var computedTypeProperty: Int {
        return 1
    }
}
```

```
class SomeClass {
    static var storedTypeProperty = "Some value."
    static var computedTypeProperty: Int {
        return 27
    }
    class var overrideableComputedTypeProperty: Int {
        return 107
    }
}
```


text:
<?php
namespace DAErp\Controller\Financial\Accounts;

use DACore\Controller\AbstractCrudRestController;

class CreditAccountsRestController extends AbstractCrudRestController
{
    protected $aclResource = 'creditAccounts';
}


text:
from contextlib import contextmanager
from unittest.mock import patch

import django
from django import forms
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.utils.translation import override

import tinymce.settings
from tinymce.widgets import TinyMCE, get_language_config

@contextmanager
def override_tinymce_settings(settings_dict):
    saved_values = {}
    for setting, value in settings_dict.items():
        saved_values[setting] = getattr(tinymce.settings, setting)
        setattr(tinymce.settings, setting, value)
    yield
    for setting in settings_dict.keys():
        setattr(tinymce.settings, setting, saved_values[setting])

@override_settings(LANGUAGES=[("en", "English")])
class TestWidgets(SimpleTestCase):
    def test_default_config(self):
        config = get_language_config("en")
        config_ok = {
            "spellchecker_languages": "+English=en",
            "directionality": "ltr",
            "spellchecker_rpc_url": "/tinymce/spellchecker/",
        }
        self.assertEqual(config, config_ok)

    def test_no_active_language(self):
        widget = TinyMCE()
        with override(None):
            config = widget.get_mce_config(attrs={"id": "id"})
            self.assertNotIn("language", config.keys())
            self.assertEqual(config["spellchecker_languages"], "+English=en")

    @override_settings(LANGUAGES_BIDI=["en"])
    def test_default_config_rtl(self):
        config = get_language_config("en")
        config_ok = {
            "spellchecker_languages": "+English=en",
            "directionality": "rtl",
            "spellchecker_rpc_url": "/tinymce/spellchecker/",
        }
        self.assertEqual(config, config_ok)

    def test_config_from_language_code(self):
        langs = [
            ("en", "en"),
            ("fr", "fr_FR"),  # Currently no "fr" language file exist for TinyMCE.
            ("de-ch", "de"),
            ("pt-br", "pt_BR"),
            ("he", "he_IL"),
            ("he_il", "he_IL"),
        ]
        widget = TinyMCE()
        for lang_code, lang_expected in langs:
            with override_settings(LANGUAGE_CODE=lang_code):
                config = widget.get_mce_config(attrs={"id": "id"})
                self.assertEqual(config["language"], lang_expected)
        # A language with no matching TinyMCE translation:
        expected = "No TinyMCE language found for 'af', defaulting to 'en_US'"
        with self.assertWarnsRegex(RuntimeWarning, expected):
            with override_settings(LANGUAGE_CODE="af"):
                config = widget.get_mce_config(attrs={"id": "id"})
                self.assertEqual(config["language"], "en_US")

    def test_no_language_for_en_US(self):
        """
        en_US shouldn't set 'language'
        (https://github.com/tinymce/tinymce/issues/4228)
        """
        widget = TinyMCE()
        with override_settings(LANGUAGE_CODE="en-us"):
            config = widget.get_mce_config(attrs={"id": "id"})
            self.assertNotIn("language", config.keys())
        self.assertEqual(config["directionality"], "ltr")

    def test_language_override_from_config(self):
        """language in DEFAULT_CONFIG has priority over current Django language."""
        widget = TinyMCE()
        orig_config = tinymce.settings.DEFAULT_CONFIG
        with patch.dict(tinymce.settings.DEFAULT_CONFIG, {**orig_config, "language": "es_ES"}):
            config = widget.get_mce_config(attrs={"id": "id"})
            self.assertEqual(config["language"], "es_ES")

    def test_mce_attrs_language_priority(self):
        widget = TinyMCE(mce_attrs={"language": "ru"})
        orig_config = tinymce.settings.DEFAULT_CONFIG
        with patch.dict(tinymce.settings.DEFAULT_CONFIG, {**orig_config, "language": "es_ES"}):
            config = widget.get_mce_config(attrs={"id": "id"})
            self.assertEqual(config["language"], "ru")

    def test_content_language(self):
        config = get_language_config("ru-ru")
        config_ok = {
            "spellchecker_languages": "English=en",
            "directionality": "ltr",
            "spellchecker_rpc_url": "/tinymce/spellchecker/",
        }
        self.assertEqual(config, config_ok)

    def test_tinymce_widget(self):
        widget = TinyMCE()
        html = widget.render("foobar", "lorem ipsum", attrs={"id": "id_foobar"})
        self.assertIn('id="id_foobar"', html)
        self.assertIn('name="foobar"', html)
        self.assertIn("lorem ipsum", html)
        self.assertIn('class="tinymce"', html)
        html = widget.render("foobar", "lorem ipsum", attrs={"id": "id_foobar", "class": "foo"})
        self.assertIn('class="foo tinymce"', html)

    def test_tinymce_widget_size(self):
        widget = TinyMCE(attrs={"cols": 80, "rows": 30})
        html = widget.render("foobar", "lorem ipsum", attrs={"id": "id_foobar"})
        self.assertIn('cols="80"', html)
        self.assertIn('rows="30"', html)

    def test_tinymce_widget_media(self):
        widget = TinyMCE()
        js_type = 'type="text/javascript" ' if django.get_version() < "3.1" else ""
        self.assertEqual(
            widget.media.render_js(),
            [
                f'<script {js_type}src="/tinymce/compressor/"></script>',
                f'<script {js_type}src="/static/django_tinymce/init_tinymce.js"></script>',
            ],
        )
        self.assertEqual(list(widget.media.render_css()), [])
        with override_tinymce_settings({"USE_COMPRESSOR": False}):
            widget = TinyMCE()
            self.assertEqual(
                widget.media.render_js(),
                [
                    f'<script {js_type}src="/static/tinymce/tinymce.min.js"></script>',
                    f'<script {js_type}src="/static/django_tinymce/init_tinymce.js"></script>',
                ],
            )

    def test_tinymce_widget_required(self):
        """
        The TinyMCE widget should never output the required HTML attribute, even
        if the form field is required, as the client-side browser validation
        might prevent form submission.
        """

        class TinyForm(forms.Form):
            field = forms.CharField(required=True, widget=TinyMCE())

        rendered = str(TinyForm())
        self.assertNotIn("required", rendered)


text:
function ExpertSystem() {
	this.factBase = new FactBase();
	this.ruleBase = new RuleBase();
	this.engine = new InferenceEngine();
}

ExpertSystem.prototype.addFact = function(label) {
	this.factBase.addFact(label);
};

ExpertSystem.prototype.setFactValid = function(label, value) {
	this.factBase.setFactValid(label, value);
};

ExpertSystem.prototype.addRule = function(conclusionLabel, premiseLabels) {
	conclusion = this.factBase.addFact(conclusionLabel);

	var premises = [];
	for(premiseIndex in premiseLabels) {
		premise = this.factBase.addFact(premiseLabels[premiseIndex]);
		premises.push(premise);
	}

	this.ruleBase.addRule(new Rule(conclusion, premises));
};

ExpertSystem.prototype.resetFactValues = function() {
	this.factBase.resetValues();
};

ExpertSystem.prototype.inferForward = function() {
	return this.engine.inferForward(this.factBase, this.ruleBase);
};

ExpertSystem.prototype.inferBackward = function() {
	return this.engine.inferBackward(this.factBase, this.ruleBase);
};


text:
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block pretitle %}{% endblock %}
{% block extra_head %}
{% endblock %}

{% block breadcrumbs %}

Home

Documentation

{% endblock %}
{% block pagename %}Blue Button Documentation{% endblock %}
{% block content %}

{{ settings.APPLICATION_TITLE }}

                    This is the entry point for the BlueButton On FHIR Developer Documentation.

                    See the Supported Resource Types

                    See the Resource Type Controls

{% endblock %}


text:
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'none'">
<head>
  <title>Test font does not load if it does not match font-src.</title>
  <script src='/resources/testharness.js'></script>
  <script src='/resources/testharnessreport.js'></script>
</head>
<body>
  <div id="log"/>
  <script>
    async_test(function(t) {
      var link = document.createElement('link');
      link.rel="stylesheet";
      link.type="text/css";
      link.href="/content-security-policy/support/fonts.css";
      // The stylesheet should stil load, even though the font contained does not
      link.onerror = t.unreached_func("Should have loaded the stylesheet.");
      document.addEventListener("securitypolicyviolation", t.step_func_done(function(e) {
        assert_equals(e.violatedDirective, "font-src");
      }));
      document.getElementsByTagName('head')[0].appendChild(link);
    }, "Test font does not load if it does not match font-src.");
  </script>
</body>


text:
package scalaguide.logging

import javax.inject.Inject

import org.junit.runner.RunWith
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner

import scala.concurrent.{ExecutionContext, Future}
import org.slf4j._
import play.api._
import play.api.libs.Files.SingletonTemporaryFileCreator
import play.api.mvc._

import play.api.test._
import play.api.test.Helpers._

@RunWith(classOf[JUnitRunner])
class ScalaLoggingSpec extends Specification with Mockito {

  private def riskyCalculation: Int = {
    10 / scala.util.Random.nextInt(2)
  }

  "The default Logger" should {
    "properly log" in {

      object Logger extends play.api.LoggerLike {
        // Mock underlying logger implementation
        val logger = mock[org.slf4j.Logger].smart
        logger.isDebugEnabled() returns true
        logger.isErrorEnabled() returns true
      }

      //#logging-default-logger
      // Log some debug info
      Logger.debug("Attempting risky calculation.")

      try {
        val result = riskyCalculation

        // Log result if successful
        Logger.debug(s"Result=$result")
      } catch {
        case t: Throwable => {
          // Log error with message and Throwable.
          Logger.error("Exception with riskyCalculation", t)
        }
      }
      //#logging-default-logger

      there was atLeastOne(Logger.logger).isDebugEnabled()
      there was atLeastOne(Logger.logger).debug(anyString)
      there was atMostOne(Logger.logger).isErrorEnabled()
      there was atMostOne(Logger.logger).error(anyString, any[Throwable])
    }

  }

  "Creating a Logger" should {
    "return a new Logger with specified name" in {
      //#logging-import
      import play.api.Logger
      //#logging-import

      //#logging-create-logger-name
      val accessLogger: Logger = Logger("access")
      //#logging-create-logger-name

      accessLogger.underlyingLogger.getName must equalTo("access")
    }

    "return a new Logger with class name" in {
      import play.api.Logger

      //#logging-create-logger-class
      val logger: Logger = Logger(this.getClass())
      //#logging-create-logger-class

      logger.underlyingLogger.getName must equalTo("scalaguide.logging.ScalaLoggingSpec")
    }

    "allow for using multiple loggers" in {

//      object Logger extends LoggerLike {
//        // Mock underlying logger implementation
//        val logger = mock[org.slf4j.Logger].smart
//
//        def apply[T](clazz: Class[T]): play.api.Logger = new play.api.Logger(mock[org.slf4j.Logger].smart)
//        def apply[T](name: String): play.api.Logger = new play.api.Logger(mock[org.slf4j.Logger].smart)
//      }

      //#logging-pattern-mix
      import scala.concurrent.Future
      import play.api.Logger
      import play.api.mvc._
      import javax.inject.Inject

      class AccessLoggingAction @Inject() (parser: BodyParsers.Default)(implicit ec: ExecutionContext) extends ActionBuilderImpl(parser) {
        val accessLogger = Logger("access")
        override def invokeBlock[A](request: Request[A], block: (Request[A]) => Future[Result]) = {
          accessLogger.info(s"method=${request.method} uri=${request.uri} remote-address=${request.remoteAddress}")
          block(request)
        }
      }

      class Application @Inject() (val accessLoggingAction: AccessLoggingAction) extends Controller {

        val logger = Logger(this.getClass())

        def index = accessLoggingAction {
          try {
            val result = riskyCalculation
            Ok(s"Result=$result")
          } catch {
            case t: Throwable => {
              logger.error("Exception with riskyCalculation", t)
              InternalServerError("Error in calculation: " + t.getMessage())
            }
          }
        }
      }
      //#logging-pattern-mix

      import akka.actor._
      import akka.stream.ActorMaterializer
      import play.api.http._
      import akka.stream.Materializer
      implicit val system = ActorSystem();
      implicit val ec: ExecutionContext = ExecutionContext.Implicits.global
      val eh: HttpErrorHandler =
        new DefaultHttpErrorHandler(play.api.Environment.simple(), play.api.Configuration.empty)
      val controller = new Application(new AccessLoggingAction(
        new BodyParsers.Default(ParserConfiguration(), eh, ActorMaterializer(), SingletonTemporaryFileCreator)))

      controller.accessLoggingAction.accessLogger.underlyingLogger.getName must equalTo("access")
      controller.logger.underlyingLogger.getName must contain("Application")
    }

    "allow for use in filters" in {
      //#logging-pattern-filter
      import javax.inject.Inject
      import akka.stream.Materializer
      import scala.concurrent.ExecutionContext.Implicits.global
      import scala.concurrent.Future
      import play.api.Logger
      import play.api.mvc._
      import play.api._

      class AccessLoggingFilter @Inject() (implicit val mat: Materializer) extends Filter {

        val accessLogger = Logger("access")

        def apply(next: (RequestHeader) => Future[Result])(request: RequestHeader): Future[Result] = {
          val resultFuture = next(request)

          resultFuture.foreach(result => {
            val msg = s"method=${request.method} uri=${request.uri} remote-address=${request.remoteAddress}" +
              s" status=${result.header.status}";
            accessLogger.info(msg)
          })

          resultFuture
        }
      }
      //#logging-pattern-filter

      ok
    }

  }

  "Underlying logger" should {
    "return logger name" in {
      import play.api.Logger

      val logger: Logger = Logger("access")

      //#logging-underlying
      val underlyingLogger: org.slf4j.Logger = logger.underlyingLogger
      val loggerName = underlyingLogger.getName()
      //#logging-underlying

      loggerName must equalTo("access")
    }
  }

  //#logging-default-marker-context
  val someMarker: org.slf4j.Marker = MarkerFactory.getMarker("SOMEMARKER")
  case object SomeMarkerContext extends play.api.DefaultMarkerContext(someMarker)
  //#logging-default-marker-context

  "MarkerContext" should {
    "return some marker" in {
      import play.api.Logger
      val logger: Logger = Logger("access")

      //#logging-marker-context
      val marker: org.slf4j.Marker = MarkerFactory.getMarker("SOMEMARKER")
      val mc: MarkerContext = MarkerContext(marker)
      //#logging-marker-context
      mc.marker must beSome.which(_ must be_==(marker))
    }

    "logger.info with explicit marker context" in {
      import play.api.Logger
      val logger: Logger = Logger("access")

      //#logging-log-info-with-explicit-markercontext
      // use a typed marker as input
      logger.info("log message with explicit marker context with case object")(SomeMarkerContext)

      // Use a specified marker.
      val otherMarker: Marker = MarkerFactory.getMarker("OTHER")
      val otherMarkerContext: MarkerContext = MarkerContext(otherMarker)
      logger.info("log message with explicit marker context")(otherMarkerContext)
      //#logging-log-info-with-explicit-markercontext

      success
    }

    "logger.info with implicit marker context" in {
      import play.api.Logger
      val logger: Logger = Logger("access")

      //#logging-log-info-with-implicit-markercontext
      val marker: Marker = MarkerFactory.getMarker("SOMEMARKER")
      implicit val mc: MarkerContext = MarkerContext(marker)

      // Use the implicit MarkerContext in logger.info...
      logger.info("log message with implicit marker context")
      //#logging-log-info-with-implicit-markercontext

      mc.marker must beSome.which(_ must be_==(marker))
    }

    "implicitly convert a Marker to a MarkerContext" in {
      import play.api.Logger
      val logger: Logger = Logger("access")

      //#logging-log-info-with-implicit-conversion
      val mc: MarkerContext = MarkerFactory.getMarker("SOMEMARKER")

      // Use the marker that has been implicitly converted to MarkerContext
      logger.info("log message with implicit marker context")(mc)
      //#logging-log-info-with-implicit-conversion

      success
    }

    "implicitly pass marker context in controller" in new WithApplication() with Injecting {
      val controller = inject[ImplicitRequestController]

      val result = controller.asyncIndex()(FakeRequest())
      contentAsString(result) must be_==("testing")
    }
  }

}

//#logging-request-context-trait
trait RequestMarkerContext {

  implicit def requestHeaderToMarkerContext(request: RequestHeader): MarkerContext = {
    import net.logstash.logback.marker.LogstashMarker
    import net.logstash.logback.marker.Markers._

    val requestMarkers: LogstashMarker = append("host", request.host)
      .and(append("path", request.path))

    MarkerContext(requestMarkers)
  }

}
//#logging-request-context-trait

class ImplicitRequestController @Inject()(cc: ControllerComponents)(implicit otherExecutionContext: ExecutionContext)
  extends AbstractController(cc) with RequestMarkerContext {
  private val logger = play.api.Logger(getClass)

  //#logging-log-info-with-request-context
  def asyncIndex = Action.async { implicit request =>
    Future {
      methodInOtherExecutionContext()
    }(otherExecutionContext)
  }

  def methodInOtherExecutionContext()(implicit mc: MarkerContext): Result = {
    logger.debug("index: ") // same as above
    Ok("testing")
  }
  //#logging-log-info-with-request-context
}

//#logging-log-trace-with-tracer-controller
trait TracerMarker {
  import TracerMarker._

  implicit def requestHeaderToMarkerContext(implicit request: RequestHeader): MarkerContext = {
    val marker = org.slf4j.MarkerFactory.getDetachedMarker("dynamic") // base do-nothing marker...
    if (request.getQueryString("trace").nonEmpty) {
      marker.add(tracerMarker)
    }
    marker
  }
}

object TracerMarker {
  private val tracerMarker = org.slf4j.MarkerFactory.getMarker("TRACER")
}

class TracerBulletController @Inject()(cc: ControllerComponents)
  extends AbstractController(cc) with TracerMarker {
  private val logger = play.api.Logger("application")

  def index = Action { implicit request: Request[AnyContent] =>
    logger.trace("Only logged if queryString contains trace=true")

    Ok("hello world")
  }
}
//#logging-log-trace-with-tracer-controller


text:
namespace {

history::URLRows ConvertImporterURLRowsToHistoryURLRows(
    const std::vector<ImporterURLRow>& rows) {
  history::URLRows converted;
  converted.reserve(rows.size());
  for (auto it = rows.begin(); it != rows.end(); ++it) {
    history::URLRow row(it->url);
    row.set_title(it->title);
    row.set_visit_count(it->visit_count);
    row.set_typed_count(it->typed_count);
    row.set_last_visit(it->last_visit);
    row.set_hidden(it->hidden);
    converted.push_back(row);
  }
  return converted;
}

history::VisitSource ConvertImporterVisitSourceToHistoryVisitSource(
    importer::VisitSource visit_source) {
  switch (visit_source) {
    case importer::VISIT_SOURCE_BROWSED:
      return history::SOURCE_BROWSED;
    case importer::VISIT_SOURCE_FIREFOX_IMPORTED:
      return history::SOURCE_FIREFOX_IMPORTED;
    case importer::VISIT_SOURCE_IE_IMPORTED:
      return history::SOURCE_IE_IMPORTED;
    case importer::VISIT_SOURCE_SAFARI_IMPORTED:
      return history::SOURCE_SAFARI_IMPORTED;
  }
  NOTREACHED();
  return history::SOURCE_SYNCED;
}

password_manager::PasswordForm::Scheme ConvertToPasswordFormScheme(
    importer::ImportedPasswordForm::Scheme scheme) {
  switch (scheme) {
    case importer::ImportedPasswordForm::Scheme::kHtml:
      return password_manager::PasswordForm::Scheme::kHtml;
    case importer::ImportedPasswordForm::Scheme::kBasic:
      return password_manager::PasswordForm::Scheme::kBasic;
  }

  NOTREACHED();
  return password_manager::PasswordForm::Scheme::kHtml;
}

password_manager::PasswordForm ConvertImportedPasswordForm(
    const importer::ImportedPasswordForm& form) {
  password_manager::PasswordForm result;
  result.scheme = ConvertToPasswordFormScheme(form.scheme);
  result.signon_realm = form.signon_realm;
  result.url = form.url;
  result.action = form.action;
  result.username_element = form.username_element;
  result.username_value = form.username_value;
  result.password_element = form.password_element;
  result.password_value = form.password_value;
  result.blocked_by_user = form.blocked_by_user;
  return result;
}

// Attempts to create a TemplateURL from the provided data. |title| is optional.
// If TemplateURL creation fails, returns null.
std::unique_ptr<TemplateURL> CreateTemplateURL(const std::u16string& url,
                                               const std::u16string& keyword,
                                               const std::u16string& title) {
  if (url.empty() || keyword.empty())
    return nullptr;
  TemplateURLData data;
  data.SetKeyword(keyword);
  // We set short name by using the title if it exists.
  // Otherwise, we use the shortcut.
  data.SetShortName(title.empty() ? keyword : title);
  data.SetURL(TemplateURLRef::DisplayURLToURLRef(url));
  return std::make_unique<TemplateURL>(data);
}

}  // namespace

InProcessImporterBridge::InProcessImporterBridge(
    ProfileWriter* writer,
    base::WeakPtr<ExternalProcessImporterHost> host) : writer_(writer),
                                                       host_(host) {
}

void InProcessImporterBridge::AddBookmarks(
    const std::vector<ImportedBookmarkEntry>& bookmarks,
    const std::u16string& first_folder_name) {
  writer_->AddBookmarks(bookmarks, first_folder_name);
}

void InProcessImporterBridge::AddHomePage(const GURL& home_page) {
  writer_->AddHomepage(home_page);
}

void InProcessImporterBridge::SetFavicons(
    const favicon_base::FaviconUsageDataList& favicons) {
  writer_->AddFavicons(favicons);
}

void InProcessImporterBridge::SetHistoryItems(
    const std::vector<ImporterURLRow>& rows,
    importer::VisitSource visit_source) {
  history::URLRows converted_rows =
      ConvertImporterURLRowsToHistoryURLRows(rows);
  history::VisitSource converted_visit_source =
      ConvertImporterVisitSourceToHistoryVisitSource(visit_source);
  writer_->AddHistoryPage(converted_rows, converted_visit_source);
}

void InProcessImporterBridge::SetKeywords(
    const std::vector<importer::SearchEngineInfo>& search_engines,
    bool unique_on_host_and_path) {
  TemplateURLService::OwnedTemplateURLVector owned_template_urls;
  for (const auto& search_engine : search_engines) {
    std::unique_ptr<TemplateURL> owned_template_url = CreateTemplateURL(
        search_engine.url, search_engine.keyword, search_engine.display_name);
    if (owned_template_url)
      owned_template_urls.push_back(std::move(owned_template_url));
  }
  writer_->AddKeywords(std::move(owned_template_urls), unique_on_host_and_path);
}

void InProcessImporterBridge::SetPasswordForm(
    const importer::ImportedPasswordForm& form) {
  writer_->AddPasswordForm(ConvertImportedPasswordForm(form));
}

void InProcessImporterBridge::SetAutofillFormData(
    const std::vector<ImporterAutofillFormDataEntry>& entries) {
  std::vector<autofill::AutofillEntry> autofill_entries;
  for (size_t i = 0; i < entries.size(); ++i) {
    // Using method c_str() in order to avoid data which contains null
    // terminating symbols.
    const std::u16string name = entries[i].name.c_str();
    const std::u16string value = entries[i].value.c_str();
    if (name.empty() || value.empty())
      continue;
    autofill_entries.push_back(
        autofill::AutofillEntry(autofill::AutofillKey(name, value),
                                entries[i].first_used, entries[i].last_used));
  }

  writer_->AddAutofillFormDataEntries(autofill_entries);
}

void InProcessImporterBridge::NotifyStarted() {
  host_->NotifyImportStarted();
}

void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) {
  host_->NotifyImportItemStarted(item);
}

void InProcessImporterBridge::NotifyItemEnded(importer::ImportItem item) {
  host_->NotifyImportItemEnded(item);
}

void InProcessImporterBridge::NotifyEnded() {
  host_->NotifyImportEnded();
}

std::u16string InProcessImporterBridge::GetLocalizedString(int message_id) {
  return l10n_util::GetStringUTF16(message_id);
}

InProcessImporterBridge::~InProcessImporterBridge() {}


text:
import { NgModule, PLATFORM_DIRECTIVES } from '@angular/core';
import { FORM_DIRECTIVES, InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES, TEMPLATE_DRIVEN_DIRECTIVES } from './directives';
import { RadioControlRegistry } from './directives/radio_control_value_accessor';
import { FormBuilder } from './form_builder';
/**
 * Shorthand set of providers used for building Angular forms.
 * @experimental
 */
export const FORM_PROVIDERS = [RadioControlRegistry];
/**
 * Shorthand set of providers used for building reactive Angular forms.
 * @experimental
 */
export const REACTIVE_FORM_PROVIDERS = [FormBuilder, RadioControlRegistry];
export class FormsModule {
}
/** @nocollapse */
FormsModule.decorators = [
    { type: NgModule, args: [{
                declarations: TEMPLATE_DRIVEN_DIRECTIVES,
                providers: [FORM_PROVIDERS],
                exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
            },] },
];
export class ReactiveFormsModule {
}
/** @nocollapse */
ReactiveFormsModule.decorators = [
    { type: NgModule, args: [{
                declarations: [REACTIVE_DRIVEN_DIRECTIVES],
                providers: [REACTIVE_FORM_PROVIDERS],
                exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
            },] },
];
/**
 * @deprecated
 */
export function disableDeprecatedForms() {
    return [];
}
/**
 * @deprecated
 */
export function provideForms() {
    return [
        { provide: PLATFORM_DIRECTIVES, useValue: FORM_DIRECTIVES, multi: true }, REACTIVE_FORM_PROVIDERS
    ];
}
//# sourceMappingURL=form_providers.js.map


text:
import { IssueCode } from './cspell.cache';

describe('Cache', () => {
    test('IssueCode', () => {
        const codes = [IssueCode.UnknownWord, IssueCode.ForbiddenWord, IssueCode.KnownIssue];
        const sum = codes.reduce((a, b) => a + b, 0);
        expect(sum).toBe(IssueCode.ALL);
    });
});


text:
@interface QMChatCellLayoutAttributes()

@property (strong, nonatomic) NSMutableDictionary *customAttributes;

@end

@implementation QMChatCellLayoutAttributes

#pragma mark - Lifecycle

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.transform = CGAffineTransformMake(1, 0, 0, -1, 0, 0);
    }
    return self;
}

- (void)dealloc {

}

- (void)setAttribute:(id)attribure forKey:(id <NSCopying>)key {

    self.customAttributes[key] = attribure;
}

- (id)attributeForKey:(id <NSCopying>)key {

    return self.customAttributes[key];
}

#pragma mark - Setters

- (void)setContainerSize:(CGSize)containerSize {

    NSParameterAssert(containerSize.width >= 0.0f && containerSize.height >= 0.0f);
    _containerSize = [self correctedSizeFromSize:containerSize];
}

- (void)setAvatarSize:(CGSize)avatarSize {

    _avatarSize = [self correctedSizeFromSize:avatarSize];
}

#pragma  mark - Utilites

- (CGSize)correctedSizeFromSize:(CGSize)size {

    return CGSizeMake(ceilf(size.width), ceilf(size.height));
}

#pragma mark - NSObject

- (BOOL)isEqual:(id)object {

    if (self == object) {

        return YES;
    }

    if (![object isKindOfClass:[self class]]) {

        return NO;
    }

    if (self.representedElementCategory == UICollectionElementCategoryCell) {

        QMChatCellLayoutAttributes *layoutAttributes = (QMChatCellLayoutAttributes *)object;

        if (!CGSizeEqualToSize(layoutAttributes.containerSize, self.containerSize)
            ||(int)layoutAttributes.topLabelHeight != (int)self.topLabelHeight
            ||(int)layoutAttributes.bottomLabelHeight != (int)self.bottomLabelHeight
            ||!CGSizeEqualToSize(layoutAttributes.avatarSize, self.avatarSize)
            ||!UIEdgeInsetsEqualToEdgeInsets(layoutAttributes.containerInsets, self.containerInsets)
            || (int)layoutAttributes.spaceBetweenTopLabelAndTextView != (int)self.spaceBetweenTopLabelAndTextView
            || (int)layoutAttributes.spaceBetweenTextViewAndBottomLabel != (int)self.spaceBetweenTextViewAndBottomLabel) {

            return NO;
        }
    }
    return [super isEqual:object];
}

- (NSUInteger)hash {

    return [self.indexPath hash];
}

#pragma mark - NSCopying

- (instancetype)copyWithZone:(NSZone *)zone {

    QMChatCellLayoutAttributes *copy = [super copyWithZone:zone];

    if (copy.representedElementCategory != UICollectionElementCategoryCell) {

        return copy;
    }

    copy.avatarSize = self.avatarSize;
    copy.containerSize = self.containerSize;
    copy.containerInsets = self.containerInsets;
    copy.bottomLabelHeight = self.bottomLabelHeight;
    copy.topLabelHeight = self.topLabelHeight;
    copy.spaceBetweenTextViewAndBottomLabel = self.spaceBetweenTextViewAndBottomLabel;
    copy.spaceBetweenTopLabelAndTextView = self.spaceBetweenTopLabelAndTextView;

    return copy;
}

@end


text:
//
// Copyright (c) Microsoft Corporation.    All rights reserved.
//

namespace Microsoft.CortexM0OnMBED.HardwareModel
{
    using GPIO_FRAMEWORK    = Windows.Devices.Gpio.Provider;
    using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
    using ChipsetModel      = Microsoft.CortexM0OnCMSISCore;

    public class HardwareProvider : ChipsetModel.HardwareProvider
    {
        //
        // Gpio Discovery
        //
        public override int PinCount => Board.Instance.PinCount;

        public override int PinToIndex(int pin)
        {
            return Board.Instance.PinToIndex(pin);
        }

        public override int InvalidPin
        {
            get
            {
                return Board.Instance.NCPin;
            }
        }

        //
        // Serial Discovery
        //

        public override string[] GetSerialPorts()
        {
            return Board.Instance.GetSerialPorts();
        }

        public override bool GetSerialPinsFromPortName(string portName, out int txPin, out int rxPin, out int rtsPin, out int ctsPin)
        {
            ChipsetAbstration.Board.SerialPortInfo portInfo = Board.Instance.GetSerialPortInfo(portName);
            if (portInfo == null)
            {
                int invalidPin = this.InvalidPin;
                txPin = invalidPin;
                rxPin = invalidPin;
                ctsPin = invalidPin;
                rtsPin = invalidPin;
                return false;
            }

            txPin =  portInfo.TxPin;
            rxPin =  portInfo.RxPin;
            ctsPin = portInfo.CtsPin;
            rtsPin = portInfo.RtsPin;
            return true;
        }
    }
}


text:
package org.openrdf.repository.object.compiler;

import info.aduna.net.ParsedURI;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.openrdf.model.BNode;
import org.openrdf.model.Literal;
import org.openrdf.model.Resource;
import org.openrdf.model.Statement;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.impl.ValueFactoryImpl;
import org.openrdf.model.vocabulary.OWL;
import org.openrdf.model.vocabulary.RDF;
import org.openrdf.model.vocabulary.RDFS;
import org.openrdf.model.vocabulary.XMLSchema;
import org.openrdf.repository.object.vocabulary.MSG;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Applies a series of rules against the ontology, making it easier to convert
 * into Java classes. This includes applying some OWL reasoning on properties,
 * renaming anonymous and foreign classes.
 *
 * @author James Leigh
 *
 */
public class OwlNormalizer {
	private final Logger logger = LoggerFactory.getLogger(OwlNormalizer.class);
	private RDFDataSource ds;
	private Set<URI> anonymousClasses = new HashSet<URI>();
	private Map<URI, URI> aliases = new HashMap<URI, URI>();
	private Map<String, String> implNames = new HashMap<String, String>();
	private Set<String> commonNS = new HashSet<String>(Arrays.asList(
			RDF.NAMESPACE, RDFS.NAMESPACE, OWL.NAMESPACE));

	public OwlNormalizer(RDFDataSource ds) {
		this.ds = ds;
	}

	public URI getOriginal(URI alias) {
		if (anonymousClasses.contains(alias))
			return null;
		if (aliases.containsKey(alias))
			return aliases.get(alias);
		return alias;
	}

	public Map<URI, URI> getAliases() {
		return aliases;
	}

	public Set<URI> getAnonymousClasses() {
		return anonymousClasses;
	}

	public Map<String, String> getImplNames() {
		return implNames;
	}

	public void normalize() {
		infer();
		createJavaAnnotations();
		checkPropertyDomains();
		checkPropertyRanges();
		subClassIntersectionOf();
		hasValueFromList();
		subClassOneOf();
		distributeEquivalentClasses();
		renameAnonymousClasses();
		mergeUnionClasses();
		distributeSubMessage();
		checkMessageTargets();
	}

	/**
	 * Treat owl:complementOf, owl:intersectionOf, owl:oneOf, and owl:unionOf as
	 * annotations so they will be saved in the concept header.
	 */
	private void createJavaAnnotations() {
		if (ds.contains(RDFS.LITERAL, null, null)) {
			ds.add(RDFS.LITERAL, RDF.TYPE, RDFS.DATATYPE);
		}
		if (ds.contains(null, RDFS.SUBCLASSOF, null)) {
			ds.add(RDFS.SUBCLASSOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, RDFS.SUBPROPERTYOF, null)) {
			ds.add(RDFS.SUBPROPERTYOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, OWL.EQUIVALENTCLASS, null)) {
			ds.add(OWL.EQUIVALENTCLASS, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, OWL.COMPLEMENTOF, null)) {
			ds.add(OWL.COMPLEMENTOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.COMPLEMENTOF, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.COMPLEMENTOF, RDFS.RANGE, OWL.CLASS);
		}
		if (ds.contains(null, OWL.INTERSECTIONOF, null)) {
			ds.add(OWL.INTERSECTIONOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, OWL.UNIONOF, null)) {
			ds.add(OWL.UNIONOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, OWL.HASVALUE, null)) {
			ds.add(OWL.HASVALUE, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.HASVALUE, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.ONEOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		} else if (ds.contains(null, OWL.ONEOF, null)) {
			ds.add(OWL.ONEOF, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
		}
		if (ds.contains(null, OWL.SOMEVALUESFROM, null)) {
			ds.add(OWL.SOMEVALUESFROM, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.SOMEVALUESFROM, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.SOMEVALUESFROM, RDFS.RANGE, OWL.CLASS);
		}
		if (ds.contains(null, OWL.MAXCARDINALITY, null)) {
			ds.add(OWL.MAXCARDINALITY, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.MAXCARDINALITY, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.MAXCARDINALITY, RDFS.RANGE, XMLSchema.NON_NEGATIVE_INTEGER);
		}
		if (ds.contains(null, OWL.MINCARDINALITY, null)) {
			ds.add(OWL.MINCARDINALITY, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.MINCARDINALITY, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.MINCARDINALITY, RDFS.RANGE, XMLSchema.NON_NEGATIVE_INTEGER);
		}
		if (ds.contains(null, OWL.CARDINALITY, null)) {
			ds.add(OWL.CARDINALITY, RDF.TYPE, OWL.FUNCTIONALPROPERTY);
			ds.add(OWL.CARDINALITY, RDF.TYPE, OWL.ANNOTATIONPROPERTY);
			ds.add(OWL.CARDINALITY, RDFS.RANGE, XMLSchema.NON_NEGATIVE_INTEGER);
		}
	}

	private void infer() {
		logger.debug("inferring");
		ValueFactory vf = getValueFactory();
		propagateSubClassType(RDFS.CLASS);
		symmetric(OWL.INVERSEOF);
		symmetric(OWL.EQUIVALENTCLASS);
		symmetric(OWL.EQUIVALENTPROPERTY);
		symmetric(OWL.DISJOINTWITH);
		setSubjectType(RDF.FIRST, null, RDF.LIST);
		setSubjectType(RDF.REST, null, RDF.LIST);
		setSubjectType(RDFS.SUBCLASSOF, null, OWL.CLASS);
		setSubjectType(OWL.ONEOF, null, OWL.CLASS);
		setSubjectType(OWL.UNIONOF, null, OWL.CLASS);
		setSubjectType(OWL.DISJOINTWITH, null, OWL.CLASS);
		setSubjectType(OWL.COMPLEMENTOF, null, OWL.CLASS);
		setSubjectType(OWL.EQUIVALENTCLASS, null, OWL.CLASS);
		setSubjectType(OWL.INTERSECTIONOF, null, OWL.CLASS);
		setSubjectType(OWL.ONPROPERTY, null, OWL.RESTRICTION);
		setSubjectType(RDF.TYPE, RDFS.CLASS, OWL.CLASS);
		setSubjectType(RDF.TYPE, OWL.DEPRECATEDCLASS, OWL.CLASS);
		setSubjectType(RDF.TYPE, OWL.RESTRICTION, OWL.CLASS);
		setSubjectType(RDF.TYPE, OWL.ANNOTATIONPROPERTY, RDF.PROPERTY);
		setSubjectType(RDF.TYPE, OWL.DEPRECATEDPROPERTY, RDF.PROPERTY);
		setSubjectType(RDF.TYPE, OWL.OBJECTPROPERTY, RDF.PROPERTY);
		setSubjectType(RDF.TYPE, OWL.DATATYPEPROPERTY, RDF.PROPERTY);
		setSubjectType(RDF.TYPE, OWL.FUNCTIONALPROPERTY, RDF.PROPERTY);
		setObjectType(RDFS.SUBCLASSOF, OWL.CLASS);
		setObjectType(OWL.ALLVALUESFROM, OWL.CLASS);
		setObjectType(OWL.ONEOF, RDF.LIST);
		setObjectType(OWL.UNIONOF, RDF.LIST);
		setObjectType(OWL.INTERSECTIONOF, RDF.LIST);
		setObjectType(RDFS.ISDEFINEDBY, OWL.ONTOLOGY);
		setSubjectType(OWL.INVERSEOF, null, OWL.OBJECTPROPERTY);
		setObjectType(OWL.INVERSEOF, OWL.OBJECTPROPERTY);
		setObjectType(RDFS.RANGE, OWL.CLASS);
		setObjectType(RDFS.DOMAIN, OWL.CLASS);
		setSubjectType(RDFS.RANGE, null, RDF.PROPERTY);
		setSubjectType(RDFS.DOMAIN, null, RDF.PROPERTY);
		setSubjectType(RDFS.SUBPROPERTYOF, null, RDF.PROPERTY);
		setObjectType(RDFS.SUBPROPERTYOF, RDF.PROPERTY);
		setDatatype(vf, OWL.CARDINALITY, XMLSchema.NON_NEGATIVE_INTEGER);
		setDatatype(vf, OWL.MINCARDINALITY, XMLSchema.NON_NEGATIVE_INTEGER);
		setDatatype(vf, OWL.MAXCARDINALITY, XMLSchema.NON_NEGATIVE_INTEGER);
		setMemberType(OWL.UNIONOF, OWL.CLASS);
		setMemberType(OWL.INTERSECTIONOF, OWL.CLASS);
	}

	private void setMemberType(URI pred, URI type) {
		for (Value list : ds.match(null, pred, null).objects()) {
			if (list instanceof Resource) {
				RDFList members = new RDFList(ds, (Resource) list);
				for (Value member : members.asList()) {
					if (member instanceof Resource) {
						ds.add((Resource) member, RDF.TYPE, type);
					}
				}
			}
		}
	}

	private void propagateSubClassType(Resource classDef) {
		for (Resource c : findClasses(Collections.singleton(classDef))) {
			if (c.equals(RDFS.DATATYPE))
				continue;
			for (Statement stmt : ds.match(null, RDF.TYPE, c)) {
				Resource subj = stmt.getSubject();
				ds.add(subj, RDF.TYPE, classDef);
			}
		}
	}

	private Set<Resource> findClasses(Collection<Resource> classes) {
		Set<Resource> set = new HashSet<Resource>(classes);
		for (Resource c : classes) {
			for (Statement stmt : ds.match(null, RDFS.SUBCLASSOF, c)) {
				Resource subj = stmt.getSubject();
				set.add(subj);
			}
		}
		if (set.size() > classes.size()) {
			return findClasses(set);
		} else {
			return set;
		}
	}

	private void symmetric(URI pred) {
		for (Statement stmt : ds.match(null, pred, null)) {
			if (stmt.getObject() instanceof Resource) {
				Resource subj = (Resource) stmt.getObject();
				ds.add(subj, pred, stmt.getSubject());
			} else {
				logger.warn("Invalid statement {}", stmt);
			}
		}
	}

	private void setSubjectType(URI pred, Value obj, URI type) {
		for (Statement stmt : ds.match(null, pred, obj)) {
			ds.add(stmt.getSubject(), RDF.TYPE, type);
		}
	}

	private void setObjectType(URI pred, URI type) {
		for (Statement st : ds.match(null, pred, null)) {
			if (st.getObject() instanceof Resource) {
				Resource subj = (Resource) st.getObject();
				ds.add(subj, RDF.TYPE, type);
			} else {
				logger.warn("Invalid statement {}", st);
			}
		}
	}

	private void setDatatype(ValueFactory vf, URI pred, URI datatype) {
		for (Statement stmt : ds.match(null, pred, null)) {
			String label = ((Literal) stmt.getObject()).getLabel();
			Literal literal = vf.createLiteral(label, datatype);
			ds.remove(stmt.getSubject(), pred, stmt.getObject());
			ds.add(stmt.getSubject(), pred, literal);
		}
	}

	private void checkPropertyDomains() {
		loop: for (Statement st : ds.match(null, RDF.TYPE, RDF.PROPERTY)) {
			Resource p = st.getSubject();
			if (!ds.contains(p, RDFS.DOMAIN, null)) {
				for (Value sup : ds.match(p, RDFS.SUBPROPERTYOF, null).objects()) {
					for (Value obj : ds.match(sup, RDFS.DOMAIN, null).objects()) {
						ds.add(p, RDFS.DOMAIN, obj);
						continue loop;
					}
				}
				ds.add(p, RDFS.DOMAIN, RDFS.RESOURCE);
				if (!ds.contains(RDFS.RESOURCE, RDF.TYPE, OWL.CLASS)) {
					ds.add(RDFS.RESOURCE, RDF.TYPE, OWL.CLASS);
				}
			}
		}
	}

	private void checkPropertyRanges() {
		loop: for (Statement st : ds.match(null, RDF.TYPE, RDF.PROPERTY)) {
			Resource p = st.getSubject();
			if (!ds.contains(p, RDFS.RANGE, null)) {
				for (Value sup : ds.match(p, RDFS.SUBPROPERTYOF, null).objects()) {
					for (Value obj : ds.match(sup, RDFS.RANGE, null).objects()) {
						ds.add(p, RDFS.RANGE, obj);
						continue loop;
					}
				}
				ds.add(p, RDFS.RANGE, RDFS.RESOURCE);
			}
		}
	}

	private void distributeSubMessage() {
		boolean changed = false;
		for (Resource msg : ds.match(null, RDFS.SUBCLASSOF, MSG.MESSAGE)
				.subjects()) {
			for (Resource sub : ds.match(null, RDFS.SUBCLASSOF, msg).subjects()) {
				if (!ds.contains(sub, RDFS.SUBCLASSOF, MSG.MESSAGE)) {
					ds.add(sub, RDFS.SUBCLASSOF, MSG.MESSAGE);
					changed = true;
				}
			}
		}
		if (changed) {
			distributeSubMessage();
		}
	}

	private void checkMessageTargets() {
		for (Resource msg : ds.match(null, RDFS.SUBCLASSOF, MSG.MESSAGE)
				.subjects()) {
			getOrAddTargetRestriction(msg);
		}
	}

	private Value getOrAddTargetRestriction(Resource msg) {
		for (Value res : ds.match(msg, RDFS.SUBCLASSOF, null).objects()) {
			if (ds.contains(res, OWL.ONPROPERTY, MSG.TARGET)) {
				return res;
			}
		}
		Map<Value,Value> restrictions = new LinkedHashMap<Value, Value>();
		for (Value sup : ds.match(msg, RDFS.SUBCLASSOF, null).objects()) {
			if (sup instanceof URI) {
				Value res = getOrAddTargetRestriction((URI) sup);
				if (res != null) {
					restrictions.put(sup, res);
				}
			}
		}
		if (!restrictions.isEmpty()) {
			loop: for (Value sup1 : restrictions.keySet()) {
				for (Value sup2 : restrictions.keySet()) {
					if (sup1 != sup2
							&& ds.contains(sup2, RDFS.SUBCLASSOF, sup1)) {
						continue loop;
					}
				}
				Value res = restrictions.get(sup1);
				ds.add(msg, RDFS.SUBCLASSOF, res);
				return res;
			}
		}
		ValueFactory vf = getValueFactory();
		BNode res = vf.createBNode();
		ds.add(msg, RDFS.SUBCLASSOF, res);
		ds.add(res, RDF.TYPE, OWL.RESTRICTION);
		ds.add(res, OWL.ONPROPERTY, MSG.TARGET);
		ds.add(res, OWL.ALLVALUESFROM, RDFS.RESOURCE);
		ds.add(RDFS.RESOURCE, RDF.TYPE, OWL.CLASS);
		return res;
	}

	private ValueFactory getValueFactory() {
		return ValueFactoryImpl.getInstance();
	}

	private void hasValueFromList() {
		ValueFactory vf = getValueFactory();
		for (Statement st : ds.match(null, OWL.HASVALUE, null)) {
			Resource res = st.getSubject();
			Value obj = st.getObject();
			if (obj instanceof Resource) {
				BNode node = vf.createBNode();
				ds.add(res, OWL.ALLVALUESFROM, node);
				ds.add(node, RDF.TYPE, OWL.CLASS);
				BNode list = vf.createBNode();
				ds.add(node, OWL.ONEOF, list);
				ds.add(list, RDF.TYPE, RDF.LIST);
				ds.add(list, RDF.FIRST, obj);
				ds.add(list, RDF.REST, RDF.NIL);
				for (Value type : ds.match(obj, RDF.TYPE, null).objects()) {
					ds.add(node, RDFS.SUBCLASSOF, type);
				}
				for (Value prop : ds.match(res, OWL.ONPROPERTY, null).objects()) {
					for (Value range : ds.match(prop, RDFS.RANGE, null).objects()) {
						ds.add(node, RDFS.SUBCLASSOF, range);
					}
					for (Resource cls : ds.match(null, RDFS.SUBCLASSOF, res).subjects()) {
						for (Value sup : findSuperClasses(cls)) {
							if (!sup.equals(res) && !ds.match(sup, OWL.ONPROPERTY, prop).isEmpty()) {
								for (Value from : ds.match(sup, OWL.ALLVALUESFROM, null).objects()) {
									ds.add(node, RDFS.SUBCLASSOF, from);
								}
							}
						}
					}
				}
			}
		}
	}

	private void subClassOneOf() {
		for (Statement st : ds.match(null, OWL.ONEOF, null)) {
			Set<Value> common = null;
			for (Value of : new RDFList(ds, st.getObject()).asList()) {
				Set<Value> types = ds.match(of, RDF.TYPE, null).objects();
				if (types.isEmpty()) {
					common = Collections.emptySet();
				} else {
					Set<Value> supers = new HashSet<Value>();
					for (Value type : types) {
						if (type instanceof Resource) {
							supers.addAll(findSuperClasses((Resource) type));
						}
					}
					if (common == null) {
						common = new HashSet<Value>(supers);
					} else {
						common.retainAll(supers);
					}
				}
			}
			if (common != null) {
				for (Value s : common) {
					ds.add(st.getSubject(), RDFS.SUBCLASSOF, s);
					if (OWL.CLASS.equals(s)) {
						ds.add(OWL.CLASS, RDF.TYPE, OWL.CLASS);
					}
				}
			}
		}
	}

	private void subClassIntersectionOf() {
		for (Statement st : ds.match(null, OWL.INTERSECTIONOF, null)) {
			if (st.getObject() instanceof Resource) {
				RDFList list = new RDFList(ds, (Resource) st.getObject());
				for (Value member : list.asList()) {
					ds.add(st.getSubject(), RDFS.SUBCLASSOF, member);
				}
			}
		}
	}

	private void renameAnonymousClasses() {
		for (Resource res : ds.match(null, RDF.TYPE, OWL.CLASS).subjects()) {
			if (res instanceof URI)
				continue;
			// if not already moved
			nameAnonymous(res);
		}
	}

	private URI nameAnonymous(Resource clazz) {
		for (Value eq : ds.match(clazz, OWL.EQUIVALENTCLASS, null).objects()) {
			if (eq instanceof URI) {
				nameClass(clazz, (URI) eq);
				return (URI) eq;
			}
		}
		Resource unionOf = ds.match(clazz, OWL.UNIONOF, null).objectResource();
		if (unionOf != null) {
			return renameClass("", clazz, "Or", new RDFList(ds, unionOf)
					.asList());
		}
		Resource intersectionOf = ds.match(clazz, OWL.INTERSECTIONOF, null)
				.objectResource();
		if (intersectionOf != null) {
			return renameClass("", clazz, "And", new RDFList(ds,
					intersectionOf).asList());
		}
		Resource oneOf = ds.match(clazz, OWL.ONEOF, null).objectResource();
		if (oneOf != null) {
			return renameClass("Is", clazz, "Or", new RDFList(ds, oneOf)
					.asList());
		}
		Resource complement = ds.match(clazz, OWL.COMPLEMENTOF, null)
				.objectResource();
		if (complement != null) {
			URI comp = complement instanceof URI ? (URI) complement : null;
			if (comp == null) {
				comp = nameAnonymous(complement);
				if (comp == null)
					return null;
			}
			String name = "Not" + comp.getLocalName();
			URI uri = new URIImpl(comp.getNamespace() + name);
			nameClass(clazz, uri);
			return uri;
		}
		if (ds.contains(clazz, MSG.MATCHING, null)) {
			return renameClass("", clazz, "Or", ds.match(clazz, MSG.MATCHING, null)
					.objects());
		}
		return null;
	}

	private void distributeEquivalentClasses() {
		for (Statement st : ds.match(null, OWL.EQUIVALENTCLASS, null)) {
			Resource subj = st.getSubject();
			Value equiv = st.getObject();
			for (Value v : ds.match(equiv, OWL.EQUIVALENTCLASS, null).objects()) {
				ds.add(subj, OWL.EQUIVALENTCLASS, v);
			}
			ds.remove(subj, OWL.EQUIVALENTCLASS, subj);
		}
		for (Statement st : ds.match(null, OWL.EQUIVALENTCLASS, null)) {
			Resource subj = st.getSubject();
			Value e = st.getObject();
			if (!(subj instanceof URI))
				continue;
			for (Value d : ds.match(e, OWL.DISJOINTWITH, null).objects()) {
				ds.add(subj, OWL.DISJOINTWITH, d);
			}
			if (ds.contains(e, OWL.INTERSECTIONOF, null)) {
				Resource cinter = ds.match(subj, OWL.INTERSECTIONOF, null)
						.objectResource();
				Resource inter = ds.match(e, OWL.INTERSECTIONOF, null)
						.objectResource();
				if (cinter == null) {
					ds.add(subj, OWL.INTERSECTIONOF, inter);
				} else if (!inter.equals(cinter)) {
					new RDFList(ds, cinter)
							.addAllOthers(new RDFList(ds, inter));
				}
			}
			if (ds.contains(e, OWL.ONEOF, null)) {
				Resource co = ds.match(subj, OWL.ONEOF, null).objectResource();
				Resource eo = ds.match(e, OWL.ONEOF, null).objectResource();
				if (co == null) {
					ds.add(subj, OWL.ONEOF, ds.match(e, OWL.ONEOF, null)
							.objectResource());
				} else if (!eo.equals(co)) {
					new RDFList(ds, co).addAllOthers(new RDFList(ds, eo));
				}
			}
			if (ds.contains(e, OWL.UNIONOF, null)) {
				for (Value elist : ds.match(e, OWL.UNIONOF, null).objects()) {
					if (!ds.contains(subj, OWL.UNIONOF, null)) {
						ds.add(subj, OWL.UNIONOF, elist);
					} else if (!ds.contains(subj, OWL.UNIONOF, elist)) {
						for (Value clist : ds.match(subj, OWL.UNIONOF, null)
								.objects()) {
							new RDFList(ds, (Resource) clist)
									.addAllOthers(new RDFList(ds,
											(Resource) elist));
						}
					}
				}
			}
			if (ds.contains(e, OWL.COMPLEMENTOF, null)) {
				if (!ds.contains(subj, OWL.COMPLEMENTOF, null)) {
					Resource comp = ds.match(e, OWL.COMPLEMENTOF, null)
							.objectResource();
					ds.add(subj, OWL.COMPLEMENTOF, comp);
				}
			}
			if (ds.contains(e, OWL.DISJOINTWITH, null)) {
				for (Value d : ds.match(e, OWL.DISJOINTWITH, null).objects()) {
					ds.add(subj, OWL.DISJOINTWITH, d);
				}
			}
			if (ds.contains(e, RDFS.SUBCLASSOF, null)) {
				for (Value d : ds.match(e, RDFS.SUBCLASSOF, null).objects()) {
					ds.add(subj, RDFS.SUBCLASSOF, d);
				}
			}
			if (ds.contains(e, RDF.TYPE, OWL.RESTRICTION)) {
				ds.add(subj, RDFS.SUBCLASSOF, e);
			}
		}
	}

	private void mergeUnionClasses() {
		for (Resource subj : ds.match(null, RDF.TYPE, OWL.CLASS).subjects()) {
			List<Value> unionOf = new ArrayList<Value>();
			for (Value obj : ds.match(subj, OWL.UNIONOF, null).objects()) {
				if (obj instanceof Resource) {
					List<? extends Value> list = new RDFList(ds,
							(Resource) obj).asList();
					list.removeAll(unionOf);
					unionOf.addAll(list);
				}
			}
			if (!unionOf.isEmpty()) {
				Set<URI> common = findCommonSupers(unionOf);
				if (common.contains(subj)) {
					// if union contains itself then remove it
					ds.remove(subj, OWL.UNIONOF, null);
					continue;
				} else if (findCommon(common, unionOf) != null) {
					// if union includes the common super class then fold
					// together
					URI sup = findCommon(common, unionOf);
					ds.remove(subj, OWL.UNIONOF, null);
					nameClass(subj, sup);
					continue;
				}
				for (URI c : common) {
					ds.add(subj, RDFS.SUBCLASSOF, c);
				}
				for (Value ofValue : unionOf) {
					if (ds.contains(ofValue, RDF.TYPE, RDFS.DATATYPE)
							&& ofValue instanceof URI) {
						// don't use anonymous class for datatypes
						nameClass(subj, (URI) ofValue);
					} else {
						ds.add((Resource) ofValue, RDFS.SUBCLASSOF, subj);
					}
				}
			}
		}
	}

	private URI findCommon(Set<URI> common, Collection<? extends Value> unionOf) {
		URI result = null;
		for (Value e : unionOf) {
			if (common.contains(e)) {
				result = (URI) e;
			}
		}
		return result;
	}

	private Set<URI> findCommonSupers(List<? extends Value> unionOf) {
		Set<? extends Value> common = null;
		for (Value of : unionOf) {
			if (of instanceof Resource) {
				Set<Value> supers = findSuperClasses((Resource) of);
				if (common == null) {
					common = new HashSet<Value>(supers);
				} else {
					common.retainAll(supers);
				}
			}
		}
		if (common == null)
			return Collections.emptySet();
		Iterator<? extends Value> iter = common.iterator();
		while (iter.hasNext()) {
			if (!(iter.next() instanceof URI)) {
				iter.remove();
			}
		}
		return (Set<URI>) common;
	}

	private Set<Value> findSuperClasses(Resource of) {
		HashSet<Value> set = new HashSet<Value>();
		set.add(of);
		return findSuperClasses(of, set);
	}

	private Set<Value> findSuperClasses(Resource of, Set<Value> supers) {
		Set<Value> parent = ds.match(of, RDFS.SUBCLASSOF, null).objects();
		if (supers.addAll(parent)) {
			for (Value s : parent) {
				if (s instanceof Resource) {
					findSuperClasses((Resource) s, supers);
				}
			}
		}
		return supers;
	}

	private URI renameClass(String prefix, Resource clazz, String and,
			Collection<? extends Value> list) {
		String namespace = null;
		Set<String> names = new TreeSet<String>();
		Set<String> others = new TreeSet<String>();
		for (Value of : list) {
			URI uri = null;
			if (of instanceof URI) {
				uri = (URI) of;
			} else if (of instanceof Literal) {
				String label = of.stringValue();
				StringBuilder sb = new StringBuilder();
				if (!label.contains(":")) {
					sb.append(getMatchNamespace(clazz));
				}
				if (label.startsWith("*")) {
					sb.append(label.replace("*", "Star"));
				} else if (label.endsWith("*")) {
					sb.append(label, 0, label.length() - 1);
				} else {
					sb.append(label);
				}
				if (label.startsWith("/")) {
					sb.append("Path");
				}
				if (label.endsWith("*")) {
					sb.append("Prefix");
				} else if (label.startsWith("*")) {
					sb.append("Suffix");
				}
				uri = new URIImpl(sb.toString());
			} else if (ds.contains(of, RDF.TYPE, OWL.CLASS)) {
				uri = nameAnonymous((Resource) of);
			}
			if (uri != null && (namespace == null || commonNS.contains(namespace))) {
				namespace = uri.getNamespace();
			}
			if (uri == null) {
				others.add(of.stringValue());
			} else if (uri.getLocalName().length() > 0) {
				names.add(uri.getLocalName());
			} else {
				String str = uri.stringValue();
				Matcher m = Pattern.compile("\\b[a-zA-Z]\\w*\\b").matcher(str);
				while (m.find()) {
					str = m.group();
				}
				names.add(str);
			}
		}
		if (names.isEmpty())
			return null;
		StringBuilder sb = new StringBuilder();
		sb.append(prefix);
		for (String localPart : names) {
			sb.append(initcap(localPart));
			sb.append(and);
		}
		for (String localPart : others) {
			sb.append(initcap(localPart));
			sb.append(and);
		}
		sb.setLength(sb.length() - and.length());
		URIImpl dest = new URIImpl(namespace + sb.toString());
		nameClass(clazz, dest);
		return dest;
	}

	private CharSequence getMatchNamespace(Resource clazz) {
		for (Resource graph : ds.match(clazz, null, null).contexts()) {
			if (graph instanceof URI) {
				return getMatchNamespace(graph);
			}
		}
		// this shouldn't happen, but just in case
		return "urn:matches:";
	}

	private CharSequence getMatchNamespace(URI ontology) {
		StringBuilder sb = new StringBuilder();
		ParsedURI parsed = new ParsedURI(ontology.stringValue());
		if (parsed.getScheme() != null) {
			sb.append(parsed.getScheme());
			sb.append(':');
		}
		if (parsed.isOpaque()) {
			if (parsed.getSchemeSpecificPart() != null) {
				sb.append(parsed.getSchemeSpecificPart());
			}
		} else {
			if (parsed.getAuthority() != null) {
				sb.append("//");
				sb.append(parsed.getAuthority());
			}
			sb.append(parsed.getPath());
			sb.append("#");
		}
		return sb;
	}

	private void nameClass(Resource orig, URI dest) {
		if (ds.contains(dest, RDF.TYPE, OWL.CLASS)) {
			logger.debug("merging {} {}", orig, dest);
		} else {
			logger.debug("renaming {} {}", orig, dest);
			ds.add(dest, RDF.TYPE, OWL.CLASS);
			anonymousClasses.add(dest);
		}
		rename(orig, dest);
	}

	private void rename(Resource orig, Resource dest) {
		for (Statement stmt : ds.match(orig, null, null)) {
			ds.add(dest, stmt.getPredicate(), stmt.getObject());
		}
		ds.remove(orig, null, null);
		for (Statement stmt : ds.match(null, null, orig)) {
			ds.add(stmt.getSubject(), stmt.getPredicate(), dest);
		}
		ds.remove((Resource) null, null, orig);
	}

	private String initcap(String str) {
		if (str.length() < 2)
			return str.toUpperCase();
		return str.substring(0, 1).toUpperCase() + str.substring(1);
	}
}


text:
using UnityEditor;
using UnityEngine;

namespace Foundation.Editor
{
    public class DeletePlayerPrefsEditor
    {
        [MenuItem("Tools/Foundation/Delete All Player Prefs")]
        public static void CreateAppServices()
        {
            PlayerPrefs.DeleteAll();
            Debug.Log("PlayerPrefs.DeleteAll();");
        }
    }
}


text:
class CreateGames < ActiveRecord::Migration
  def self.up
    ActiveRecord::Base.create_ratings_table

    create_table :games do |t|
      t.string :title, :null => false
      t.string :screenshot
      t.integer :views, :rating_count, :null => false, :default => 0
      t.decimal :rating_total, :default => 0
      t.decimal :rating_avg, :precision => 10, :scale => 2, :default => 0
      t.boolean :featured, :active, :nudity, :violence, :language, :default => false
      t.text :description, :null => false
      t.references :user, :category, :null => false
      t.timestamp :featured_at
      t.timestamps
    end

    add_index(:games, [:user_id, :category_id, :title])
  end

  def self.down
    drop_table :games

    ActiveRecord::Base.drop_ratings_table
  end
end


text:
+++
title = "What's new in gb, 2015-08-19"
date = "2015-08-19"
+++

An update on the changes that have landed in gb in the last week.

- cgo and pkg-config
- Actions, Tasks, and Executors
- New build flags
- Bug fixes
- Stickers

<!--more-->

## cgo and pkg-config

Many cgo bugs related to pkg-config have been [closed over the past week](https://github.com/constabulary/gb/issues?q=milestone%3Acgo+is%3Aclosed). If you have experienced issues related to cgo in the past, please take the opportunity to try again and send feedback.

## Actions, Tasks, and Executors

Internal to gb, the method of describing the dependencies between build (and test) steps, previously known as Targets, has been [completely rewritten](https://github.com/constabulary/gb/pull/305). This rewrite makes it easier to understand how the steps involved in a build plan fit together and in turn will make it easier to address [issue #32](https://github.com/constabulary/gb/issues/32) which is part of the [cross compilation milestone](https://github.com/constabulary/gb/milestones/cross-compilation).

## New build flags

gb has grown two new flags for `build` and `test`:

- `-P n` controls the number of parallel build jobs to run, this includes tests. The value of `-P` defaults to the value of `runtime.NumCPU`, which mirrors the behaviour of the similar flag from the go tool.
- `-dotfile $filename`, if present, will cause a graphviz dot file to be written to the file. The dot file represents the steps that were taking in the current build or test invocation. The shape of this graph is influenced by conditional compilation (only steps that need to be done will appear in the graph), and can become very large quickly making the dot file difficult to graph. Here is [an example](https://cloud.githubusercontent.com/assets/7171/9322968/30588f34-45be-11e5-9267-753880525080.png).

## Bug fixes

- a bug that prevented `gb list` from working anywhere but in the project root has been fixed.

## Stickers

Tweet a link to your gb project and tag it with `#gb` and `#golang` and we'll send you some stickers. Offer is good until we run out of stickers, or postage money, whichever the sooner.


text:
require 'abstract_unit'
require 'fixtures/person'
require 'fixtures/street_address'

class CustomMethodsTest < Test::Unit::TestCase
  def setup
    @matz  = { :id => 1, :name => 'Matz' }.to_xml(:root => 'person')
    @matz_deep  = { :id => 1, :name => 'Matz', :other => 'other' }.to_xml(:root => 'person')
    @matz_array = [{ :id => 1, :name => 'Matz' }].to_xml(:root => 'people')
    @ryan  = { :name => 'Ryan' }.to_xml(:root => 'person')
    @addy  = { :id => 1, :street => '12345 Street' }.to_xml(:root => 'address')
    @addy_deep  = { :id => 1, :street => '12345 Street', :zip => "27519" }.to_xml(:root => 'address')

    ActiveResource::HttpMock.respond_to do |mock|
      mock.get    "/people/1.xml",             {}, @matz
      mock.get    "/people/1/shallow.xml", {}, @matz
      mock.get    "/people/1/deep.xml", {}, @matz_deep
      mock.get    "/people/retrieve.xml?name=Matz", {}, @matz_array
      mock.get    "/people/managers.xml", {}, @matz_array
      mock.post   "/people/hire.xml?name=Matz", {}, nil, 201
      mock.put    "/people/1/promote.xml?position=Manager", {}, nil, 204
      mock.put    "/people/promote.xml?name=Matz", {}, nil, 204, {}
      mock.put    "/people/sort.xml?by=name", {}, nil, 204
      mock.delete "/people/deactivate.xml?name=Matz", {}, nil, 200
      mock.delete "/people/1/deactivate.xml", {}, nil, 200
      mock.post   "/people/new/register.xml",      {}, @ryan, 201, 'Location' => '/people/5.xml'
      mock.post   "/people/1/register.xml", {}, @matz, 201
      mock.get    "/people/1/addresses/1.xml", {}, @addy
      mock.get    "/people/1/addresses/1/deep.xml", {}, @addy_deep
      mock.put    "/people/1/addresses/1/normalize_phone.xml?locale=US", {}, nil, 204
      mock.put    "/people/1/addresses/sort.xml?by=name", {}, nil, 204
      mock.post   "/people/1/addresses/new/link.xml", {}, { :street => '12345 Street' }.to_xml(:root => 'address'), 201, 'Location' => '/people/1/addresses/2.xml'
    end

    Person.user = nil
    Person.password = nil
  end

  def teardown
    ActiveResource::HttpMock.reset!
  end

  def test_custom_collection_method
    # GET
    assert_equal([{ "id" => 1, "name" => 'Matz' }], Person.get(:retrieve, :name => 'Matz'))

    # POST
    assert_equal(ActiveResource::Response.new("", 201, {}), Person.post(:hire, :name => 'Matz'))

    # PUT
    assert_equal ActiveResource::Response.new("", 204, {}),
                   Person.put(:promote, {:name => 'Matz'}, 'atestbody')
    assert_equal ActiveResource::Response.new("", 204, {}), Person.put(:sort, :by => 'name')

    # DELETE
    Person.delete :deactivate, :name => 'Matz'

    # Nested resource
    assert_equal ActiveResource::Response.new("", 204, {}), StreetAddress.put(:sort, :person_id => 1, :by => 'name')
  end

  def test_custom_element_method
    # Test GET against an element URL
    assert_equal Person.find(1).get(:shallow), {"id" => 1, "name" => 'Matz'}
    assert_equal Person.find(1).get(:deep), {"id" => 1, "name" => 'Matz', "other" => 'other'}

    # Test PUT against an element URL
    assert_equal ActiveResource::Response.new("", 204, {}), Person.find(1).put(:promote, {:position => 'Manager'}, 'body')

    # Test DELETE against an element URL
    assert_equal ActiveResource::Response.new("", 200, {}), Person.find(1).delete(:deactivate)

    # With nested resources
    assert_equal StreetAddress.find(1, :params => { :person_id => 1 }).get(:deep),
                  { "id" => 1, "street" => '12345 Street', "zip" => "27519" }
    assert_equal ActiveResource::Response.new("", 204, {}),
                   StreetAddress.find(1, :params => { :person_id => 1 }).put(:normalize_phone, :locale => 'US')
  end

  def test_custom_new_element_method
    # Test POST against a new element URL
    ryan = Person.new(:name => 'Ryan')
    assert_equal ActiveResource::Response.new(@ryan, 201, {'Location' => '/people/5.xml'}), ryan.post(:register)
    expected_request = ActiveResource::Request.new(:post, '/people/new/register.xml', @ryan)
    assert_equal expected_request.body, ActiveResource::HttpMock.requests.first.body

    # Test POST against a nested collection URL
    addy = StreetAddress.new(:street => '123 Test Dr.', :person_id => 1)
    assert_equal ActiveResource::Response.new({ :street => '12345 Street' }.to_xml(:root => 'address'),
                   201, {'Location' => '/people/1/addresses/2.xml'}),
                 addy.post(:link)

    matz = Person.new(:id => 1, :name => 'Matz')
    assert_equal ActiveResource::Response.new(@matz, 201), matz.post(:register)
  end

  def test_find_custom_resources
    assert_equal 'Matz', Person.find(:all, :from => :managers).first.name
  end
end


text:
package vgrechka.phizdetsidea.phizdets.codeInsight.intentions;

import com.intellij.util.containers.ContainerUtil;
import vgrechka.phizdetsidea.phizdets.psi.LanguageLevel;
import vgrechka.phizdetsidea.phizdets.psi.PySequenceExpression;
import vgrechka.phizdetsidea.phizdets.psi.PySetLiteralExpression;
import vgrechka.phizdetsidea.phizdets.psi.PyTargetExpression;
import org.jetbrains.annotations.NotNull;

/**
 * @author Mikhail Golubev
 */
public class PyConvertLiteralToSetIntention extends PyBaseConvertCollectionLiteralIntention {
  public PyConvertLiteralToSetIntention() {
    super(PySetLiteralExpression.class, "set", "{", "}");
  }

  @Override
  protected boolean isAvailableForCollection(@NotNull PySequenceExpression literal) {
    return !literal.isEmpty() && LanguageLevel.forElement(literal).isAtLeast(LanguageLevel.PYTHON27) && !isInTargetPosition(literal);
  }

  private static boolean isInTargetPosition(@NotNull PySequenceExpression sequenceLiteral) {
    return ContainerUtil.exists(sequenceLiteral.getElements(), expression -> expression instanceof PyTargetExpression);
  }
}


text:
namespace Figures
{
    using System;

    public class Rectangle : Figure
    {
        private double height;
        private double width;

        public Rectangle(double width, double height)
        {
            this.Height = height;
            this.Width = width;
        }

        public double Height
        {
            get
            {
                return this.height;
            }

            private set
            {
                if (value < 0)
                {
                    throw new ArgumentException("Height cannot be negative.");
                }

                this.height = value;
            }
        }

        public double Width
        {
            get
            {
                return this.width;
            }

            private set
            {
                if (value < 0)
                {
                    throw new ArgumentException("Width cannot be negative.");
                }

                this.width = value;
            }
        }

        public override double CalcPerimeter()
        {
            double perimeter = 2 * (this.Width + this.Height);
            return perimeter;
        }

        public override double CalcArea()
        {
            double area = this.Width * this.Height;
            return area;
        }
    }
}


text:
haproxy-statsd
--------------
This script reports stats to statsd using [haproxy's](http://haproxy.1wt.eu/) stats interface. [See Stats Interface Demo](http://demo.1wt.eu/) ([CSV](http://demo.1wt.eu/;csv)).

Supported with Python 2.6 and Python 2.7.

Usage
-----
```
usage: report_haproxy.py [-h] [-c CONFIG] [-1]

Report haproxy stats to statsd

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Config file location
  -1, --once        Run once and exit
```
Configuration via environment
-------------------------------
```
STATSD_HOST=127.0.0.1 \
STATSD_PORT=8125 \
STATSD_NAMESPACE=haproxy \
HAPROXY_HOST=127.0.0.1 \
HAPROXY_USER=stats \
HAPROXY_PASS=stats \
report_haproxy.py
```

Config file
-----------
Default location is ./haproxy-statsd.conf.

```
[haproxy-statsd]
haproxy_url = http://127.0.0.1:1936/;csv
haproxy_user =
haproxy_password =
statsd_host = 127.0.0.1
statsd_port = 8125
statsd_namespace = haproxy.(HOSTNAME)
interval = 5
```

Statsd Paths
------------
All metrics are reported with paths matching this format:

    stats.gauges.[namespace].[pxname].[svname].[statname]

The following stats are monitored: scur, smax, ereq, econ, rate, bin, bout, hrsp_1xx, hrsp_2xx, hrsp_3xx, hrsp_4xx, hrsp_5xx, qtime, ctime, rtime, ttime.

For more information about those metrics please refer to: [HAProxy' stats](http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.1) documentation.


text:
package kieker.tools.trace.analysis.filter.traceWriter;

import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;

import kieker.analysis.IProjectContext;
import kieker.analysis.plugin.annotation.InputPort;
import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.annotation.Property;
import kieker.analysis.plugin.annotation.RepositoryPort;
import kieker.common.configuration.Configuration;
import kieker.tools.trace.analysis.filter.AbstractMessageTraceProcessingFilter;
import kieker.tools.trace.analysis.filter.AbstractTraceAnalysisFilter;
import kieker.tools.trace.analysis.systemModel.MessageTrace;
import kieker.tools.trace.analysis.systemModel.repository.SystemModelRepository;

/**
 *
 * @author Andre van Hoorn
 *
 * @since 1.2
 * @deprecated 1.15 ported to teetime
 */
@Deprecated
@Plugin(description = "A filter allowing to write the incoming MessageTraces into a configured file", repositoryPorts = {
	@RepositoryPort(name = AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, repositoryType = SystemModelRepository.class)
}, configuration = {
	@Property(name = MessageTraceWriterFilter.CONFIG_PROPERTY_NAME_OUTPUT_FN, defaultValue = "messageTraces-yyyyMMdd-HHmmssSSS.txt")
})
public class MessageTraceWriterFilter extends AbstractMessageTraceProcessingFilter {

	/** The name of the configuration determining the output file name. */
	public static final String CONFIG_PROPERTY_NAME_OUTPUT_FN = "outputFn";

	private static final String ENCODING = "UTF-8";

	private final String outputFn;
	private final PrintStream ps;

	/**
	 * Creates a new instance of this class using the given parameters.
	 *
	 * @param configuration
	 *            The configuration for this component.
	 * @param projectContext
	 *            The project context for this component.
	 *
	 * @throws IOException
	 *             If either the default encoding is not supported or the given file is somehow invalid.
	 */
	public MessageTraceWriterFilter(final Configuration configuration, final IProjectContext projectContext) throws IOException {
		super(configuration, projectContext);

		this.outputFn = this.configuration.getStringProperty(CONFIG_PROPERTY_NAME_OUTPUT_FN);
		this.ps = new PrintStream(Files.newOutputStream(Paths.get(this.outputFn)), false, ENCODING);
	}

	@Override
	public void printStatusMessage() {
		super.printStatusMessage();
		final int numTraces = this.getSuccessCount();
		LOGGER.debug("Wrote {} trace{} to file '{}'", numTraces, (numTraces > 1 ? "s" : ""), this.outputFn); // NOCS
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void terminate(final boolean error) {
		if (this.ps != null) {
			this.ps.close();
		}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Configuration getCurrentConfiguration() {
		final Configuration configuration = super.getCurrentConfiguration();

		configuration.setProperty(CONFIG_PROPERTY_NAME_OUTPUT_FN, this.outputFn);

		return configuration;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	@InputPort(name = AbstractMessageTraceProcessingFilter.INPUT_PORT_NAME_MESSAGE_TRACES, description = "Receives message traces to be processed",
			eventTypes = MessageTrace.class)
	public void inputMessageTraces(final MessageTrace mt) {
		MessageTraceWriterFilter.this.ps.println(mt.toString());
		MessageTraceWriterFilter.this.reportSuccess(mt.getTraceId());
	}
}


text:
OroCronBundle introduces a command used in the crontab configuration and in the interface which allows to define the console commands execution schedule.

## Usage

All you need is to add `oro:cron` command to a system cron (on *nix systems), for example:

``` bash
*/1 * * * * /usr/local/bin/php /path/to/bin/console --env=prod oro:cron >> /dev/null
```

On Windows you can use Task Scheduler from Control Panel.

If you want to make your console command auto-scheduled need to do following:

 - rename your command to start with `oro:cron:`
 - your command should implement `Oro\Bundle\CronBundle\Command\CronCommandInterface`

OR

- add new record to entity `Oro\Bundle\CronBundle\Entity\Schedule`

## Synchronous CRON commands

By default, all CRON commands are executed asynchronously by sending a message to the queue.

Sometimes it is necessary to execute a CRON command immediately when CRON triggers it, without sending the message to the queue.

To do this, a CRON command should implement interface [SynchronousCommandInterface](./Command/SynchronousCommandInterface.php).

In this case, the command will be executed as a background process.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
org.springframework.web.portlet (Spring Framework API 2.5)
</TITLE>

<META NAME="date" CONTENT="2007-11-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

org.springframework.web.portlet

Interfaces

HandlerAdapter

HandlerExceptionResolver

HandlerInterceptor

HandlerMapping

Classes

DispatcherPortlet

FrameworkPortlet

GenericPortletBean

HandlerExecutionChain

ModelAndView

Exceptions

ModelAndViewDefiningException


text:
namespace FIX43
{

  class MassQuote : public Message
  {
  public:
    MassQuote() : Message(MsgType()) {}
    MassQuote(const FIX::Message& m) : Message(m) {}
    MassQuote(const Message& m) : Message(m) {}
    MassQuote(const MassQuote& m) : Message(m) {}
    static FIX::MsgType MsgType() { return FIX::MsgType("i"); }

    MassQuote(
      const FIX::QuoteID& aQuoteID )
    : Message(MsgType())
    {
      set(aQuoteID);
    }

    FIELD_SET(*this, FIX::QuoteReqID);
    FIELD_SET(*this, FIX::QuoteID);
    FIELD_SET(*this, FIX::QuoteType);
    FIELD_SET(*this, FIX::QuoteResponseLevel);
    FIELD_SET(*this, FIX::NoPartyIDs);
    class NoPartyIDs: public FIX::Group
    {
    public:
    NoPartyIDs() : FIX::Group(453,448,FIX::message_order(448,447,452,523,0)) {}
      FIELD_SET(*this, FIX::PartyID);
      FIELD_SET(*this, FIX::PartyIDSource);
      FIELD_SET(*this, FIX::PartyRole);
      FIELD_SET(*this, FIX::PartySubID);
    };
    FIELD_SET(*this, FIX::Account);
    FIELD_SET(*this, FIX::AccountType);
    FIELD_SET(*this, FIX::DefBidSize);
    FIELD_SET(*this, FIX::DefOfferSize);
    FIELD_SET(*this, FIX::NoQuoteSets);
    class NoQuoteSets: public FIX::Group
    {
    public:
    NoQuoteSets() : FIX::Group(296,302,FIX::message_order(302,311,312,309,305,457,462,463,310,313,542,315,241,242,243,244,245,246,256,595,592,593,594,247,316,317,436,435,308,306,362,363,307,364,365,367,304,295,0)) {}
      FIELD_SET(*this, FIX::QuoteSetID);
      FIELD_SET(*this, FIX::UnderlyingSymbol);
      FIELD_SET(*this, FIX::UnderlyingSymbolSfx);
      FIELD_SET(*this, FIX::UnderlyingSecurityID);
      FIELD_SET(*this, FIX::UnderlyingSecurityIDSource);
      FIELD_SET(*this, FIX::UnderlyingProduct);
      FIELD_SET(*this, FIX::UnderlyingCFICode);
      FIELD_SET(*this, FIX::UnderlyingSecurityType);
      FIELD_SET(*this, FIX::UnderlyingMaturityMonthYear);
      FIELD_SET(*this, FIX::UnderlyingMaturityDate);
      FIELD_SET(*this, FIX::UnderlyingPutOrCall);
      FIELD_SET(*this, FIX::UnderlyingCouponPaymentDate);
      FIELD_SET(*this, FIX::UnderlyingIssueDate);
      FIELD_SET(*this, FIX::UnderlyingRepoCollateralSecurityType);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseTerm);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseRate);
      FIELD_SET(*this, FIX::UnderlyingFactor);
      FIELD_SET(*this, FIX::UnderlyingCreditRating);
      FIELD_SET(*this, FIX::UnderlyingInstrRegistry);
      FIELD_SET(*this, FIX::UnderlyingCountryOfIssue);
      FIELD_SET(*this, FIX::UnderlyingStateOrProvinceOfIssue);
      FIELD_SET(*this, FIX::UnderlyingLocaleOfIssue);
      FIELD_SET(*this, FIX::UnderlyingRedemptionDate);
      FIELD_SET(*this, FIX::UnderlyingStrikePrice);
      FIELD_SET(*this, FIX::UnderlyingOptAttribute);
      FIELD_SET(*this, FIX::UnderlyingContractMultiplier);
      FIELD_SET(*this, FIX::UnderlyingCouponRate);
      FIELD_SET(*this, FIX::UnderlyingSecurityExchange);
      FIELD_SET(*this, FIX::UnderlyingIssuer);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuerLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuer);
      FIELD_SET(*this, FIX::UnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDescLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::NoUnderlyingSecurityAltID);
      class NoUnderlyingSecurityAltID: public FIX::Group
      {
      public:
      NoUnderlyingSecurityAltID() : FIX::Group(457,458,FIX::message_order(458,459,0)) {}
        FIELD_SET(*this, FIX::UnderlyingSecurityAltID);
        FIELD_SET(*this, FIX::UnderlyingSecurityAltIDSource);
      };
      FIELD_SET(*this, FIX::QuoteSetValidUntilTime);
      FIELD_SET(*this, FIX::TotQuoteEntries);
      FIELD_SET(*this, FIX::NoQuoteEntries);
      class NoQuoteEntries: public FIX::Group
      {
      public:
      NoQuoteEntries() : FIX::Group(295,299,FIX::message_order(299,55,65,48,22,454,460,461,167,200,541,224,225,239,226,227,228,255,543,470,471,472,240,202,206,231,223,207,106,348,349,107,350,351,132,133,134,135,62,188,190,189,191,631,632,633,634,60,336,625,64,40,193,192,642,643,15,0)) {}
        FIELD_SET(*this, FIX::QuoteEntryID);
        FIELD_SET(*this, FIX::Symbol);
        FIELD_SET(*this, FIX::SymbolSfx);
        FIELD_SET(*this, FIX::SecurityID);
        FIELD_SET(*this, FIX::SecurityIDSource);
        FIELD_SET(*this, FIX::Product);
        FIELD_SET(*this, FIX::CFICode);
        FIELD_SET(*this, FIX::SecurityType);
        FIELD_SET(*this, FIX::MaturityMonthYear);
        FIELD_SET(*this, FIX::MaturityDate);
        FIELD_SET(*this, FIX::CouponPaymentDate);
        FIELD_SET(*this, FIX::IssueDate);
        FIELD_SET(*this, FIX::RepoCollateralSecurityType);
        FIELD_SET(*this, FIX::RepurchaseTerm);
        FIELD_SET(*this, FIX::RepurchaseRate);
        FIELD_SET(*this, FIX::Factor);
        FIELD_SET(*this, FIX::CreditRating);
        FIELD_SET(*this, FIX::InstrRegistry);
        FIELD_SET(*this, FIX::CountryOfIssue);
        FIELD_SET(*this, FIX::StateOrProvinceOfIssue);
        FIELD_SET(*this, FIX::LocaleOfIssue);
        FIELD_SET(*this, FIX::RedemptionDate);
        FIELD_SET(*this, FIX::StrikePrice);
        FIELD_SET(*this, FIX::OptAttribute);
        FIELD_SET(*this, FIX::ContractMultiplier);
        FIELD_SET(*this, FIX::CouponRate);
        FIELD_SET(*this, FIX::SecurityExchange);
        FIELD_SET(*this, FIX::Issuer);
        FIELD_SET(*this, FIX::EncodedIssuerLen);
        FIELD_SET(*this, FIX::EncodedIssuer);
        FIELD_SET(*this, FIX::SecurityDesc);
        FIELD_SET(*this, FIX::EncodedSecurityDescLen);
        FIELD_SET(*this, FIX::EncodedSecurityDesc);
        FIELD_SET(*this, FIX::NoSecurityAltID);
        class NoSecurityAltID: public FIX::Group
        {
        public:
        NoSecurityAltID() : FIX::Group(454,455,FIX::message_order(455,456,0)) {}
          FIELD_SET(*this, FIX::SecurityAltID);
          FIELD_SET(*this, FIX::SecurityAltIDSource);
        };
        FIELD_SET(*this, FIX::BidPx);
        FIELD_SET(*this, FIX::OfferPx);
        FIELD_SET(*this, FIX::BidSize);
        FIELD_SET(*this, FIX::OfferSize);
        FIELD_SET(*this, FIX::ValidUntilTime);
        FIELD_SET(*this, FIX::BidSpotRate);
        FIELD_SET(*this, FIX::OfferSpotRate);
        FIELD_SET(*this, FIX::BidForwardPoints);
        FIELD_SET(*this, FIX::OfferForwardPoints);
        FIELD_SET(*this, FIX::MidPx);
        FIELD_SET(*this, FIX::BidYield);
        FIELD_SET(*this, FIX::MidYield);
        FIELD_SET(*this, FIX::OfferYield);
        FIELD_SET(*this, FIX::TransactTime);
        FIELD_SET(*this, FIX::TradingSessionID);
        FIELD_SET(*this, FIX::TradingSessionSubID);
        FIELD_SET(*this, FIX::FutSettDate);
        FIELD_SET(*this, FIX::OrdType);
        FIELD_SET(*this, FIX::FutSettDate2);
        FIELD_SET(*this, FIX::OrderQty2);
        FIELD_SET(*this, FIX::BidForwardPoints2);
        FIELD_SET(*this, FIX::OfferForwardPoints2);
        FIELD_SET(*this, FIX::Currency);
      };
    };
  };

}

#endif


text:
from __future__ import absolute_import
import sys

from google.api_core.protobuf_helpers import get_messages

from google.api import http_pb2
from google.cloud.trace_v2.proto import trace_pb2
from google.cloud.trace_v2.proto import tracing_pb2
from google.protobuf import any_pb2
from google.protobuf import descriptor_pb2
from google.protobuf import empty_pb2
from google.protobuf import timestamp_pb2
from google.protobuf import wrappers_pb2
from google.rpc import status_pb2

_shared_modules = [
    http_pb2,
    any_pb2,
    descriptor_pb2,
    empty_pb2,
    timestamp_pb2,
    wrappers_pb2,
    status_pb2,
]

_local_modules = [trace_pb2, tracing_pb2]

names = []

for module in _shared_modules:
    for name, message in get_messages(module).items():
        setattr(sys.modules[__name__], name, message)
        names.append(name)
for module in _local_modules:
    for name, message in get_messages(module).items():
        message.__module__ = "google.cloud.trace_v2.types"
        setattr(sys.modules[__name__], name, message)
        names.append(name)

__all__ = tuple(sorted(names))


text: Vim pliugin to intuitivly move lines or ranges up or down by motions


text:
"use strict";
const url = require("url");
const opn = require("opn");
/**
 * Open the given web page URL. If no browser keyword is provided, `opn` will
 * use the user's default browser.
 */
function openWebPage(url, withBrowser) {
    const openOptions = { app: withBrowser };
    opn(url, openOptions, (err) => {
        if (err) {
            // log error and continue
            console.error(`ERROR: Problem launching "${openOptions.app || 'default web browser'}".`);
        }
    });
}
/**
 * Opens one or more browsers based on the given options and url params.
 *
 * @param options
 * @param serverUrl
 * @param componentUrl
 */
function openBrowser(options, serverUrl, componentUrl) {
    if (options.open) {
        let openUrl;
        if (options.openPath) {
            openUrl = Object.assign({}, serverUrl);
            openUrl.pathname = options.openPath;
        }
        else {
            openUrl = Object.assign({}, componentUrl);
        }
        if (!Array.isArray(options.browser)) {
            openWebPage(url.format(openUrl));
        }
        else {
            options.browser.forEach((browser) => {
                openWebPage(url.format(openUrl), browser);
            });
        }
    }
}
exports.openBrowser = openBrowser;
//# sourceMappingURL=open_browser.js.map


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ProjectileBehaviour : MonoBehaviour
{
    public Transform projectile;
    public PauseManager pause;
    public CharacterBehaviour player;
    public float speed = 7.5f;
    public float rotateSpeed = 500;
    public bool facingRight;

    void Start ()
    {
        projectile = GetComponent<Transform>();
        pause = GameObject.FindGameObjectWithTag("Manager").GetComponent<PauseManager>();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterBehaviour>();
        if (player.isFacingRight) facingRight = true;
        else facingRight = false;

        Destroy(this.gameObject, 2.5f);
    }

	void Update ()
    {

	}

    private void FixedUpdate()
    {
        if (!pause.pause)
        {
            if (facingRight)
            {
                projectile.localPosition = new Vector3(projectile.localPosition.x + Time.deltaTime * speed, projectile.localPosition.y, projectile.localPosition.z);
                projectile.Rotate(Vector3.forward * Time.deltaTime * rotateSpeed);
            }
            else
            {
                projectile.localPosition = new Vector3(projectile.localPosition.x - Time.deltaTime * speed, projectile.localPosition.y, projectile.localPosition.z);
                projectile.Rotate(Vector3.forward * Time.deltaTime * -rotateSpeed);
            }
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("OnTriggerEnter2D Event " + collision.gameObject.name);
        if (collision.gameObject.layer == LayerMask.NameToLayer("enemy"))
        {
            Debug.Log("Enemy: " + collision);
            collision.GetComponent<EnemyBehaviour>().RecieveDamage(player.rangedDamage);
            Destroy(this.gameObject);
        }
        if (collision.gameObject.layer == LayerMask.NameToLayer("boss"))
        {
            Debug.Log("Enemy: " + collision);
            collision.GetComponent<Boss1Behaviour>().RecieveDamage(player.rangedDamage);
            Destroy(this.gameObject);
        }
        else if (collision.gameObject.layer == LayerMask.NameToLayer("ground"))
        {
            Debug.Log("Destroyed by ground");
            Destroy(this.gameObject);
        }
        else if (collision.gameObject.layer == LayerMask.NameToLayer("bossshot"))
        {
            Debug.Log("Destroyed by" + collision);
            Destroy(this.gameObject);
        }
    }
}


text:
package com.github.miyasum.sandbox.jwt;

/**
 * @author MIYASAKA Yasumasa
 * @since 2017/01/26
 */
public class JweSample {

  /**
   * @param args
   */
  public static void main(String[] args) {
    // TODO Auto-generated method stub

  }

}


text:
/**
 * A classic use of Sockpress with session support (RAM)
 */

'use strict';

//Load library
var sockpress = require("sockpress");

//Create new engine using default session controller
var app = sockpress.init({secret: "key"});

//Register sample http routes

app.get("/index", function(req, res) {
	res.send("Hello!");
});

app.post("/update", function(req, res) {
	res.redirect("/index");
});

//Register sample IO routes

app.io.on("connection", function(socket) {
	console.log("New IO connection (id="+socket.id+")");
});

app.io.route("ping", function(socket, data) {
	socket.emit("pong", data); //echo service
});

//Start the engine
app.listen(3000);