text:
/**
 * @fileoverview HTML for Bird game.
 * @author fraser@google.com (Neil Fraser)
 */
'use strict';

goog.provide('Bird.html');

goog.require('BlocklyGames');
goog.require('BlocklyGames.html');

/**
 * Web page structure.
 * @param {!Object} ij Injected options.
 * @returns {string} HTML.
 */
Bird.html.start = function(ij) {
  return `
${BlocklyGames.html.headerBar(ij, BlocklyGames.getMsg('Games.bird', true), '', true, false, '')}

  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svgBird" width="400px" height="400px">
  </svg>

      <button id="runButton" class="primary" title="${BlocklyGames.getMsg('Games.runTooltip', true)}">
         ${BlocklyGames.getMsg('Games.runProgram', true)}
      </button>
      <button id="resetButton" class="primary" style="display: none" title="${BlocklyGames.getMsg('Games.resetTooltip', true)}">
         ${BlocklyGames.getMsg('Games.resetProgram', true)}
      </button>

${Bird.html.toolbox_(ij.level)}

${BlocklyGames.html.dialog()}
${BlocklyGames.html.doneDialog()}
${BlocklyGames.html.abortDialog()}
${BlocklyGames.html.storageDialog()}

${Bird.html.helpDialogs_()}
`;
};

/**
 * Toolboxes for each level.
 * @param {number} level Level 1-10.
 * @returns {string} HTML.
 * @private
 */
Bird.html.toolbox_ = function(level) {
  let xml = '<block type="bird_heading"></block>\n';
  if (level >= 2) {
    xml += `<block type="bird_noWorm" disabled="${level === 4 || level === 5}"></block>\n`;
  }
  if (level >= 4) {
    xml += `
<block type="bird_compare">
  <field name="OP">LT</field>
  <value name="A">
    <block type="bird_position" movable="false">
      <field name="XY">X</field>
    </block>
  </value>
  <value name="B">
    <block type="math_number" movable="false">
      <field name="NUM">50</field>
    </block>
  </value>
</block>
`;
  }
  if (level >= 5) {
    xml += `
<block type="bird_compare">
  <field name="OP">LT</field>
  <value name="A">
    <block type="bird_position" movable="false">
      <field name="XY">Y</field>
    </block>
  </value>
  <value name="B">
    <block type="math_number" movable="false">
      <field name="NUM">50</field>
    </block>
  </value>
</block>
`;
  }
  if (level >= 8) {
    xml += '<block type="bird_and"></block>\n';
  }
  return `<xml id="toolbox" xmlns="https://developers.google.com/blockly/xml">${xml}</xml>`;
};

/**
 * Help dialogs for each level.
 * @returns {string} HTML.
 * @private
 */
Bird.html.helpDialogs_ = function() {
    return `

    ${BlocklyGames.getMsg('Bird.helpHeading', true)}

    ${BlocklyGames.getMsg('Bird.helpHasWorm', true)}

    ${BlocklyGames.getMsg('Bird.helpX', true)}

    ${BlocklyGames.getMsg('Bird.helpElse', true)}

    ${BlocklyGames.getMsg('Bird.helpElseIf', true)}

    ${BlocklyGames.getMsg('Bird.helpAnd', true)}

    ${BlocklyGames.getMsg('Bird.helpMutator', true)}

`;
};


text:
<?php

class Adm_Menu_Model extends Model
{
	protected $name = 'adm_menu';
	protected $primary = 'menu_id';
	protected $prefix = 'menu_';

	public function delete($where = null)
	{
		list($parent_id, $order) = $this->select('menu_parent, menu_order')->where($where)->get()->fetchArray();
		parent::delete($where);
		$parent_id = (int)$parent_id;

		if ($order)
		{
			$sql = "UPDATE adm_menu SET menu_order = menu_order -1 WHERE menu_parent = $parent_id AND menu_order > $order";
			$this->db->query($sql);
		}
	}

	public function getId($controller, $action = '')
	{
		return $this->db->select('menu_id, menu_parent, menu_auth')->from('adm_menu')->where("menu_controller = '$controller'" . ($action ? " AND menu_action = '$action'" : ''))->get();
	}

	public function getMenu()
	{
		$sql = "SELECT m1.*
					FROM adm_menu AS m1
					ORDER BY m1.menu_parent ASC, m1.menu_order ASC";
		$query = $this->db->query($sql);

		return $query;
	}

	public function down($menuId)
	{
		$this->db->lock('adm_menu AS t1 WRITE', 'adm_menu AS t2 WRITE', 'adm_menu AS t3 WRITE');

		$sql = "UPDATE adm_menu AS t1, adm_menu AS t3
				JOIN adm_menu AS t2 ON t2.menu_id = $menuId
					SET t1.menu_order = t1.menu_order + 1, t3.menu_order = t3.menu_order -1
				WHERE t1.menu_id = $menuId AND (t3.menu_parent = t2.menu_parent AND t3.menu_order = (t2.menu_order + 1))";
		$this->db->query($sql);

		$this->db->unlock();
	}

	public function up($menuId)
	{
		$this->db->lock('adm_menu AS t1 WRITE', 'adm_menu AS t2 WRITE', 'adm_menu AS t3 WRITE');

		$sql = "UPDATE adm_menu AS t1, adm_menu AS t3
				JOIN adm_menu AS t2 ON t2.menu_id = $menuId
					SET t1.menu_order = t1.menu_order - 1, t3.menu_order = t3.menu_order + 1
				WHERE t1.menu_id = $menuId AND (t3.menu_parent = t2.menu_parent AND t3.menu_order = (t2.menu_order - 1))";
		$this->db->query($sql);

		$this->db->unlock();
	}
}
?>

redpajama_set_name: RedPajamaGithub


text:
id: command-handler
title: Command Handler
---

:::info TypeScript Support

Command handlers are grouped into an Aggregate container object that has an associated TypeScript type:

- Type Name - `Aggregate`
- Package - `@resolve-js/core`

:::

A command handler function has the following structure:

```js
(state, command, context) => {
  ...
  return {
    type: 'CommandTypeName',
    payload: { ... },
  }
}
```

A command handler implementation receives the following arguments:

| Argument Name | Description                                                                                |
| ------------- | -------------------------------------------------------------------------------------------------------- |
| state         | The state object built by the aggregate [projection](../../write-side.md#aggregate-projection-function). |
| command       | An object that contains the incoming command's data.                                                     |
| context       | An object that contains data and functions related to the current operation.                             |

## Context

The `context` argument is an object with the following fields:

| Field Name       | Description                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------------- |
| jwt              | The JSON Web Token attached to the request.                                                                |
| aggregateVersion | The aggregate version that is a number incremented for each subsequent event with the current aggregateId. |
| encrypt          | The user-defined [encrypt](../../encryption.md) function.                                                  |
| decrypt          | The user-defined [decrypt](../../encryption.md) function.                                                  |

This object can also contain additional fields added by [middleware](../../middleware.md).


text:
define(function(){ return '\
.duiRevealv {\
  -moz-transition-property: none;\
  -webkit-transition-property: none;\
  transition-property: none;\
  -moz-transition-duration: 0s;\
  -webkit-transition-duration: 0s;\
  transition-duration: 0s;\
}\
.duiRevealv.duiTransition {\
  -webkit-transition-property: -webkit-transform;\
  transition-property: transform;\
  -moz-transition-duration: 0.4s;\
  -webkit-transition-duration: 0.4s;\
  transition-duration: 0.4s;\
}\
.duiRevealv.duiOut {\
  -webkit-transform: translate3d(0px, 0%, 0px) !important;\
  transform: translate3d(0px, 0%, 0px) !important;\
}\
.duiRevealv.duiOut.duiTransition {\
  -webkit-transform: translate3d(0px, -100%, 0px) !important;\
  transform: translate3d(0px, -100%, 0px) !important;\
}\
.duiRevealv.duiOut.duiReverse.duiTransition {\
  -webkit-transform: translate3d(0px, 100%, 0px) !important;\
  transform: translate3d(0px, 100%, 0px) !important;\
}\
.duiRevealv.duiIn {\
  z-index: -100;\
  -webkit-transform: translate3d(0px, 0%, -1px) !important;\
  transform: translate3d(0px, 0%, -1px) !important;\
}\
.duiRevealv.duiIn.duiTransition {\
  -webkit-transform: translate3d(0px, 0%, 0px) !important;\
  transform: translate3d(0px, 0%, 0px) !important;\
}\
.dj_android.dj_tablet .duiRevealv.duiTransition {\
  -moz-transition-duration: 0.6s;\
  -webkit-transition-duration: 0.6s;\
  transition-duration: 0.6s;\
  -moz-transition-timing-function: linear;\
  -webkit-transition-timing-function: linear;\
  transition-timing-function: linear;\
}\
'; } );


text:
package com.alibaba.tamper.process;

import org.apache.commons.lang.StringUtils;

import com.alibaba.tamper.core.BeanMappingException;
import com.alibaba.tamper.core.config.BeanMappingField;
import com.alibaba.tamper.core.process.ValueProcess;
import com.alibaba.tamper.core.process.ValueProcessInvocation;
import com.alibaba.tamper.process.convertor.Convertor;
import com.alibaba.tamper.process.convertor.ConvertorHelper;

/**
 * mapping默认值的处理,get流程处理
 *
 * @author jianghang 2011-5-27 下午09:19:46
 */
public class DefaultValueValueProcess implements ValueProcess {

    @Override
    public Object process(Object value, ValueProcessInvocation invocation) throws BeanMappingException {
        // 处理下自己的业务
        BeanMappingField currentField = invocation.getContext().getCurrentField();
        if (value == null && StringUtils.isNotEmpty(currentField.getDefaultValue())
            && currentField.isMapping() == false) {
            if (currentField.getSrcField().getClazz() != null) {// 有指定对应的SrcClass
                Convertor convertor = ConvertorHelper.getInstance().getConvertor(String.class,
                                                                                currentField.getSrcField().getClazz());
                if (convertor != null) {
                    // 先对String字符串进行一次转化
                    value = convertor.convert(currentField.getDefaultValue(), currentField.getSrcField().getClazz());
                }
            }

            if (value == null) {
                // 不存在对默认值处理的convertor,不予处理,后续尝试下自定义的convertor
                value = currentField.getDefaultValue();
            }
        }

        return invocation.proceed(value);
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.usfirst.frc4915.ArcadeDriveRobot;

public class Version {

    private static final String VERSION = "v4.10.9";
    // Should be ready for practice
    // Implements safety changes
    // --Safety enabled for both Harvester a:nd launcher motors
    // --Removed delay on drive straight command
    // --Added debug info for the WindingMotor's Safety
    // Adds default behaviors for Winding and Harvester motors.

    // Testing the rangefinder
    // Should display the distance in inches from wall
    // MoveUpToDistance moves until it is 3 feet from the wall

    public static String getVersion() {
        return VERSION;
    }
}


text:
class MyLittlePony
  attr_reader :name, :type
  attr_accessor :has_cutie_mark, :hometown, :friends

  def initialize(name, type, has_cutie_mark)
    @name = name
    @type = type
    @has_cutie_mark = has_cutie_mark
    @hometown = "Ponyville"
    @friends = []
  end

  def say_hi
    @has_cutie_mark == true ? _do = "do" : _do = "don't"
    puts "Hi! My name is #{@name} and I am an #{@type} pony. I live in #{@hometown}. I #{_do} have my cutie mark."
  end

  def list_friends
    @friends.each {|friend| p friend.name}
  end
end

twilight = MyLittlePony.new("Twilight Sparkle", "Alicorn", true)

apple_jack = MyLittlePony.new("Applejack", "Earth Pony", true)

rainbow_dash = MyLittlePony.new("Rainbow Dash", "Pegasus", true)

pinkie_pie = MyLittlePony.new("Pinkie Pie", "Earth Pony", true)

rarity = MyLittlePony.new("Rarity", "Unicorn", true)

flutter_shy = MyLittlePony.new("Flutter Shy", "Pegasus", true)

twilight.say_hi

twilight.friends = [apple_jack, rainbow_dash, pinkie_pie, rarity, flutter_shy]
twilight.list_friends


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.github.xose</groupId>
	<artifactId>gwt-persona</artifactId>
	<version>0.1-SNAPSHOT</version>

	<name>GWT Persona</name>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.6</maven.compiler.source>
		<maven.compiler.target>1.6</maven.compiler.target>
		<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
		<gwt.version>2.5.1-rc1</gwt.version>
		<guava.version>14.0-rc3</guava.version>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.google.gwt</groupId>
				<artifactId>gwt-user</artifactId>
				<version>${gwt.version}</version>
			</dependency>
			<dependency>
				<groupId>com.google.guava</groupId>
				<artifactId>guava-gwt</artifactId>
				<version>${guava.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava-gwt</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
			<version>2.0.1</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>2.5.1-rc1</version>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>resources</goal>
							<goal>test</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<linksource>true</linksource>
					<links>
						<link>http://jsr-305.googlecode.com/svn/trunk/javadoc</link>
						<link>http://docs.guava-libraries.googlecode.com/git-history/v${guava.version}/javadoc</link>
						<link>http://google-web-toolkit.googlecode.com/svn/javadoc/2.5</link>
					</links>
				</configuration>
				<executions>
					<execution>
						<id>generate-javadoc</id>
						<phase>verify</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>


text:
var createUser = new Firebase("https://simpleblogger.firebaseio.com/")
$("#registerbutton").click(function()
{
  var emailid = $('#email').val();
      var passwordid = $('#password').val();

        createUser.createUser({
      email: emailid,
  password: passwordid
},
function(error, userData) {
 if (error) {
   switch (error.code) {
     case "EMAIL_TAKEN":
       alert("The new user account cannot be created because the email is already in use.");

       break;
     case "INVALID_EMAIL":
       alert("Make sure that your informmations are correct.");

       break;
     default:
       alert("Error creating user:", error);

   }
 }
 else {
   alert("Successfully created user account with uid:", userData.uid.email);
        window.location.href = "load_posts.html"
 } else {
   alert("Successfully created user account with uid:", userData.uid);
   localStorage.userinfo = userData.uid;
   window.location.href = "load_posts.html"

 }
});
});


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<title>3.1.4 X509Req objects </title>
<META NAME="description" CONTENT="3.1.4 X509Req objects ">
<META NAME="keywords" CONTENT="pyOpenSSL">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<link rel="STYLESHEET" href="pyOpenSSL.css">
<LINK REL="next" href="openssl-x509store.html">
<LINK REL="previous" href="openssl-x509name.html">
<LINK REL="up" href="openssl-crypto.html">
<LINK REL="next" href="openssl-x509store.html">

Python OpenSSL Manual

Previous: 3.1.3 X509Name objects
Up: 3.1 crypto
Next: 3.1.5 X509Store objects

3.1.4 X509Req objects

X509Req objects have the following methods:

<tt class='method'>get_pubkey</tt>()

Return a PKey object representing the public key of the certificate request.

<tt class='method'>get_subject</tt>()

Return an X509Name object representing the subject of the certificate.

<tt class='method'>set_pubkey</tt>(<var>pkey</var>)

Set the public key of the certificate request to <var>pkey</var>.

<tt class='method'>sign</tt>(<var>pkey, digest</var>)

Sign the certificate request, using the key <var>pkey</var> and the message digest
algorithm identified by the string <var>digest</var>.

<tt class='method'>verify</tt>(<var>pkey</var>)

Verify a certificate request using the public key <var>pkey</var>.

<tt class='method'>set_version</tt>(<var>version</var>)

Set the version (RFC 2459, 4.1.2.1) of the certificate request to
<var>version</var>.

<tt class='method'>get_version</tt>()

Get the version (RFC 2459, 4.1.2.1) of the certificate request.

Python OpenSSL Manual

Previous: 3.1.3 X509Name objects
Up: 3.1 crypto
Next: 3.1.5 X509Store objects

Release 0.12.


text:
class Visitor;

class ArrayLiteral : public Literal
{
public:
    ArrayLiteral() = default;
    ArrayLiteral(std::vector<Expression*> _ele): elements(_ele) {}
    ArrayLiteral(Expression* _ele) : elements({ _ele }) {}

    ~ArrayLiteral()
    {
        for (std::vector<Statement*>::size_type  i = 0; i < elements.size(); ++i)
        {
            delete elements[i];
        }
    }

    void push_arg(Expression* element)
    {
        elements.push_back(element);
    }

    std::vector<Expression*> get_elements()
    {
        return elements;
    }

    virtual std::vector<Postfix*> get_postfixs() const override
    {
        return std::vector<Postfix*>();
    }

    virtual void push_postfix(Postfix* postfix) override
    {
    }

    virtual void accept(Visitor& visitor) override;
private:
    std::vector<Expression*> elements;
};
#endif


text:
package com.jfinal.plugin.ehcache;

/**
 * RenderType
 */
public class RenderType {
	public static final int FREE_MARKER_RENDER = 1;
	public static final int JSP_RENDER = 2;
	public static final int VELOCITY_RENDER = 3;
	public static final int XML_RENDER = 4;
	public static final int JSON_RENDER = 5;
}


text:
package com.intellij.execution.testframework.sm.runner.events;

import jetbrains.buildServer.messages.serviceMessages.TestSuiteFinished;
import org.jetbrains.annotations.NotNull;

public class TestSuiteFinishedEvent extends TreeNodeEvent {

  public TestSuiteFinishedEvent(@NotNull TestSuiteFinished suiteFinished) {
    super(suiteFinished.getSuiteName(), TreeNodeEvent.getNodeId(suiteFinished));
  }

  public TestSuiteFinishedEvent(@NotNull String name) {
    super(name, null);
  }

  @Override
  protected void appendToStringInfo(@NotNull StringBuilder buf) {
  }
}


text:
Dashboard from Chronograf:
![Dashboard fromChronograf](img/dashboard-chronograf.png)

Dashboard from Grafana:
![Dashboard from Grafana](img/dashboard-grafana.png)

Dashboard from InfluxDB UI
![Dashboard from InfluxDB UI](img/dashboard-influxdbui.png)

Dashboard from NodeRED UI:
![Dashboard from NodeRED UI](img/dashboard-noderedui.png)

!


text:
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.config.collector.CloudConfig;
import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.CloudInstanceHistory;
import com.capitalone.dashboard.model.CloudSubNetwork;
import com.capitalone.dashboard.model.CloudVirtualNetwork;
import com.capitalone.dashboard.model.CloudVolumeStorage;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.repository.AWSConfigRepository;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.capitalone.dashboard.repository.CloudInstanceHistoryRepository;
import com.capitalone.dashboard.repository.CloudInstanceRepository;
import com.capitalone.dashboard.repository.CloudSubNetworkRepository;
import com.capitalone.dashboard.repository.CloudVirtualNetworkRepository;
import com.capitalone.dashboard.repository.CloudVolumeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Collects {@link AWSCloudCollector} data from feature content source system.
 */
@SuppressWarnings("PMD")
@Component
public class AWSCloudCollectorTask extends CollectorTask<AWSCloudCollector> {

    private final CloudInstanceRepository cloudInstanceRepository;
    private final CloudVirtualNetworkRepository cloudVirtualNetworkRepository;
    private final CloudSubNetworkRepository cloudSubNetworkRepository;
    private final CloudVolumeRepository cloudVolumeRepository;
    private final CloudInstanceHistoryRepository cloudInstanceHistoryRepository;

    private final AWSCloudSettings awsSetting;
    private final AWSCloudClient awsClient;
    private final AWSConfigRepository awsConfigRepository;
    private final BaseCollectorRepository<AWSCloudCollector> collectorRepository;

    /**
     * @param taskScheduler                  Task Scheduler
     * @param collectorRepository            Collector Repository
     * @param cloudSettings                  Cloud Settings
     * @param cloudClient                    Cloud Client
     * @param awsConfigRepository            Config Repository
     * @param cloudInstanceRepository        Cloud Instance Repository
     * @param cloudVirtualNetworkRepository  Cloud Virtual Network Repository
     * @param cloudSubNetworkRepository      Cloud Subnet Repository
     * @param cloudVolumeRepository          Cloud Volume Repository
     * @param cloudInstanceHistoryRepository Cloud Instance History Repository
     */
    @Autowired
    public AWSCloudCollectorTask(TaskScheduler taskScheduler,
                                 BaseCollectorRepository<AWSCloudCollector> collectorRepository,
                                 AWSCloudSettings cloudSettings, AWSCloudClient cloudClient,
                                 AWSConfigRepository awsConfigRepository,
                                 CloudInstanceRepository cloudInstanceRepository,
                                 CloudVirtualNetworkRepository cloudVirtualNetworkRepository,
                                 CloudSubNetworkRepository cloudSubNetworkRepository,
                                 CloudVolumeRepository cloudVolumeRepository,
                                 CloudInstanceHistoryRepository cloudInstanceHistoryRepository) {
        super(taskScheduler, "AWSCloud");
        this.collectorRepository = collectorRepository;
        this.awsClient = cloudClient;
        this.awsSetting = cloudSettings;
        this.awsConfigRepository = awsConfigRepository;
        this.cloudInstanceRepository = cloudInstanceRepository;
        this.cloudVirtualNetworkRepository = cloudVirtualNetworkRepository;
        this.cloudSubNetworkRepository = cloudSubNetworkRepository;
        this.cloudVolumeRepository = cloudVolumeRepository;
        this.cloudInstanceHistoryRepository = cloudInstanceHistoryRepository;
    }

    public AWSCloudCollector getCollector() {
        return AWSCloudCollector.prototype();
    }

    /**
     * Accessor method for the current chronology setting, for the scheduler
     */
    public String getCron() {
        return awsSetting.getCron();
    }

    /**
     * The collection action. This is the task which will run on a schedule to
     * gather data from the feature content source system and update the
     * repository with retrieved .
     */
    public void collect(AWSCloudCollector collector) {
        log("Starting AWS collection...");
        log("Collecting AWS Cloud Data...");

        Map<String, List<CloudInstance>> accountToInstanceMap = collectInstances();

        Map<String, String> instanceToAccountMap = new HashMap<>();
        for (String account : accountToInstanceMap.keySet()) {
            Collection<CloudInstance> instanceList = accountToInstanceMap.get(account);
            for (CloudInstance ci : instanceList) {
                instanceToAccountMap.put(ci.getInstanceId(), account);
            }
        }
        collectVolume(instanceToAccountMap);

        log("Finished Cloud collection.");
    }

    private Map<String, List<CloudInstance>> collectInstances() {
        Map<String, List<CloudInstance>> cloudInstanceMap = awsClient.getCloudInstances(cloudInstanceRepository);
        for (String account : cloudInstanceMap.keySet()) {
            Collection<CloudInstance> collectedInstances = cloudInstanceMap.get(account);
            Set<CloudInstance> saveList = new HashSet<>();
            Collection<CloudInstance> deleteList = cloudInstanceRepository.findByAccountNumber(account); //Potential Delete List
            for (CloudInstance current : collectedInstances) {
                CloudInstance existing = cloudInstanceRepository.findByInstanceId(current.getInstanceId());
                if (existing != null) {  // if it is a still in-use instance, do not delete it
                    if (!CollectionUtils.isEmpty(deleteList)) {
                        deleteList.remove(existing);
                    }
                    saveList.add(updateWithExisting(existing, current));
                }
                saveList.add(current);
            }

            if (!CollectionUtils.isEmpty(saveList)) {
                cloudInstanceRepository.save(saveList);
            }
            if (!CollectionUtils.isEmpty(deleteList)) {
                cloudInstanceRepository.delete(deleteList);
            }
            saveAggregatedHistory(account, cloudInstanceMap.get(account));
        }
        return cloudInstanceMap;
    }

    private CloudInstance updateWithExisting(CloudInstance existing, CloudInstance current) {
        current.setId(existing.getId());
        current.setImageExpirationDate(existing.getImageExpirationDate());
        current.setImageApproved(existing.isImageApproved());
        return current;
    }

    private void saveAggregatedHistory(String account, List<CloudInstance> instances) {
        int unTaggedCount = 0;
        int stoppedCount = 0;
        int totalCount = 0;
        int expiredImageCount = 0;
        double totalCpu = 0.0;
        double totalDiskRead = 0.0;
        double totalDiskWrite = 0.0;
        double totalNetworkIn = 0.0;
        double totalNetworkOut = 0.0;

        for (CloudInstance rd : instances) {
            totalCount = totalCount + 1;
            totalCpu = totalCpu + rd.getCpuUtilization();
            totalDiskRead = totalDiskRead + rd.getDiskRead();
            totalDiskWrite = totalDiskWrite + rd.getDiskWrite();
            totalNetworkIn = totalNetworkIn + rd.getNetworkIn();
            totalNetworkOut = totalNetworkOut + rd.getNetworkOut();

            if (rd.isStopped()) {
                stoppedCount = stoppedCount + 1;
            }
            if (!rd.isTagged()) {
                unTaggedCount = unTaggedCount + 1;
            }
            Date expirationDate = new Date(rd.getImageExpirationDate());
            Date today = new Date();
            if (today.after(expirationDate)) {
                expiredImageCount = expiredImageCount + 1;
            }
        }
        if (totalCount > 0) {
            CloudInstanceHistory history = new CloudInstanceHistory();
            history.setAccountNumber(account);
            history.setTime(System.currentTimeMillis());
            history.setTotal(totalCount);
            history.setStopped(stoppedCount);
            history.setCpu(totalCpu / totalCount);
            history.setDiskRead(totalDiskRead / totalCount);
            history.setDiskWrite(totalDiskWrite / totalCount);
            history.setNetworkOut(totalNetworkOut / totalCount);
            history.setNetworkIn(totalNetworkIn / totalCount);
            history.setNonTagged(unTaggedCount);
            //assumption: the estimated charge gets the full account's charge
            history.setEstimatedCharge(awsClient.get24HourInstanceEstimatedCharge());
            cloudInstanceHistoryRepository.save(history);
        }
    }

    private void collectVPC() {
        CloudVirtualNetwork cloudVirtualNetwork = awsClient.getCloudVPC(cloudVirtualNetworkRepository);
        cloudVirtualNetwork.setLastUpdateDate(System.currentTimeMillis());
        cloudVirtualNetworkRepository.save(cloudVirtualNetwork);
    }

    private void collectSubNet() {
        CloudSubNetwork cloudSubNetwork = awsClient.getCloudSubnet(cloudSubNetworkRepository);
        cloudSubNetwork.setLastUpdateDate(System.currentTimeMillis());
        cloudSubNetworkRepository.save(cloudSubNetwork);
    }

    private void collectVolume(Map<String, String> instanceToAccountMap) {
        Map<String, List<CloudVolumeStorage>> accountVolume = awsClient.getCloudVolumes(instanceToAccountMap);
        for (String account : accountVolume.keySet()) {
            Collection<CloudVolumeStorage> existing = cloudVolumeRepository.findByAccountNumber(account);
            if (!CollectionUtils.isEmpty(existing)) {
                cloudVolumeRepository.delete(existing);
            }
            cloudVolumeRepository.save(accountVolume.get(account));
        }
    }

    @Override
    public BaseCollectorRepository<AWSCloudCollector> getCollectorRepository() {
        return collectorRepository;
    }

    private List<CloudConfig> enabledConfigs(Collector collector) {
        return awsConfigRepository.findEnabledCloudConfig(collector.getId());
    }
}


text:
package mesosphere.marathon.api.v2

import javax.ws.rs.core.{ MediaType, Response }
import javax.ws.rs.{ Consumes, GET, Path, Produces }

import com.google.inject.Inject
import mesosphere.chaos.http.HttpConf
import mesosphere.marathon.api.{ RestResource, MarathonMediaType, LeaderInfo }
import mesosphere.marathon.event.EventConfiguration
import mesosphere.marathon.event.http.HttpEventConfiguration
import mesosphere.marathon.{ BuildInfo, LeaderProxyConf, MarathonConf, MarathonSchedulerService }
import mesosphere.util.state.MesosLeaderInfo
import play.api.libs.json.{ JsObject, Json }

@Path("v2/info")
@Consumes(Array(MediaType.APPLICATION_JSON))
class InfoResource @Inject() (
    schedulerService: MarathonSchedulerService,
    mesosLeaderInfo: MesosLeaderInfo,
    leaderInfo: LeaderInfo,
    // format: OFF
    protected val config: MarathonConf
      with HttpConf with EventConfiguration with HttpEventConfiguration with LeaderProxyConf
) extends RestResource {
  // format: ON

  // Marathon configurations
  private[this] lazy val marathonConfigValues = Json.obj(
    "master" -> config.mesosMaster.get,
    "failover_timeout" -> config.mesosFailoverTimeout.get,
    "framework_name" -> config.frameworkName.get,
    "ha" -> config.highlyAvailable.get,
    "checkpoint" -> config.checkpoint.get,
    "local_port_min" -> config.localPortMin.get,
    "local_port_max" -> config.localPortMax.get,
    "executor" -> config.defaultExecutor.get,
    "hostname" -> config.hostname.get,
    "webui_url" -> config.webuiUrl.get,
    "mesos_role" -> config.mesosRole.get,
    "task_launch_timeout" -> config.taskLaunchTimeout.get,
    "reconciliation_initial_delay" -> config.reconciliationInitialDelay.get,
    "reconciliation_interval" -> config.reconciliationInterval.get,
    "marathon_store_timeout" -> config.marathonStoreTimeout.get,
    "mesos_user" -> config.mesosUser.get,
    "leader_proxy_connection_timeout_ms" -> config.leaderProxyConnectionTimeout.get,
    "leader_proxy_read_timeout_ms" -> config.leaderProxyReadTimeout.get)

  // Zookeeper congiurations
  private[this] lazy val zookeeperConfigValues = Json.obj(
    "zk" -> config.zooKeeperUrl(),
    "zk_timeout" -> config.zooKeeperTimeout(),
    "zk_session_timeout" -> config.zooKeeperSessionTimeout(),
    "zk_max_versions" -> config.zooKeeperMaxVersions()
  )

  private[this] lazy val eventHandlerConfigValues = {
    def httpEventConfig: JsObject = Json.obj(
      "http_endpoints" -> config.httpEventEndpoints.get
    )

    def eventConfig(): JsObject = config.eventSubscriber.get match {
      case Some("http_callback") => httpEventConfig
      case _                     => Json.obj()
    }

    Json.obj(
      "type" -> config.eventSubscriber.get
    ) ++ eventConfig
  }

  private[this] lazy val httpConfigValues = Json.obj(
    "assets_path" -> config.assetsFileSystemPath.get,
    "http_port" -> config.httpPort.get,
    "https_port" -> config.httpsPort.get
  )

  @GET
  @Produces(Array(MarathonMediaType.PREFERRED_APPLICATION_JSON))
  def index(): Response = {
    val mesosLeaderUiUrl = Json.obj("mesos_leader_ui_url" -> mesosLeaderInfo.currentLeaderUrl)
    Response.ok(
      jsonObjString(
        "name" -> BuildInfo.name,
        "version" -> BuildInfo.version,
        "elected" -> leaderInfo.elected,
        "leader" -> leaderInfo.currentLeaderHostPort(),
        "frameworkId" -> schedulerService.frameworkId.map(_.getValue),
        "marathon_config" -> (marathonConfigValues ++ mesosLeaderUiUrl),
        "zookeeper_config" -> zookeeperConfigValues,
        "event_subscriber" -> config.eventSubscriber.get.map(_ => eventHandlerConfigValues),
        "http_config" -> httpConfigValues)).build()
  }
}


text:
package eventstore
package operations

import eventstore.ReadAllEventsError._
import eventstore.operations.Inspection.Decision.{ Stop, Fail }
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import scala.util.{ Failure, Success }

class ReadAllEventsInspectionSpec extends Specification with Mockito {
  val inspection = ReadAllEventsInspection(mock[ReadAllEvents]).pf

  "ReadAllEventsInspection" should {

    "handle ReadAllEventsCompleted" in {
      inspection(Success(mock[ReadAllEventsCompleted])) mustEqual Stop
    }

    "handle Error" in {
      inspection(Failure(Error(None))) must beLike {
        case Fail(_: ServerErrorException) => ok
      }
    }

    "handle AccessDenied" in {
      inspection(Failure(AccessDenied)) must beLike {
        case Fail(_: AccessDeniedException) => ok
      }
    }
  }
}


text:
package org.springframework.boot.logging;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

/**
 * Common abstraction over logging systems.
 *
 * @author Phillip Webb
 * @author Dave Syer
 * @author Andy Wilkinson
 * @author Ben Hale
 */
public abstract class LoggingSystem {

	/**
	 * A System property that can be used to indicate the {@link LoggingSystem} to use.
	 */
	public static final String SYSTEM_PROPERTY = LoggingSystem.class.getName();

	/**
	 * The value of the {@link #SYSTEM_PROPERTY} that can be used to indicate that no
	 * {@link LoggingSystem} should be used.
	 */
	public static final String NONE = "none";

	private static final Map<String, String> SYSTEMS;

	static {
		Map<String, String> systems = new LinkedHashMap<String, String>();
		systems.put("ch.qos.logback.core.Appender",
				"org.springframework.boot.logging.logback.LogbackLoggingSystem");
		systems.put("org.apache.logging.log4j.core.impl.Log4jContextFactory",
				"org.springframework.boot.logging.log4j2.Log4J2LoggingSystem");
		systems.put("java.util.logging.LogManager",
				"org.springframework.boot.logging.java.JavaLoggingSystem");
		SYSTEMS = Collections.unmodifiableMap(systems);
	}

	/**
	 * Reset the logging system to be limit output. This method may be called before
	 * {@link #initialize(LoggingInitializationContext, String, LogFile)} to reduce
	 * logging noise until the system has been fully initialized.
	 */
	public abstract void beforeInitialize();

	/**
	 * Fully initialize the logging system.
	 * @param initializationContext the logging initialization context
	 * @param configLocation a log configuration location or {@code null} if default
	 * initialization is required
	 * @param logFile the log output file that should be written or {@code null} for
	 * console only output
	 */
	public void initialize(LoggingInitializationContext initializationContext,
			String configLocation, LogFile logFile) {
	}

	/**
	 * Clean up the logging system. The default implementation does nothing. Subclasses
	 * should override this method to perform any logging system-specific cleanup.
	 */
	public void cleanUp() {
	}

	/**
	 * Returns a {@link Runnable} that can handle shutdown of this logging system when the
	 * JVM exits. The default implementation returns {@code null}, indicating that no
	 * shutdown is required.
	 * @return the shutdown handler, or {@code null}
	 */
	public Runnable getShutdownHandler() {
		return null;
	}

	/**
	 * Sets the logging level for a given logger.
	 * @param loggerName the name of the logger to set
	 * @param level the log level
	 */
	public void setLogLevel(String loggerName, LogLevel level) {
		throw new UnsupportedOperationException("Unable to set log level");
	}

	/**
	 * Returns a collection of the current configuration for all a {@link LoggingSystem}'s
	 * loggers.
	 * @return the current configurations
	 * @since 1.5.0
	 */
	public List<LoggerConfiguration> getLoggerConfigurations() {
		throw new UnsupportedOperationException("Unable to get logger configurations");
	}

	/**
	 * Returns the current configuration for a {@link LoggingSystem}'s logger.
	 * @param loggerName the name of the logger
	 * @return the current configuration
	 * @since 1.5.0
	 */
	public LoggerConfiguration getLoggerConfiguration(String loggerName) {
		throw new UnsupportedOperationException("Unable to get logger configuration");
	}

	/**
	 * Detect and return the logging system in use. Supports Logback and Java Logging.
	 * @param classLoader the classloader
	 * @return The logging system
	 */
	public static LoggingSystem get(ClassLoader classLoader) {
		String loggingSystem = System.getProperty(SYSTEM_PROPERTY);
		if (StringUtils.hasLength(loggingSystem)) {
			if (NONE.equals(loggingSystem)) {
				return new NoOpLoggingSystem();
			}
			return get(classLoader, loggingSystem);
		}
		for (Map.Entry<String, String> entry : SYSTEMS.entrySet()) {
			if (ClassUtils.isPresent(entry.getKey(), classLoader)) {
				return get(classLoader, entry.getValue());
			}
		}
		throw new IllegalStateException("No suitable logging system located");
	}

	private static LoggingSystem get(ClassLoader classLoader, String loggingSystemClass) {
		try {
			Class<?> systemClass = ClassUtils.forName(loggingSystemClass, classLoader);
			return (LoggingSystem) systemClass.getConstructor(ClassLoader.class)
					.newInstance(classLoader);
		}
		catch (Exception ex) {
			throw new IllegalStateException(ex);
		}
	}

	/**
	 * {@link LoggingSystem} that does nothing.
	 */
	static class NoOpLoggingSystem extends LoggingSystem {

		@Override
		public void beforeInitialize() {

		}

		@Override
		public void setLogLevel(String loggerName, LogLevel level) {

		}

		@Override
		public List<LoggerConfiguration> getLoggerConfigurations() {
			return Collections.emptyList();
		}

		@Override
		public LoggerConfiguration getLoggerConfiguration(String loggerName) {
			return null;
		}

	}

}


text:
package com.qiumingkui.sample.imedia.blog.port.adapter.notify;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.qiumingkui.sample.imedia.blog.application.NotificationApplicationService;

@Component
public class NotificationMonitor {

	@Autowired
	private NotificationApplicationService notificationApplicationService;

	@PostConstruct
	public void init() {
		NotificationMonitorTimer timer = NotificationMonitorTimer.newInstance(notificationApplicationService);
		timer.start();
		System.out.println("NotificationMonitor is started!");
	}

}


text:
namespace base {

class FilePath;

// First value is test case name, second one is test name.
typedef std::pair<std::string, std::string> SplitTestName;

// Returns a vector of gtest-based tests compiled into
// current executable.
std::vector<SplitTestName> GetCompiledInTests();

// Writes the list of gtest-based tests compiled into
// current executable as a JSON file. Returns true on success.
bool WriteCompiledInTestsToFile(const FilePath& path) WARN_UNUSED_RESULT;

}  // namespace base

#endif  // BASE_TEST_GTEST_UTIL_H_


text:
@implementation ROPayError
@synthesize errorCode = _errorCode;
@synthesize description = _description;

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}

- (void)dealloc
{
    self.errorCode = nil;
    self.description = nil;
	[super dealloc];
}

@end


text:
class LocalStorageShim {
  constructor() {
    this.store = {};
  }

  getItem(key) {
    return this.store[key];
  }

  setItem(key,val) {
    this.store[key] = val;
  }

  clear() {
    this.store = {};
  }
}

let instance;

module.exports = instance || (instance = new LocalStorageShim());


text:
package downloader_test

import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"os"
	"path"

	"github.com/cloudfoundry/bosh-agent/bootstrapper/auth"
	"github.com/cloudfoundry/bosh-agent/bootstrapper/downloader"
	"github.com/cloudfoundry/bosh-agent/bootstrapper/installer"
	"github.com/cloudfoundry/bosh-agent/bootstrapper/spec"
	"github.com/cloudfoundry/bosh-agent/bootstrapper/system"
	boshlogger "github.com/cloudfoundry/bosh-utils/logger"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Downloader", func() {
	var (
		dl           *downloader.Downloader
		tarballURL   string
		listener     net.Listener
		logWriter    spec.CapturableWriter
		logger       boshlogger.Logger
		allowedNames []string
		port         int
		directorCert *tls.Certificate
		i            installer.Installer
		tmpDir       string
		tarballPath  string
	)

	BeforeEach(func() {
		var err error
		logWriter = spec.NewCapturableWriter(GinkgoWriter)
		sysLog := log.New(logWriter, "", 0)
		logger = boshlogger.New(boshlogger.LevelDebug, sysLog, sysLog)
		directorCert = spec.CertFor("director")
		port = spec.GetFreePort()
		tmpDir, err = ioutil.TempDir("", "test-tmp")
		Expect(err).ToNot(HaveOccurred())

		installScript := fmt.Sprintf("#!/bin/bash\necho hiya > %s/install.log\n", tmpDir)
		tarballPath = spec.CreateTarball(installScript)

		allowedNames = []string{"*"}
		system := system.NewOsSystem()
		i = installer.New(system)
	})

	JustBeforeEach(func() {
		listener = spec.StartDownloadServer(port, tarballPath, directorCert)
		tarballURL = fmt.Sprintf("https://localhost:%d/tarball.tgz", port)

		config, err := auth.NewSSLConfig(
			spec.FixtureFilename("certs/bootstrapper.crt"),
			spec.FixtureFilename("certs/bootstrapper.key"),
			(string)(spec.FixtureData("certs/rootCA.pem")),
			allowedNames,
		)
		Expect(err).ToNot(HaveOccurred())
		dl = downloader.NewDownloader(config, i)
	})

	AfterEach(func() {
		if listener != nil {
			listener.Close()
		}
	})

	It("GETs the given URL, opens the tarball, and runs install.sh", func() {
		err := dl.Download(logger, tarballURL)
		Expect(err).ToNot(HaveOccurred())
		installLog, err := ioutil.ReadFile(path.Join(tmpDir, "install.log"))
		Expect(err).ToNot(HaveOccurred())
		Expect((string)(installLog)).To(Equal("hiya\n"))
	})

	Context("when the download url is bad", func() {
		It("returns an http error", func() {
			err := dl.Download(logger, fmt.Sprintf("https://localhost:%d/foobar", port))
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("Not Found"))
		})
	})

	Context("when the downloaded file is bad", func() {
		BeforeEach(func() {
			tarballPath = spec.CreateTarball("foooooooooooooooooooo")
		})
		It("returns a file error", func() {
			err := dl.Download(logger, tarballURL)
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("install.sh"))
		})
	})

	Context("when server cert doesn't match client cert rules", func() {
		BeforeEach(func() {
			allowedNames = []string{"o=not.bosh.director"}
		})

		It("rejects the request", func() {
			logWriter.Capture("Fake Bosh Server")
			err := dl.Download(logger, tarballURL)
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("didn't match allowed distinguished names"))
			_, err = os.Stat(path.Join(tmpDir, "install.log"))
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("no such file"))
		})
	})
})


text:
import * as React from 'react';
import styled from 'styled-components';
import { WikiPageQuery } from 'types/WikiPageQuery';
import { Row, Col, Table } from 'react-bootstrap';
import {
  WikiPageEditFragment,
  WikiPageEditFragment_user,
} from 'types/WikiPageEditFragment';
import { gql } from 'apollo-boost';

interface EditsProps {
  edits: WikiPageEditFragment[];
}

// these are the styles provided by diffy, btw
const StyleWrapper = styled(Table)`
  .diff {
    overflow: auto;
  }
  .diff ul {
    background: none;
    overflow: auto;
    font-size: 13px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: table;
    width: 100%;
  }
  .diff del,
  .diff ins {
    display: block;
    text-decoration: none;
  }
  .diff li {
    padding: 0;
    display: table-row;
    margin: 0;
    height: 1em;
  }
  .diff li.ins {
    background: #dfd;
    color: #080;
  }
  .diff li.del {
    background: #fee;
    color: #b00;
  }
  .diff li:hover {
    background: #ffc;
  }
  /* try 'whitespace:pre;' if you don't want lines to wrap */
  .diff del,
  .diff ins,
  .diff span {
    white-space: pre-wrap;
    font-family: courier;
  }
  .diff del strong {
    font-weight: normal;
    background: #fcc;
  }
  .diff ins strong {
    font-weight: normal;
    background: #9f9;
  }
  .diff li.diff-comment {
    display: none;
  }
  .diff li.diff-block-info {
    background: none repeat scroll 0 0 gray;
  }
`;

class Edits extends React.PureComponent<EditsProps> {
  static fragment = gql`
    fragment WikiPageEditFragment on WikiPageEdit {
      user {
        id
        firstName
        lastName
        email
      }
      createdAt
      id
      comment
      diff
      diffHtml
    }
  `;

  getName = (user: WikiPageEditFragment_user | null) => {
    if (!user) return 'Anonymous';
    if (user.firstName) {
      return `${user.firstName} ${user.lastName && user.lastName[0]}`;
    }
    return user.email;
  };

  render() {
    return (

    );
  }
}

export default Edits;


text:
namespace djinni_generated {

DatabaseResultRow::DatabaseResultRow() : ::djinni::JniInterface<::ledger::core::api::DatabaseResultRow, DatabaseResultRow>() {}

DatabaseResultRow::~DatabaseResultRow() = default;

DatabaseResultRow::JavaProxy::JavaProxy(JniType j) : Handle(::djinni::jniGetThreadEnv(), j) { }

DatabaseResultRow::JavaProxy::~JavaProxy() = default;

bool DatabaseResultRow::JavaProxy::isNullAtPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallBooleanMethod(Handle::get().get(), data.method_isNullAtPos,
                                          ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Bool::toCpp(jniEnv, jret);
}
std::string DatabaseResultRow::JavaProxy::getColumnName(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = (jstring)jniEnv->CallObjectMethod(Handle::get().get(), data.method_getColumnName,
                                                  ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::String::toCpp(jniEnv, jret);
}
int16_t DatabaseResultRow::JavaProxy::getShortByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallShortMethod(Handle::get().get(), data.method_getShortByPos,
                                        ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::I16::toCpp(jniEnv, jret);
}
int32_t DatabaseResultRow::JavaProxy::getIntByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallIntMethod(Handle::get().get(), data.method_getIntByPos,
                                      ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::I32::toCpp(jniEnv, jret);
}
float DatabaseResultRow::JavaProxy::getFloatByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallFloatMethod(Handle::get().get(), data.method_getFloatByPos,
                                        ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::F32::toCpp(jniEnv, jret);
}
double DatabaseResultRow::JavaProxy::getDoubleByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallDoubleMethod(Handle::get().get(), data.method_getDoubleByPos,
                                         ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::F64::toCpp(jniEnv, jret);
}
int64_t DatabaseResultRow::JavaProxy::getLongByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallLongMethod(Handle::get().get(), data.method_getLongByPos,
                                       ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::I64::toCpp(jniEnv, jret);
}
std::string DatabaseResultRow::JavaProxy::getStringByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = (jstring)jniEnv->CallObjectMethod(Handle::get().get(), data.method_getStringByPos,
                                                  ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::String::toCpp(jniEnv, jret);
}
std::shared_ptr<::ledger::core::api::DatabaseBlob> DatabaseResultRow::JavaProxy::getBlobByPos(int32_t c_pos) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::DatabaseResultRow>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getBlobByPos,
                                         ::djinni::get(::djinni::I32::fromCpp(jniEnv, c_pos)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni_generated::DatabaseBlob::toCpp(jniEnv, jret);
}

}  // namespace djinni_generated


text:
docker build --rm --force-rm -t hinzundcode/rpi-node:5.11 rpi-node/5.11
docker push hinzundcode/rpi-node:5.11

docker build --rm --force-rm -t hinzundcode/rpi-node:6.0 rpi-node/6.0
docker push hinzundcode/rpi-node:6.0

docker build --rm --force-rm -t hinzundcode/rpi-node:6.2 rpi-node/6.2
docker push hinzundcode/rpi-node:6.2

docker tag hinzundcode/rpi-node:6.2 hinzundcode/rpi-node:latest
docker push hinzundcode/rpi-node:latest


text:
{% extends "issues/base.html" %}

{% load i18n %}
{% load issues_tags %}
{% load sorting_tags %}

{% block head_title %}{% blocktrans %}Issues{% endblocktrans %}{% endblock %}

{% block breadcrumbs %}

Issues

    {% if the_discipline and the_tag %}

{{ the_discipline }}

{{ the_tag }}

    {% else %}
        {% if the_discipline %}

{{ the_discipline }}

        {% endif %}
        {% if the_tag %}

{{ the_tag }}

        {% endif %}
    {% endif %}
{% endblock %}

{% block actions %}
    {% if user.is_authenticated %}

            + Add New Issue

    {% endif %}

        <form class="search-form" method="GET" action="">
            <input id="search-input" type="text" name="search" value="{% if search_terms %}{{ search_terms }}{% else %}Search Issues{% endif %}" />
            <input id="search-button" type="image" src="{{ STATIC_URL }}images/search_button.png" value="Search Issues" />
            {% if search_terms %}
                Clear Search Terms
            {% endif %}
        </form>

{% endblock %}

{% block body %}

Sort by

{% anchor created "date" %}

{% anchor yeas "yeas" %}

{% anchor nays "nays" %}

By extras

            {% if sandbox %}

                    Include sandbox issues

            {% else %}

                    Include sandbox issues

            {% endif %}

            {% if model_project %}

                    Only model projects

            {% else %}

                    Only model projects

            {% endif %}

By discipline

            {% if the_discipline %}
                {% if not the_discipline.is_root_node %}
                    {{ the_discipline.parent.name|truncatechar:10 }}
                {% endif %}

                    {{ the_discipline }}

            {% endif %}

            {% if discipline_filters %}

                    {% for discipline in discipline_filters %}

{{ discipline.name|truncatechar:20 }}

                    {% endfor %}

            {% else %}

                    No children disciplines

            {% endif %}

By tag

            {% if the_tag %}

                    {{ the_tag }}

            {% endif %}

            {% if tag_filters %}

                    {% for tag in tag_filters %}

{% filter_link request "tag" tag.id tag.name%}

                    {% endfor %}

            {% else %}

                    {% if the_tag %}
                        No related tags.
                    {% else %}
                        No tags on these objects.
                    {% endif %}

            {% endif %}

            {{ list_title }}
            {% if search_terms %}
                with keywords "{{ search_terms }}"
            {% endif %}

            ({{ issues.paginator.count }} results)

            {% if issues.paginator.count > 0 %}
                {% for issue in issues.object_list %}
                    {% show_issue issue %}
                {% endfor %}
            {% else %}
                {% if mine %}

                        You haven't contributed to any issues yet.

                {% else %}

                        No issues match your filters. Please broaden your search or create a new issue.

                {% endif %}
            {% endif %}

                Page
                {% for page in issues.paginator.page_range %}
                    {% ifequal page issues.paginator.number %}
                        {{ page }}
                    {% else %}
                        {{ page }}
                    {% endifequal %}
                {% endfor %}

{% endblock %}


text: Tooling pretty-print API ToJSON instances in HTML and link hypermedia attributes.


text:
MESSAGE(STATUS "Looking for QHttp Librairies...")

find_path(QHTTP_ROOT_DIR
    NAMES include/qhttp/qhttpserver.hpp
)

find_path(QHTTP_INCLUDE_DIR
    NAMES qhttp/qhttpserver.hpp
    HINTS ${QHTTP_ROOT_DIR}/include
)

find_library(QHTTP_LIBRARY
    NAMES qhttp
    HINTS ${QHTTP_ROOT_DIR}/lib
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(qhttp DEFAULT_MSG
    QHTTP_INCLUDE_DIR
    QHTTP_LIBRARY
)

mark_as_advanced(
    QHTTP_ROOT_DIR
    QHTTP_INCLUDE_DIR
    QHTTP_LIBRARY
)


text:
<?php
/**
 * Created by IntelliJ IDEA.
 * User: gerk
 * Date: 17.12.16
 * Time: 22:01
 */
declare(strict_types=1);

namespace PeekAndPoke\Aviator\ServiceContainer\DomainModel;

use PeekAndPoke\Component\Slumber\Annotation\Slumber;

/**
 * @author Karsten J. Gerber <kontakt@karsten-gerber.de>
 */
class ServiceFactoryMethod
{
    /**
     * @var string
     *
     * @Slumber\AsString()
     */
    private $factoryId;
    /**
     * @var string
     *
     * @Slumber\AsString()
     */
    private $methodName;
    /**
     * @var bool
     *
     * @Slumber\AsBool()
     */
    private $optional;
    /**
     * @var MethodInjection
     *
     * @Slumber\AsObject(MethodInjection::class)
     */
    private $injection;

    /**
     * @param string          $factoryId  The id of the factory-service
     * @param string          $methodName The method name on the factory service
     * @param bool            $optional   Whether the service is always present or optional
     * @param MethodInjection $injection
     */
    public function __construct(string $factoryId, string $methodName, bool $optional, MethodInjection $injection)
    {
        $this->factoryId  = $factoryId;
        $this->methodName = $methodName;
        $this->optional   = $optional;
        $this->injection  = $injection;
    }

    /**
     * @return string
     */
    public function getMethodName() : string
    {
        return $this->methodName;
    }

    /**
     * @return string
     */
    public function getFactoryId() : string
    {
        return $this->factoryId;
    }

    /**
     * @return bool
     */
    public function isOptional() : bool
    {
        return $this->optional;
    }

    /**
     * @return MethodInjection
     */
    public function getInjection() : MethodInjection
    {
        return $this->injection;
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bingo;

/**
 *
 * @author 15174782
 */
public class GameDelegate {

}


text: import payload_generators


text:
module Selenium
  module WebDriver
    #
    # @api private
    #
    module TakesScreenshot
      #
      # Save a PNG screenshot to the given path
      #
      # @api public
      #

      def save_screenshot(png_path)
        extension = File.extname(png_path).downcase
        if extension != '.png'
          WebDriver.logger.warn "name used for saved screenshot does not match file type. "\
                                "It should end with .png extension",
                                id: :screenshot
        end
        File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
      end

      #
      # Return a PNG screenshot in the given format as a string
      #
      # @param [:base64, :png] format
      # @return String screenshot
      #
      # @api public

      def screenshot_as(format)
        case format
        when :base64
          screenshot
        when :png
          screenshot.unpack1('m')
        else
          raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
        end
      end

    end # TakesScreenshot
  end # WebDriver
end # Selenium


text:
namespace cc {

class DamageTracker;
class DelegatedRendererLayerImpl;
class QuadSink;
class RenderPassSink;
class LayerImpl;

struct AppendQuadsData;

class CC_EXPORT RenderSurfaceImpl {
public:
    explicit RenderSurfaceImpl(LayerImpl*);
    virtual ~RenderSurfaceImpl();

    std::string name() const;
    void dumpSurface(std::string*, int indent) const;

    gfx::PointF contentRectCenter() const { return gfx::RectF(m_contentRect).CenterPoint(); }

    // Returns the rect that encloses the RenderSurfaceImpl including any reflection.
    gfx::RectF drawableContentRect() const;

    float drawOpacity() const { return m_drawOpacity; }
    void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }

    void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_nearestAncestorThatMovesPixels = surface; }
    const RenderSurfaceImpl* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }

    bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
    void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }

    void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
    const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }

    void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
    const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }

    void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
    const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }

    void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
    const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }

    bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
    void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
    bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
    void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }

    void setIsClipped(bool isClipped) { m_isClipped = isClipped; }
    bool isClipped() const { return m_isClipped; }

    void setClipRect(const gfx::Rect&);
    const gfx::Rect& clipRect() const { return m_clipRect; }

    bool contentsChanged() const;

    void setContentRect(const gfx::Rect&);
    const gfx::Rect& contentRect() const { return m_contentRect; }

    std::vector<LayerImpl*>& layerList() { return m_layerList; }
    void addContributingDelegatedRenderPassLayer(LayerImpl*);
    void clearLayerLists();

    int owningLayerId() const;

    void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
    bool surfacePropertyChanged() const;
    bool surfacePropertyChangedOnlyFromDescendant() const;

    DamageTracker* damageTracker() const { return m_damageTracker.get(); }

    RenderPass::Id renderPassId();

    void appendRenderPasses(RenderPassSink&);
    void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::Id renderPassId);

private:
    LayerImpl* m_owningLayer;

    // Uses this surface's space.
    gfx::Rect m_contentRect;
    bool m_surfacePropertyChanged;

    float m_drawOpacity;
    bool m_drawOpacityIsAnimating;
    WebKit::WebTransformationMatrix m_drawTransform;
    WebKit::WebTransformationMatrix m_screenSpaceTransform;
    WebKit::WebTransformationMatrix m_replicaDrawTransform;
    WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
    bool m_targetSurfaceTransformsAreAnimating;
    bool m_screenSpaceTransformsAreAnimating;

    bool m_isClipped;

    // Uses the space of the surface's target surface.
    gfx::Rect m_clipRect;

    std::vector<LayerImpl*> m_layerList;
    std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;

    // The nearest ancestor target surface that will contain the contents of this surface, and that is going
    // to move pixels within the surface (such as with a blur). This can point to itself.
    RenderSurfaceImpl* m_nearestAncestorThatMovesPixels;

    scoped_ptr<DamageTracker> m_damageTracker;

    // For LayerIteratorActions
    int m_targetRenderSurfaceLayerIndexHistory;
    int m_currentLayerIndexHistory;

    friend struct LayerIteratorActions;

    DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl);
};

}
#endif  // CC_RENDER_SURFACE_IMPL_H_


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Z. Mykol. 53(1): 140 (1987)

#### Original name
Humaria calospora Quél., 1885

### Remarks
null


text:
using System.Threading.Tasks;
using Typewriter.Core.Models;

namespace Typewriter.Core.Data
{
    public interface IEntityRepository
    {
        Task<ITypewriterEntity> Find(FindRequest request);
        Task<PagedResponse<ITypewriterEntity>> Query(QueryRequest request);
        Task<bool> Insert<TEntity>(TEntity entity) where TEntity : class, ITypewriterEntity;
        Task<bool> Update<TEntity>(TEntity entity) where TEntity : class, ITypewriterEntity;
        Task<bool> Remove<TEntity>(TEntity entity) where TEntity : class, ITypewriterEntity;
    }
}


text:
using System.Collections.Generic;
using Settings.Common.Models;

namespace Settings.Common.Interfaces
{
    public interface ISettingsService
    {
        IEnumerable<SettingReadModel> GetApplicationEnvironmentSettings(string applicationName,
            string environmentName);

        void CreateOrEditSettings(string applicationName, string environmentName, SettingsWriteModel writeModel);
    }
}


text:
{-# LANGUAGE OverloadedStrings #-}
import           Control.Lens
import qualified Data.Bimap              as BM
import qualified Data.ByteString.Char8   as B
import           Data.Either.Combinators
import           Data.Maybe
import qualified Data.Set                as S
import qualified Data.Text               as T
import           Network.URI
import           Pipes
import qualified Pipes.Prelude           as P
import qualified Pipes.Safe              as P
import           System.Environment
import qualified System.ZMQ4             as Z

import           Vaultaire.Types

import           Borel

main :: IO ()
main = do
  tenancy:_ <- getArgs
  Right (conf, _) <- loadBorelConfig "borel-openstack.conf"
  context <- Z.context
  P.runSafeT
    $ runEffect
    $ run conf (conf ^. allMetrics) (TenancyID $ T.pack tenancy) start end
    >-> P.print
  Z.term context
  where start = read "2014-12-01" :: TimeStamp
        end   = read "2014-12-07" :: TimeStamp
        flavors = BM.empty


text:
RSpec.describe 'satisfy matcher' do
  # subject { 'racecar' }
  subject { 'racecars' }

  it 'is a palindrome' do
    expect(subject).to satisfy { |value| value == value.reverse  }
  end

  it 'can accept a custom error message' do
    expect(subject).to satisfy('be a palindrome') do |value|
      value == value.reverse
    end
  end
end


text:
package filodb.memory.format

import java.sql.Timestamp

import filodb.memory.NativeMemoryManager
import filodb.memory.format.MemoryReader._
import filodb.memory.format.vectors.{IntBinaryVector, LongBinaryVector}
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers

class RowReaderTest extends AnyFunSpec with Matchers {
  val memFactory = new NativeMemoryManager(100000)
  val acc = nativePtrReader
  val rows = Seq(
    (Some("Matthew Perry"), Some(18), Some(new Timestamp(10000L))),
    (Some("Michelle Pfeiffer"), None, Some(new Timestamp(10010L))),
    (Some("George C"), Some(59), None),
    (Some("Rich Sherman"), Some(26), Some(new Timestamp(10000L)))
  )

  val csvRows = Seq(
    "Matthew Perry,18,1973-01-25T00Z",
    "Michelle Pfeiffer,,1970-07-08T00Z",
    "George C,59,",
    "Rich Sherman,26,1991-10-12T00Z"
  ).map(str => (str.split(',') :+ "").take(3))

  def readValues[T](r: MutableFiloRowReader, len: Int)(f: RowReader => T): Seq[T] = {
    (0 until len).map { i =>
      r.rowNo = i
      f(r)
    }
  }

  it("should read longs from timestamp strings from ArrayStringRowReader") {
    ArrayStringRowReader(csvRows.head).getLong(2) should equal(96768000000L)
  }

  it("should append to BinaryAppendableVector from Readers using addFromReader") {
    val readers = rows.map(TupleRowReader)
    val appenders = Seq(
      IntBinaryVector.appendingVector(memFactory, 10),
      LongBinaryVector.appendingVector(memFactory, 10)
    )
    readers.foreach { r => appenders.zipWithIndex.foreach { case (a, i) => a.addFromReader(r, i + 1) } }
    val ptrs = appenders.map(_.optimize(memFactory)).toArray
    val reader = new
        MutableFiloRowReader {
      def reader(columnNo: Int): VectorDataReader = columnNo match {
        case 0 => IntBinaryVector(acc, ptrs(0))
        case 1 => LongBinaryVector(acc, ptrs(1))
      }
      def vectAddr(columnNo: Int): BinaryVector.BinaryVectorPtr = ptrs(columnNo)
      def vectAccessor(columnNo: Int): MemoryReader = acc
    }

    readValues(reader, 4)(_.getInt(0)) should equal(Seq(18, 0, 59, 26))
    reader.rowNo = 1
    // reader.notNull(0) should equal(false)    // notNull does not work since isAvailable is not available everywhere
  }

  import filodb.memory.format.RowReader._

  it("should compare RowReaders using TypedFieldExtractor") {
    val readers = rows.map(TupleRowReader)
    StringFieldExtractor.compare(readers(1), readers(2), 0) should be > (0)
    IntFieldExtractor.compare(readers(0), readers(2), 1) should be < (0)
    TimestampFieldExtractor.compare(readers(0), readers(3), 2) should equal(0)

    // Ok, we should be able to compare the reader with the NA / None too
    IntFieldExtractor.compare(readers(1), readers(2), 1) should be < (0)
  }
}


text:
//================================================================================
//Copyright (c) 2012, David Yu
//All rights reserved.
//--------------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
// 3. Neither the name of protostuff nor the names of its contributors may be used
//    to endorse or promote products derived from this software without
//    specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//================================================================================

package com.dyuproject.protostuff.runtime;

import java.io.IOException;

import com.dyuproject.protostuff.GraphInput;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Pipe;
import com.dyuproject.protostuff.ProtostuffException;
import com.dyuproject.protostuff.Schema;

import static com.dyuproject.protostuff.runtime.RuntimeFieldFactory.ID_ENUM;
import static com.dyuproject.protostuff.runtime.RuntimeFieldFactory.STR_ENUM;

/**
 * Used when a field is declared as "Enum<?>" (with or with-out generics).
 *
 * @author David Yu
 * @created Apr 25, 2012
 */
public abstract class PolymorphicEnumSchema extends PolymorphicSchema
{

    static final int ID_ENUM_VALUE = 1;
    static final String STR_ENUM_VALUE = "a";

    static String name(int number)
    {
        switch(number)
        {
            case ID_ENUM_VALUE: return STR_ENUM_VALUE;
            case ID_ENUM: return STR_ENUM;
            default: return null;
        }
    }

    static int number(String name)
    {
        if(name.length() != 1)
            return 0;

        switch(name.charAt(0))
        {
            case 'a': return ID_ENUM_VALUE;
            case 'x': return ID_ENUM;
            default: return 0;
        }
    }

    protected final Pipe.Schema<Object> pipeSchema = new Pipe.Schema<Object>(this)
    {
        protected void transfer(Pipe pipe, Input input, Output output) throws IOException
        {
            transferObject(this, pipe, input, output, strategy);
        }
    };

    public PolymorphicEnumSchema(IdStrategy strategy)
    {
        super(strategy);
    }

    public Pipe.Schema<Object> getPipeSchema()
    {
        return pipeSchema;
    }

    public String getFieldName(int number)
    {
        return name(number);
    }

    public int getFieldNumber(String name)
    {
        return number(name);
    }

    public String messageFullName()
    {
        return Enum.class.getName();
    }

    public String messageName()
    {
        return Enum.class.getSimpleName();
    }

    public void mergeFrom(Input input, Object owner) throws IOException
    {
        setValue(readObjectFrom(input, this, owner, strategy), owner);
    }

    public void writeTo(Output output, Object value) throws IOException
    {
        writeObjectTo(output, value, this, strategy);
    }

    static void writeObjectTo(Output output, Object value, Schema<?> currentSchema,
            IdStrategy strategy) throws IOException
    {
        final Class<?> clazz = value.getClass();
        if(clazz.getSuperclass() != null && clazz.getSuperclass().isEnum())
        {
            strategy.writeEnumIdTo(output, ID_ENUM, clazz.getSuperclass());
            EnumIO.writeTo(output, ID_ENUM_VALUE, false, (Enum<?>)value);
        }
        else
        {
            strategy.writeEnumIdTo(output, ID_ENUM, clazz);
            EnumIO.writeTo(output, ID_ENUM_VALUE, false, (Enum<?>)value);
        }
    }

    static Object readObjectFrom(Input input,  Schema<?> schema, Object owner,
            IdStrategy strategy) throws IOException
    {
        if(ID_ENUM != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        final EnumIO<?> eio = strategy.resolveEnumFrom(input);

        if(ID_ENUM_VALUE != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        final Object value = eio.readFrom(input);

        if(input instanceof GraphInput)
        {
            // update the actual reference.
            ((GraphInput)input).updateLast(value, owner);
        }

        if(0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        return value;
    }

    static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
            Input input, Output output, IdStrategy strategy) throws IOException
    {
        if(ID_ENUM != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");

        strategy.transferEnumId(input, output, ID_ENUM);

        if(ID_ENUM_VALUE != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");

        EnumIO.transfer(pipe, input, output, 1, false);

        if(0 != input.readFieldNumber(pipeSchema.wrappedSchema))
            throw new ProtostuffException("Corrupt input.");
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycogr. Suisse 2: 482 (1833)

#### Original name
Daedalea cinnabarina Secr.

### Remarks
null


text:
using System;
using System.Text;
using System.Threading.Tasks;
using Lykke.Logs;
using Lykke.SlackNotifications;
using MarginTrading.Common.Enums;

namespace MarginTrading.Common.Services
{
    public class MtSlackNotificationsSender : IMtSlackNotificationsSender
    {
        private readonly ISlackNotificationsSender _sender;
        private readonly string _appName;
        private readonly string _env;

        public MtSlackNotificationsSender(ISlackNotificationsSender sender, string appName, string env)
        {
            _sender = sender;
            _appName = appName;
            _env = env;
        }

        public async Task SendAsync(string type, string sender, string message)
        {
            if (type.Equals(ChannelTypes.Monitor, StringComparison.InvariantCultureIgnoreCase))
            {
                await _sender.SendAsync(type, sender, message);
                return;
            }

            await _sender.SendAsync(ChannelTypes.MarginTrading, sender, GetSlackMsg(message));
        }

        public Task SendRawAsync(string type, string sender, string message)
        {
            return _sender.SendAsync(type, sender, message);
        }

        private string GetSlackMsg(string message)
        {
            var sb = new StringBuilder();
            sb.Append(_appName);
            sb.Append(":");
            sb.AppendLine(_env);
            sb.AppendLine("\n====================================");
            sb.AppendLine(message);
            sb.AppendLine("====================================\n");

            return sb.ToString();
        }
    }
}


text:
//  *************************************************************
// <copyright file="ComplexMonoid.cs" company="None">
//     Copyright (c) 2014 andy. All rights reserved.
// </copyright>
// <license>MIT Licence</license>
// <author>andy</author>
// <email>andy.augustin@t-online.de</email>
// *************************************************************
using GenericMath.Base.Contracts;

namespace GenericMath.Base
{
	using System.Numerics;

	/// <summary>
	/// Monoid for complex numbers.
	/// </summary>
	public class ComplexMonoid : IMonoid<Complex>
	{
		#region IGroup implementation

		#region properties

		/// <summary>
		/// Gets the zero element of the group.
		/// </summary>
		/// <value>The zero.</value>
		public Complex Zero {
			get {
				return Complex.Zero;
			}
		}

		#endregion

		#region methods

		/// <summary>
		/// Addition of the specified leftElement and rightElement.
		/// </summary>
		/// <param name="leftElement">Left element.</param>
		/// <param name="rightElement">Right element.</param>
		/// <returns>The addition of the leftElement and rightElement (leftElement + rightElement)</returns>
		public Complex Addition (Complex leftElement, Complex rightElement)
		{
			return leftElement + rightElement;
		}

		#endregion

		#endregion

		#region OVERRIDES OF OBJECT

		/// <summary>
		/// Returns a <see cref="System.String"/> that represents the current <see cref="ComplexMonoid"/>.
		/// </summary>
		/// <returns>A <see cref="System.String"/> that represents the current <see cref="ComplexMonoid"/>.</returns>
		public override string ToString ()
		{
			return string.Format (
				"[{0}: Zero={1}, Generic argument type: {2}]",
				this.GetType ().Name,
				this.Zero,
				typeof(Complex));
		}

		#endregion
	}
}


text:
package com.navercorp.pinpoint.plugin.tomcat.interceptor;

import com.navercorp.pinpoint.bootstrap.MetadataAccessor;
import com.navercorp.pinpoint.bootstrap.context.Trace;
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
import com.navercorp.pinpoint.bootstrap.instrument.MethodInfo;
import com.navercorp.pinpoint.bootstrap.interceptor.SimpleAroundInterceptor;
import com.navercorp.pinpoint.bootstrap.logging.PLogger;
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
import com.navercorp.pinpoint.bootstrap.plugin.annotation.Cached;
import com.navercorp.pinpoint.bootstrap.plugin.annotation.Name;
import com.navercorp.pinpoint.plugin.tomcat.TomcatConstants;

/**
 *
 * @author jaehong.kim
 *
 */
public class RequestRecycleInterceptor implements SimpleAroundInterceptor, TomcatConstants {

    private PLogger logger = PLoggerFactory.getLogger(this.getClass());

    private MethodInfo targetMethod;
    private MetadataAccessor traceAccessor;
    private MetadataAccessor asyncAccessor;

    public RequestRecycleInterceptor(TraceContext context, @Cached MethodInfo targetMethod, @Name(METADATA_TRACE) MetadataAccessor traceAccessor, @Name(METADATA_ASYNC) MetadataAccessor asyncAccessor) {
        this.targetMethod = targetMethod;
        this.traceAccessor = traceAccessor;
        this.asyncAccessor = asyncAccessor;
    }

    @Override
    public void before(Object target, Object[] args) {
        logger.beforeInterceptor(target, target.getClass().getName(), targetMethod.getName(), "", args);
        try {
            if (asyncAccessor.isApplicable(target)) {
                // reset
                asyncAccessor.set(target, Boolean.FALSE);
            }

            if (traceAccessor.isApplicable(target) && traceAccessor.get(target) != null) {
                final Trace trace = traceAccessor.get(target);
                if (trace != null && trace.canSampled()) {
                    // end of root span
                    trace.markAfterTime();
                    trace.traceRootBlockEnd();
                }
                // reset
                traceAccessor.set(target, null);
            }
        } catch (Throwable t) {
            logger.warn("Failed to before process. {}", t.getMessage(), t);
        }
    }

    @Override
    public void after(Object target, Object[] args, Object result, Throwable throwable) {
    }
}


text:
@interface DVATableViewUpdate ()
@property (nonatomic)       DVATableViewUpdateType     type;
@property (nonatomic,copy)  NSIndexPath                     *indexPath;
@property (nonatomic,copy)  NSIndexPath                     *otherIndexPath;
@end

@implementation DVATableViewUpdate

- (instancetype)initWithType:(DVATableViewUpdateType)type
                   indexPath:(NSIndexPath *)ip
              otherIndexPath:(NSIndexPath *)otherIp
{
    self = [super init];
    if (self) {
        self.type = type;
        self.indexPath = ip;
        self.otherIndexPath = otherIp;

    }
    return self;
}

-(DVATableViewUpdateType)dva_updateType{
    return self.type;
}
-(NSIndexPath *)dva_indexPath{
    return self.indexPath;
}

-(NSIndexPath *)dva_toIndexPath{
    return self.otherIndexPath;
}
@end