text:
package analyser

import (
	"bytes"
	"context"
	"fmt"
	"io/ioutil"
	"strings"
	"time"

	"github.com/bradleyfalzon/gopherci/internal/db"
	"github.com/bradleyfalzon/gopherci/internal/logger"
	"github.com/bradleyfalzon/revgrep"
	"github.com/pkg/errors"
)

const (
	// ArgBaseBranch replaces tool arg with the name of the base branch
	ArgBaseBranch = "%BASE_BRANCH%"
)

// An Analyser is builds an isolated execution environment to run checks in.
// It should provide isolation from other environments and support being
// called concurrently.
type Analyser interface {
	// NewExecuter returns an Executer with the working directory set to
	// $GOPATH/src/<goSrcPath>.
	NewExecuter(ctx context.Context, goSrcPath string) (Executer, error)
}

// Config hold configuration options for use in analyser. All options
// are required.
type Config struct {
	// HeadRef is the name of the reference containing changes.
	HeadRef string
}

// Executer executes a single command in a contained environment.
type Executer interface {
	// Execute executes a command and returns the combined stdout and stderr,
	// along with an error if any. Must not be called after Stop(). If the
	// command returns a non-zero exit code, an error of type NonZeroError
	// is returned.
	Execute(context.Context, []string) ([]byte, error)
	// Stop stops the executer and allows it to cleanup, if applicable.
	Stop(context.Context) error
}

// NonZeroError maybe returned by an Executer when the command executed returns
// with a non-zero exit status.
type NonZeroError struct {
	args     []string
	ExitCode int // ExitCode is the non zero exit code
}

// Error implements the error interface.
func (e *NonZeroError) Error() string {
	return fmt.Sprintf("%v returned exit code %v", e.args, e.ExitCode)
}

// Analyse downloads a repository set in config in an environment provided by
// exec, running the series of tools. Writes results to provided analysis,
// or an error. The repository is expected to contain at least one Go package.
func Analyse(ctx context.Context, logger logger.Logger, exec Executer, cloner Cloner, configReader ConfigReader, refReader RefReader, config Config, analysis *db.Analysis) error {
	start := time.Now()
	defer func() {
		analysis.TotalDuration = db.Duration(time.Since(start))
	}()
	logger = logger.With("area", "analyser")

	deltaStart := time.Now() // start of specific analysis
	if err := cloner.Clone(ctx, exec); err != nil {
		return errors.WithMessage(err, "could not clone")
	}
	analysis.CloneDuration = db.Duration(time.Since(deltaStart))

	// read repository's configuration
	repoConfig, err := configReader.Read(ctx, exec)
	if err != nil {
		return errors.WithMessage(err, "could not configure repository")
	}

	// Show environment
	envArgs := [][]string{
		{"go", "env"},
		{"go", "version"},
		{"cat", "/proc/self/limits"},
		{"lsb_release", "--description"},
	}
	for _, arg := range envArgs {
		out, err := exec.Execute(ctx, arg)
		if err != nil {
			return fmt.Errorf("could not execute %v: %s\n%s", arg, err, out)
		}
	}

	// install packages
	if err := installAPTPackages(ctx, exec, repoConfig.APTPackages); err != nil {
		return errors.WithMessage(err, "could not install packages")
	}

	// get the base ref
	baseRef, err := refReader.Base(ctx, exec)
	if err != nil {
		return errors.Wrap(err, "could not get base ref")
	}

	// create a unified diff for use by revgrep
	patch, err := getPatch(ctx, exec, baseRef, config.HeadRef)
	if err != nil {
		return errors.Wrap(err, "could not get patch")
	}

	// install dependencies, some static analysis tools require building a project
	deltaStart = time.Now()
	args := []string{"install-deps.sh"}
	out, err := exec.Execute(ctx, args)
	if err != nil {
		return fmt.Errorf("could not execute %v: %s\n%s", args, err, out)
	}
	analysis.DepsDuration = db.Duration(time.Since(deltaStart))
	logger.With("step", "install-deps.sh").Info(string(bytes.TrimSpace(out)))

	// get the base package working directory, used by revgrep to change absolute
	// path for the filename in an issue (used by some tools) to relative (used by
	// patch).
	args = []string{"pwd"}
	out, err = exec.Execute(ctx, args)
	if err != nil {
		return fmt.Errorf("could not execute %v: %s\n%s", args, err, out)
	}
	pwd := string(bytes.TrimSpace(out))

	for _, tool := range repoConfig.Tools {
		deltaStart = time.Now()
		args := []string{tool.Path}
		for _, arg := range strings.Fields(tool.Args) {
			switch arg {
			case ArgBaseBranch: // TODO change to ArgBaseRef
				// Tool wants the base ref name as a flag
				arg = baseRef
			}
			args = append(args, arg)
		}
		out, err := exec.Execute(ctx, args)
		switch err.(type) {
		case nil, *NonZeroError:
			// Ignore non-zero exit codes from tools, these are often normal.
		default:
			return fmt.Errorf("could not execute %v: %s\n%s", args, err, out)
		}
		logger.With("step", tool.Name).Info("ran tool")

		checker := revgrep.Checker{
			Patch:   bytes.NewReader(patch),
			Regexp:  tool.Regexp,
			AbsPath: pwd,
		}

		revIssues, err := checker.Check(bytes.NewReader(out), ioutil.Discard)
		if err != nil {
			return err
		}
		logger.Infof("revgrep found %v issues", len(revIssues))

		var issues []db.Issue
		for _, issue := range revIssues {
			// Remove issues in generated files, isFileGenereated will return
			// 0 for file is generated or 1 for file is not generated.
			args = []string{"isFileGenerated", pwd, issue.File}
			out, err := exec.Execute(ctx, args)
			logger.With("step", "isFileGenerated").Info(string(bytes.TrimSpace(out)))
			switch err {
			case nil:
				continue // file is generated, ignore the issue
			default:
				if etype, ok := err.(*NonZeroError); ok && etype.ExitCode == 1 {
					break // file is not generated, record the issue
				}
				return fmt.Errorf("could not execute %v: %s\n%s", args, err, out)
			}

			issues = append(issues, db.Issue{
				Path:    issue.File,
				Line:    issue.LineNo,
				HunkPos: issue.HunkPos,
				Issue:   fmt.Sprintf("%s: %s", tool.Name, issue.Message),
			})
		}

		analysis.Tools[tool.ID] = db.AnalysisTool{
			Duration: db.Duration(time.Since(deltaStart)),
			Issues:   issues,
		}
	}

	return nil
}

func getPatch(ctx context.Context, exec Executer, baseRef, headRef string) ([]byte, error) {
	args := []string{"git", "diff", fmt.Sprintf("%v...%v", baseRef, headRef)}
	patch, err := exec.Execute(ctx, args)
	if err != nil {
		// The error may be because baseRef does not exist
		// - remote ref has been removed (but then the clone wouldn't have worked)
		// - new repository with zero history
		// - a new branch with no shared history
		// So use git show to generate a unified diff of just the latest ref.
		var (
			showArgs = []string{"git", "show", headRef}
			showErr  error
		)
		patch, showErr = exec.Execute(ctx, showArgs)
		if showErr != nil {
			return patch, fmt.Errorf("could not execute %v: %s after trying to execute %v: %v", showArgs, showErr, args, err)
		}
	}
	return patch, nil
}

// installAptPackages install packages using apt package manager, it expects
// apt-get update to have already been executed. Can be called with 0 or more
// packages.
func installAPTPackages(ctx context.Context, exec Executer, packages []string) error {
	if len(packages) == 0 {
		return nil
	}
	args := append([]string{"apt-get", "install", "-y"}, packages...)
	_, err := exec.Execute(ctx, args)
	return errors.Wrapf(err, "could not install %d apt_packages", len(packages))
}


text:
include_recipe 'yum'
include_recipe 'yum-epel'
include_recipe 'openstack-common::default'

package 'git'
package 'dib-utils'
package 'PyYAML'

package 'qemu'

git '/root/diskimage-builder' do
  repository 'https://github.com/openstack/diskimage-builder.git'
  revision 'master'
  action :sync
end

cookbook_file '/root/.bash_profile'

# Fix installing DIB_SAT_CERT_RPM_URL ... contrib back
# 'Update' /usr/share/rhn/RHNS-CA-CERT ... contrib back
cookbook_file '/root/diskimage-builder/elements/rhel-common/pre-install.d/00-rhsm'

# Enable service with chkconfig if update.rc does not exist ... contrib back
# Update 'network' service to depend on dhcp-all-interfaces ... contrib back
cookbook_file '/root/diskimage-builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces'

# Disable RHN services
cookbook_file '/root/diskimage-builder/elements/rhel-common/finalise.d/99-disable-services' do
  mode 0755
end

# Properly detect sysv from upstart as RHEL6 has both installed but uses sysv ... contrib fix
cookbook_file '/root/diskimage-builder/elements/dib-init-system/dib-init-system'

# Allow dumping a full cloud-init yaml config ... contrib back
cookbook_file '/root/diskimage-builder/elements/cloud-init-datasources/install.d/05-set-cloud-init-sources'

redpajama_set_name: RedPajamaGithub


text:
(function(){
"use strict";

angular.module("coding.assignment")
	.controller("AssignmentHomeCtrl", AssignmentHomeCtrl)
	.controller("AssignmentCreateCtrl", AssignmentCreateCtrl)
	.controller("AssignmentDetailCtrl", AssignmentDetailCtrl)

AssignmentHomeCtrl.$inject = ["$scope", "$location", "Assignment"];
function AssignmentHomeCtrl($scope, $location, Assignment) {
	var vm = this;

}

AssignmentCreateCtrl.$inject = ["$scope", "$location", "$q", "Assignment", "CodeScheme", "SysUser"]
function AssignmentCreateCtrl($scope, $location, $q, Assignment, CodeScheme, SysUser) {
	var vm = this;

	vm.assignment = new Assignment();
	vm.codeSchemes = CodeScheme.query();
	vm.users = SysUser.query();
	vm.coders = [];
	vm.errors = {};

	$q.all([vm.codeSchemes.$promise, vm.users.$promise])
		.then(loadingFinished)
		.catch(loadingError);

	vm.submit = submit;
	vm.fieldHasError = fieldHasError;

	////////////////////////////

	function loadingFinished(data) {
		if(vm.codeSchemes.length > 0) {
			vm.assignment.codeSchemes = [vm.codeSchemes[0].id];
		}

		if(vm.coders.length > 0) {
			vm.coders = [vm.coders[0].id];
		}

	}

	function loadingError(err) {
		console.error("failed to load data:" + err)
	}

	function fieldHasError(fieldName) {
		return vm.errors ? fieldName in vm.errors : false;
	}

	function submit($event) {
		// reset our error and success statuses
		vm.success = null;
		vm.errors = null;

		//
		var tmp_list = vm.assignment.assigned_comments;
		var list = vm.assignment.assigned_comments.replace(/\n/gi, ",")
		vm.assignment.assigned_comments = list.split(",");

		vm.assignment.assigned_submissions = [];

		vm.assignment.$save()
			.then(function (data){
				console.log("successful save");
				vm.success = data;
			})
			.catch(function(err, data){
				console.error("failed to save: " + err);
				console.dir(err);
				vm.errors = err.data;
			})
			.finally(function(data){
				vm.assignment.assigned_comments = tmp_list;
			})

	}

}

AssignmentDetailCtrl.$inject = ["$scope", "$stateParams", "Assignment", "CodeScheme", "SysUser"]
function AssignmentDetailCtrl($scope, $stateParams, Assignment, CodeScheme, SysUser) {
	var vm = this;

	console.log("assignmentdetail")

	vm.assignment = Assignment.get({id: $stateParams.id});

	vm.assignment.$promise
		.then(function(d){
			console.log("success");
		})
		.catch(function(err){
			console.error("failed to load data");
			console.dir(err);
		})
}

})();


text:
package net.lshift.diffa.versioning;

import net.lshift.diffa.versioning.partitioning.MerkleNode;
import net.lshift.diffa.versioning.partitioning.MerkleUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

@RunWith(Theories.class)
public class MerkleNodeTest {

  @DataPoint
  public static TestScenario entityId() {
    final String version = RandomStringUtils.randomAlphabetic(10);

    // MD5(baz) = 73feffa4b7f6bb68e44cf984c85f6e88

    MerkleNode leaf = new MerkleNode("f", "baz", version);
    MerkleNode mid = new MerkleNode("3", leaf);
    MerkleNode root = new MerkleNode("7", mid);
    return new TestScenario("baz", version, root);
  }

  @Theory
  public void shouldBuildEntityId(TestScenario scenario) {
    MerkleNode node = MerkleUtils.buildEntityIdNode(scenario.getId(), scenario.getVersion());
    assertEquals(scenario.getExpected(), node);
  }

  @Test
  public void shouldBuildHierarchyFromString() {

    MerkleNode hydrated = MerkleNode.buildHierarchy("ab.cd.ef");

    MerkleNode leaf = new MerkleNode("ef", null, null);
    MerkleNode middle = new MerkleNode("cd", leaf);
    MerkleNode top = new MerkleNode("ab", middle);
    MerkleNode expected = new MerkleNode("", top);

    assertEquals(expected, hydrated);
  }

  private static class TestScenario {
    private String id;
    private String version;
    private MerkleNode expected;

    public TestScenario(String id, String version, MerkleNode node) {
      this.id = id;
      this.version = version;
      this.expected = node;
    }

    public MerkleNode getExpected() {
      return expected;
    }

    public String getId() {
      return id;
    }

    public String getVersion() {
      return version;
    }
  }
}


text:
class GreyGoo
# Defines which abilities can be called on this object by a player. Kind of
# like CanCan, except the receiving objects are defining their abilities,
# not the player
	class Ability

# The map of abilities
		@@can_map = {}

# Define the can? instance method for the calling class. Should always be a Player.
		def self.abilities_for(cn)
			cn.send(:define_method, :can?) do |*a|
				GreyGoo::Ability.can?(self, *a)
			end
		end

# Automatically work out which GreyGoo::Class the ability class correspon#ds to, and remember it for shortcuts
		def self.inherited(by)
			cname = by.to_s.gsub(/::Ability/, '')
			by.instance_variable_set(:@gg_class, eval(cname))
		end

# Declares an ability
#
# @param [Symbol] action The action to define ability for
# @param [Class] class_name The class is handling the ability
# @param [Proc] block The code to call to check the permission. Should take two args: the calling object attempting the request (eg. the player) and the object receiving the request. If the action is on the resource and not an instance, then the proc should take one or no arguments.
		def self.can(action, class_name = nil, &block)
			unless class_name
				class_name = @gg_class
			end
			@@can_map[class_name] ||= {}
			@@can_map[class_name][action] = { block: block }
		end

# Checks whether a calling object can perform an action on another object or objects
#
# @param [Object] caller
# @param [Symbol] action
		def self.can?(caller, action, *a)
			class_name = a[0].is_a?(Class) ? a[0] : a[0].class
			v = find_action(class_name, action) or return false
			return v[:block].call(caller, *a)
		end

# Checks if an action has been defined for a class or any of its superclasses
#
# @param [Class] classname
# @param [Symbol] name
		def self.find_action(classname, name)
			first_match = classname.ancestors.find {|e| @@can_map.has_key?(e) && @@can_map[e].has_key?(name)}
			return first_match ? @@can_map[first_match][name] : false
		end
	end
end


text:
package com.commonsware.android.localcast;

import android.app.IntentService;
import android.content.Intent;
import android.os.SystemClock;
import android.support.v4.content.LocalBroadcastManager;

public class NoticeService extends IntentService {
  public static final String BROADCAST=
      "com.commonsware.android.localcast.NoticeService.BROADCAST";
  private static Intent broadcast=new Intent(BROADCAST);

  public NoticeService() {
    super("NoticeService");
  }

  @Override
  protected void onHandleIntent(Intent intent) {
    SystemClock.sleep(5000);
    LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast);
  }
}


text:
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="dpl-info" content="status=plan">
    <title></title>
    <script src="../../System/Core/assets/scripts/Base.js" type="text/javascript"></script>
    <script src="../../System/data/assets/scripts/Dictionary.js" type="text/javascript"></script>

    <script src="../../../assets/demo/demo.js" type="text/javascript"></script>
</head>
<body>
    <article class="demo">
    </article>
</body>
</html>


text:
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Taiko.Edit.Blueprints;
using osu.Game.Screens.Edit.Compose.Components;

namespace osu.Game.Rulesets.Taiko.Edit
{
    public class TaikoBlueprintContainer : ComposeBlueprintContainer
    {
        public TaikoBlueprintContainer(HitObjectComposer composer)
            : base(composer)
        {
        }

        protected override SelectionHandler<HitObject> CreateSelectionHandler() => new TaikoSelectionHandler();

        public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject) =>
            new TaikoSelectionBlueprint(hitObject);
    }
}


text:
require 'test_helper'

class HomesHelperTest < ActionView::TestCase
  def setup
    ActivityLog.destroy_all
  end

  test 'should retrieve recently added/downloaded items in the chronological order' do
    n = 5
    user = Factory :user
    item = Factory(:data_file, policy: Factory(:public_policy), contributor: user.person)

    create_logs = []

    private = Factory(:data_file, title: 'A private data file', policy: Factory(:private_policy))
    assert !private.can_view?(user)
    create_logs << Factory(:activity_log, action: :create, activity_loggable: private, created_at: 9.day.ago, culprit: user)
    download_logs = []
    (0...n).to_a.each do |i|
      item2 = Factory(:data_file, policy: Factory(:public_policy), contributor: user.person)
      create_logs << Factory(:activity_log, action: 'create', activity_loggable: item2, created_at: i.day.ago, culprit: user)
      download_logs << Factory(:activity_log, action: 'download', activity_loggable: item2, created_at: i.day.ago, culprit: user)
      download_logs << Factory(:activity_log, action: 'download', activity_loggable: item, created_at: i.hour.ago, culprit: user)
    end

    recently_added_item_logs = recently_added_item_logs_hash(1.year.ago, n)
    recently_added_item_logs.each do |recently_added_item_log|
      assert_not_nil recently_added_item_log[:title]
      assert_not_equal private.title, recently_added_item_log[:title]
      assert recently_added_item_log[:created_at] >= 1.year.ago
    end

    # test the sorting by lasted logs
    sorted_recently_added_item_logs = recently_added_item_logs.sort { |a, b| b[:created_at] <=> a[:created_at] }
    assert_equal sorted_recently_added_item_logs, recently_added_item_logs

    recently_downloaded_item_titles = []
    recently_downloaded_item_logs = recently_downloaded_item_logs_hash(1.year.ago, n)
    recently_downloaded_item_logs.each do |recently_downloaded_item_log|
      assert_not_nil recently_downloaded_item_log[:title]
      assert_not_equal private.title, recently_downloaded_item_log[:title]
      assert recently_downloaded_item_log[:created_at] >= 1.year.ago
      recently_downloaded_item_titles.push recently_downloaded_item_log[:title]
    end

    sorted_recently_downloaded_item_logs = recently_downloaded_item_logs.sort { |a, b| b[:created_at] <=> a[:created_at] }
    assert_equal sorted_recently_downloaded_item_logs, recently_downloaded_item_logs

    # test the recently_downloaded_items dont contain the duplication
    assert_equal recently_downloaded_item_titles, recently_downloaded_item_titles.uniq
    download_logs = download_logs.select { |log| log.activity_loggable == item }.sort { |a, b| b.created_at <=> a.created_at }

    # test the last recently_downloaded_log is taken
    recently_downloaded_item_logs = recently_downloaded_item_logs.select { |log| log[:title] == item.title }
    assert_equal 1, recently_downloaded_item_logs.count
    assert_equal recently_downloaded_item_logs[0][:log_id], download_logs.first.id
  end

  test 'should handle snapshots for download and recently added' do
    person = Factory(:person)
    snapshot1 = Factory(:investigation, contributor: person).create_snapshot
    snapshot2 = Factory(:assay, contributor: person).create_snapshot
    Factory(:activity_log, action: 'create', activity_loggable: snapshot1, created_at: 1.day.ago, culprit: person.user)
    Factory(:activity_log, action: 'download', activity_loggable: snapshot2, created_at: 1.day.ago, culprit: person.user)

    added_hash = recently_added_item_logs_hash(1.year.ago)
    downloaded_hash = recently_downloaded_item_logs_hash(1.year.ago)

    assert_equal 1, added_hash.count
    added = added_hash.first
    assert_equal 'Snapshot', added[:type]
    assert_equal snapshot1.resource.title.to_s, added[:title]
    assert_equal investigation_snapshot_path(snapshot1.resource, snapshot1), added[:url]

    assert_equal 1, downloaded_hash.count
    downloaded = downloaded_hash.first
    assert_equal 'Snapshot', downloaded[:type]
    assert_equal snapshot2.resource.title.to_s, downloaded[:title]
    assert_equal assay_snapshot_path(snapshot2.resource, snapshot2), downloaded[:url]
  end
end


text:
namespace {

#if defined(OS_POSIX)
// On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make
// debugging easier) and also exit with a known error code (so that the test
// framework considers this a failure -- http://crbug.com/57578).
// Note: We only want to do this in the browser process, and not forked
// processes. That might lead to hangs because of locks inside tcmalloc or the
// OS. See http://crbug.com/141302.
static int g_browser_process_pid;
static void DumpStackTraceSignalHandler(int signal) {
  if (g_browser_process_pid == base::GetCurrentProcId())
    base::debug::StackTrace().PrintBacktrace();
  _exit(128 + signal);
}
#endif  // defined(OS_POSIX)

}  // namespace

namespace content {

extern int BrowserMain(const content::MainFunctionParams&);

BrowserTestBase::BrowserTestBase() {
#if defined(OS_MACOSX)
  base::mac::SetOverrideAmIBundled(true);
  base::SystemMonitor::AllocateSystemIOPorts();
#endif

#if defined(OS_POSIX)
  handle_sigterm_ = true;
#endif
}

BrowserTestBase::~BrowserTestBase() {
}

void BrowserTestBase::SetUp() {
  CommandLine* command_line = CommandLine::ForCurrentProcess();

  // The tests assume that file:// URIs can freely access other file:// URIs.
  command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);

  command_line->AppendSwitch(switches::kDomAutomationController);

  command_line->AppendSwitch(switches::kSkipGpuDataLoading);

  MainFunctionParams params(*command_line);
  params.ui_task =
      new base::Closure(
          base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));

  SetUpInProcessBrowserTestFixture();
  BrowserMain(params);
  TearDownInProcessBrowserTestFixture();
}

void BrowserTestBase::TearDown() {
}

void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
#if defined(OS_POSIX)
  if (handle_sigterm_) {
    g_browser_process_pid = base::GetCurrentProcId();
    signal(SIGTERM, DumpStackTraceSignalHandler);
  }
#endif  // defined(OS_POSIX)
  RunTestOnMainThreadLoop();
}

void BrowserTestBase::CreateTestServer(const FilePath& test_server_base) {
  CHECK(!test_server_.get());
  test_server_.reset(new net::TestServer(
      net::TestServer::TYPE_HTTP,
      net::TestServer::kLocalhost,
      test_server_base));
}

}  // namespace content


text:
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Include test fixture.
GEN_INCLUDE([
  '//chrome/browser/resources/chromeos/accessibility/chromevox/testing/chromevox_next_e2e_test_base.js',
]);

/**
 * Test fixture for Live Regions.
 */
ChromeVoxLiveRegionsTest = class extends ChromeVoxNextE2ETest {
  async setUpDeferred() {
    await super.setUpDeferred();
    await importModule(
        'ChromeVoxState', '/chromevox/background/chromevox_state.js');
    await importModule('LiveRegions', '/chromevox/background/live_regions.js');
    await importModule('Output', '/chromevox/background/output/output.js');
    await importModule('QueueMode', '/chromevox/common/tts_interface.js');

    window.TreeChangeType = chrome.automation.TreeChangeType;
  }

  /**
   * Simulates work done when users interact using keyboard, braille, or
   * touch.
   */
  simulateUserInteraction() {
    Output.forceModeForNextSpeechUtterance(QueueMode.FLUSH);
  }
};

AX_TEST_F('ChromeVoxLiveRegionsTest', 'LiveRegionAddElement', async function() {
  const mockFeedback = this.createMockFeedback();
  const rootNode = await this.runWithLoadedTree(`

Document with live region

      <button id="go">Go</button>

    `);
  const go = rootNode.find({role: RoleType.BUTTON});
  mockFeedback.call(go.doDefault.bind(go))
      .expectCategoryFlushSpeech('Hello, world');
  await mockFeedback.replay();
});

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveRegionRemoveElement', async function() {
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

Document with live region

Hello, world

      <button id="go">Go</button>

    `);
      const go = rootNode.find({role: RoleType.BUTTON});
      go.doDefault();
      mockFeedback.expectCategoryFlushSpeech('removed:')
          .expectQueuedSpeech('Hello, world');
      await mockFeedback.replay();
    });

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveRegionChangeAtomic', async function() {
      LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 0;
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

Bravo

      <button id="go">Go</button>

    `);
      const go = rootNode.find({role: RoleType.BUTTON});
      mockFeedback.call(go.doDefault.bind(go))
          .expectCategoryFlushSpeech('Alpha Bravo Charlie');
      await mockFeedback.replay();
    });

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveRegionChangeAtomicText', async function() {
      LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 0;
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

foo

      <button id="go">go</button>

    `);
      const go = rootNode.find({role: RoleType.BUTTON});
      mockFeedback.call(go.doDefault.bind(go))
          .expectCategoryFlushSpeech('bar', 'Heading 1');
      await mockFeedback.replay();
    });

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveRegionChangeImageAlt', async function() {
      // Note that there is a live region outputted as a result of page load;
      // the test expects a live region announcement after a click on the
      // button, but the LiveRegions module has a half second filter for live
      // region announcements on the same node. Set that timeout to 0 to prevent
      // flakeyness.
      LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 0;
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

      <button id="go">Go</button>

    `);
      const go = rootNode.find({role: RoleType.BUTTON});
      mockFeedback.call(go.doDefault.bind(go))
          .expectCategoryFlushSpeech('After');
      await mockFeedback.replay();
    });

AX_TEST_F('ChromeVoxLiveRegionsTest', 'LiveRegionThenFocus', async function() {
  const mockFeedback = this.createMockFeedback();
  const rootNode = await this.runWithLoadedTree(`

      <button id="go">Go</button>
      <button id="focus">Focus</button>

    `);
  // Due to the above timing component, the live region can come either
  // before or after the focus output. This depends on the EventBundle to
  // which we get the live region. It can either be in its own bundle or
  // be part of the bundle with the focus change. In either case, the
  // first event should be flushed; the second should either be queued (in
  // the case of the focus) or category flushed for the live region.
  let sawFocus = false;
  let sawLive = false;
  const focusOrLive = function(candidate) {
    sawFocus = candidate.text === 'Focus' || sawFocus;
    sawLive = candidate.text === 'Live' || sawLive;
    if (sawFocus && sawLive) {
      return candidate.queueMode !== QueueMode.FLUSH;
    } else if (sawFocus || sawLive) {
      return candidate.queueMode === QueueMode.FLUSH;
    }
  };
  const go = rootNode.find({role: RoleType.BUTTON});
  mockFeedback.call(this.simulateUserInteraction.bind(this))
      .call(go.doDefault.bind(go))
      .expectSpeech(focusOrLive)
      .expectSpeech(focusOrLive);
  await mockFeedback.replay();
});

AX_TEST_F('ChromeVoxLiveRegionsTest', 'FocusThenLiveRegion', async function() {
  const mockFeedback = this.createMockFeedback();
  const rootNode = await this.runWithLoadedTree(`

      <button id="go">Go</button>
      <button id="focus">Focus</button>

    `);
  const go = rootNode.find({role: RoleType.BUTTON});
  mockFeedback.call(this.simulateUserInteraction.bind(this))
      .call(go.doDefault.bind(go))
      .expectSpeech('Focus')
      .expectSpeech(candidate => {
        return candidate.text === 'Live' &&
            (candidate.queueMode === QueueMode.CATEGORY_FLUSH ||
             candidate.queueMode === QueueMode.QUEUE);
      });
  await mockFeedback.replay();
});

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveRegionCategoryFlush', async function() {
      // Adjust the live region queue time to be shorter (i.e. flushes happen
      // for live regions coming 1 ms in time). Also, can help with flakeyness.
      LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 1;
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

      <button id="go">Go</button>
      <button id="focus">Focus</button>

    `);
      const go = rootNode.find({role: RoleType.BUTTON});
      mockFeedback.call(go.doDefault.bind(go))
          .expectCategoryFlushSpeech('Live1')
          .expectCategoryFlushSpeech('Live2');
      await mockFeedback.replay();
    });

AX_TEST_F('ChromeVoxLiveRegionsTest', 'SilentOnNodeChange', async function() {
  const mockFeedback = this.createMockFeedback();
  const rootNode = await this.runWithLoadedTree(`

start

    <button>first</button>

      hello!

  `);
  const focusAfterNodeChange = setTimeout.bind(window, function() {
    root.firstChild.nextSibling.focus();
  }, 1000);
  mockFeedback.call(focusAfterNodeChange)
      .expectSpeech('hello!')
      .expectNextSpeechUtteranceIsNot('hello!')
      .expectNextSpeechUtteranceIsNot('hello!');
  await mockFeedback.replay();
});

AX_TEST_F('ChromeVoxLiveRegionsTest', 'SimulateTreeChanges', async function() {
  const mockFeedback = this.createMockFeedback();
  const root = await this.runWithLoadedTree(`
    <button></button>

hello

there

  `);
  const live = new LiveRegions(ChromeVoxState.instance);
  const [t1, t2] = root.findAll({role: RoleType.STATIC_TEXT});
  mockFeedback.expectSpeech('hello there')
      .clearPendingOutput()
      .call(function() {
        live.onTreeChange({type: TreeChangeType.TEXT_CHANGED, target: t2});
        live.onTreeChange(
            {type: TreeChangeType.SUBTREE_UPDATE_END, target: t2});
      })
      .expectNextSpeechUtteranceIsNot('hello')
      .expectSpeech('there')
      .clearPendingOutput();
  mockFeedback
      .call(function() {
        live.onTreeChange({type: TreeChangeType.TEXT_CHANGED, target: t1});
        live.onTreeChange({type: TreeChangeType.TEXT_CHANGED, target: t2});
        live.onTreeChange(
            {type: TreeChangeType.SUBTREE_UPDATE_END, target: t2});
      })
      .expectSpeech('hello')
      .expectSpeech('there');
  await mockFeedback.replay();
});

// Flaky: https://crbug.com/945199
AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'DISABLED_LiveStatusOff', async function() {
      const mockFeedback = this.createMockFeedback();
      const rootNode = await this.runWithLoadedTree(`

<input aria-live="off" type="text"></input>

  `);
      const input = root.find({role: RoleType.TEXT_FIELD});
      const clickInput = input.parent.doDefault.bind(input.parent);
      mockFeedback.call(input.focus.bind(input))
          .call(clickInput)
          .expectSpeech('bb')
          .clearPendingOutput()
          .call(clickInput)
          .expectNextSpeechUtteranceIsNot('bba')
          .expectSpeech('a');
      await mockFeedback.replay();
    });

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'TreeChangeOnIgnoredNode', async function() {
      const mockFeedback = this.createMockFeedback();
      const root = await this.runWithLoadedTree(`
    <button></button>

  `);
      const button = root.find({role: chrome.automation.RoleType.BUTTON});
      mockFeedback.call(button.doDefault.bind(button))
          .expectSpeech('Alert', 'hi');
      await mockFeedback.replay();
    });

AX_TEST_F('ChromeVoxLiveRegionsTest', 'ShouldIgnoreLiveRegion', function() {
  const liveRegions = new LiveRegions(ChromeVoxState.instance);

  const mockParentNode = {};
  mockParentNode.root = {role: chrome.automation.RoleType.DESKTOP};
  mockParentNode.state = {};

  const mockNode = {};
  mockNode.role = chrome.automation.RoleType.ROOT_WEB_AREA;
  mockNode.root = mockNode;
  mockNode.parent = mockParentNode;
  mockNode.state = {};

  mockParentNode.role = chrome.automation.RoleType.WINDOW;
  assertFalse(liveRegions.shouldIgnoreLiveRegion_(mockNode));
  mockParentNode.state[chrome.automation.StateType.INVISIBLE] = true;
  assertTrue(liveRegions.shouldIgnoreLiveRegion_(mockNode));
});

AX_TEST_F(
    'ChromeVoxLiveRegionsTest', 'LiveIgnoredToUnignored', async function() {
      const mockFeedback = this.createMockFeedback();
      const root = await this.runWithLoadedTree(`
    <button></button>

hello

there

  `);
      const button = root.find({role: chrome.automation.RoleType.BUTTON});
      mockFeedback.call(button.doDefault.bind(button))
          .expectSpeech('hello')
          .call(button.doDefault.bind(button))
          .expectSpeech('there');
      await mockFeedback.replay();
    });


text:
<!doctype html>

    <meta charset="utf-8">

<title>Page Not Found - 申Nani?</title>
<meta name="description" content="Page not found. Your pixels are in another canvas. ">

  <meta name="author" content="Nani Shin">

<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="申Nani?">
<meta property="og:title" content="Page Not Found">
<meta property="og:url" content="https://nanishin.github.io/404.html">

  <meta property="og:description" content="Page not found. Your pixels are in another canvas. ">

  <meta property="og:image" content="https://nanishin.github.io/assets/images/nanishin.jpg">

<link rel="canonical" href="https://nanishin.github.io/404.html">

<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="申Nani? Feed">

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

<link rel="stylesheet" href="/assets/css/main.css">

Skip links

Skip to primary navigation

Skip to content

Skip to footer

          申Nani?

              about

              music

              maker

              tip

              history

        <button class="greedy-nav__toggle hidden" type="button">
          Toggle menu

        </button>

    <meta itemprop="headline" content="Page Not Found">
    <meta itemprop="description" content="Page not found. Your pixels are in another canvas.">

Page Not Found

Sorry, but the page you were trying to view does not exist — perhaps you can try searching for it below.

Share on

   Twitter

   Facebook

   LinkedIn

Follow:

 Feed

© 2022 Nani Shin. Powered by Jekyll & Minimal Mistakes.


text:
        <meta name="pygwt:module" content="Bookreader">
        <link rel='stylesheet' href='Bookreader.css'>
        <title>Pyjamas Book</title>

        Pyjamas Book - Copyright (C) 2008, 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>


text:
<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Arma IntelliJ Plugin Tests" type="JUnit" factoryName="JUnit">
    <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
    <module name="Arma Intellij Plugin" />
    <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
    <option name="ALTERNATIVE_JRE_PATH" value="IntelliJ IDEA Community Edition IC-173.3727.127" />
    <option name="PACKAGE_NAME" />
    <option name="MAIN_CLASS_NAME" value="" />
    <option name="METHOD_NAME" value="" />
    <option name="TEST_OBJECT" value="directory" />
    <option name="VM_PARAMETERS" value="-ea -Xbootclasspath/p:../out/classes/production/boot -XX:+HeapDumpOnOutOfMemoryError -Xmx512m -XX:MaxPermSize=320m -Didea.system.path=../test-system -Didea.home.path=../ -Didea.config.path=../test-config -Didea.test.group=ALL_EXCLUDE_DEFINED " />
    <option name="PARAMETERS" value="" />
    <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
    <option name="ENV_VARIABLES" />
    <option name="PASS_PARENT_ENVS" value="true" />
    <option name="TEST_SEARCH_SCOPE">
      <value defaultName="singleModule" />
    </option>
    <envs />
    <dir value="$PROJECT_DIR$/tests" />
    <patterns />
    <method />
  </configuration>
</component>


text:
import * as assert from 'assert';
import * as serverLib from '..';

describe('library', () => {
    it('exports factory method', () => {
        assert.ok(serverLib.createCometDServer);
    });

    it('constructs object', () => {
        const server = serverLib.createCometDServer();
        assert.ok(server);
        server.close();
    });

    it('constructs object with options', () => {
        const options = {};
        const server = serverLib.createCometDServer(options);
        assert.notStrictEqual(server.options, options);
        server.close();
    });
});


text:
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18047
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Elmah
{
    using System;
    using System.Collections.Generic;

    #line 2 "..\..\ErrorDetailPage.cshtml"
    using System.Globalization;

    #line default
    #line hidden

    #line 3 "..\..\ErrorDetailPage.cshtml"
    using System.IO;

    #line default
    #line hidden
    using System.Linq;
    using System.Text;

    #line 4 "..\..\ErrorDetailPage.cshtml"
    using System.Web;

    #line default
    #line hidden

    #line 5 "..\..\ErrorDetailPage.cshtml"
    using Elmah;

    #line default
    #line hidden

    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.4.1.0")]
    internal partial class ErrorDetailPage : WebTemplateBase
    {
#line hidden

        public override void Execute()
        {

WriteLiteral("\r\n");

            #line 7 "..\..\ErrorDetailPage.cshtml"

    var basePageName = Request.ServerVariables["URL"];

    //
    // Retrieve the ID of the error to display and read it from
    // the store.
    //

    var errorId = Request.QueryString["id"] ?? string.Empty;

    if (errorId.Length == 0)
    {
        return;
    }

    var log = this.ErrorLog ?? ErrorLog.GetDefault(Context);
    var errorEntry = log.GetError(errorId);

    //
    // Perhaps the error has been deleted from the store? Whatever
    // the reason, bail out silently.
    //

    if (errorEntry == null)
    {
        Response.Status = HttpStatus.NotFound.ToString();

            #line default
            #line hidden
WriteLiteral("
Error not found in log.
\r\n");

            #line 34 "..\..\ErrorDetailPage.cshtml"
        return;
    }

    var title = string.Format("Error: {0} [{1}]", errorEntry.Error.Type, errorEntry.Id);

    Layout = new Elmah.MasterPage
    {
        Context = Context, /* TODO Consider not requiring this */
        Title = title,
        Footnote = string.Format("This log is provided by the {0}.", log.Name),
        SpeedBarItems = new[]
        {
            SpeedBar.Home.Format(basePageName),
            SpeedBar.Help,
            SpeedBar.About.Format(basePageName),
        },
    };

    var error = errorEntry.Error;

            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("\r\n\r\n
");

            #line 59 "..\..\ErrorDetailPage.cshtml"
              Write(error.Message);

            #line default
            #line hidden
WriteLiteral("
\r\n\r\n
");

WriteLiteral("");

            #line 62 "..\..\ErrorDetailPage.cshtml"
                      Write(error.Type);

            #line default
            #line hidden
WriteLiteral("");

WriteLiteral(": ");

WriteLiteral("");

            #line 64 "..\..\ErrorDetailPage.cshtml"
                         Write(error.Message);

            #line default
            #line hidden
WriteLiteral("\r\n
\r\n\r\n");

WriteLiteral("\r\n\r\n");

            #line 75 "..\..\ErrorDetailPage.cshtml"
 if (error.Detail.Length != 0)
{

            #line default
            #line hidden
WriteLiteral("
");

            #line 77 "..\..\ErrorDetailPage.cshtml"
                     Write(MarkupStackTrace(error.Detail));

            #line default
            #line hidden
WriteLiteral("
\r\n");

            #line 78 "..\..\ErrorDetailPage.cshtml"
}

            #line default
            #line hidden

            #line 84 "..\..\ErrorDetailPage.cshtml"

            #line default
            #line hidden
WriteLiteral("\r\n
");

            #line 86 "..\..\ErrorDetailPage.cshtml"
                Write(string.Format(
    @"Logged on {0} at {1}",
    error.Time.ToLongDateString(),
    error.Time.ToLongTimeString()));

            #line default
            #line hidden
WriteLiteral("\r\n
\r\n\r\n");

WriteLiteral("\r\n\r\n
See also:
\r\n\r\n
\r\n\r\n    ");

WriteLiteral("\r\n\r\n");

            #line 107 "..\..\ErrorDetailPage.cshtml"
     if (error.WebHostHtmlMessage.Length != 0)
    {
        var htmlUrl = basePageName + "/html?id=" + Uri.EscapeDataString(errorEntry.Id);

            #line default
            #line hidden
WriteLiteral("
Original ASP.NET error page
\r\n");

            #line 111 "..\..\ErrorDetailPage.cshtml"
    }

            #line default
            #line hidden

            #line 115 "..\..\ErrorDetailPage.cshtml"

            #line default
            #line hidden
WriteLiteral("\r\n
Raw/Source data in \r\n        XML\r\n        or in\r\n        JSON\r\n
\r\n
\r\n\r\n");

WriteLiteral("\r\n\r\n");

            #line 142 "..\..\ErrorDetailPage.cshtml"

    var details = new[]
    {
        new {
        Data  = error.ServerVariables,
        Id    = "ServerVariables",
        Title = "Server Variables"
        },
        new
            {
                Data = error.AdditionalData,
                Id = "AdditionalData",
                Title = "Additional Data"
            }
    };

    //
    // If the collection isn't there or it's empty, then bail out.
    //
    foreach (var collection in details) {

        if (collection.Data != null && collection.Data.Count > 0)
        {
            var items =
                from i in Enumerable.Range(0, collection.Data.Count)
                select new
                           {
                               Index = i,
                               Key = collection.Data.GetKey(i),
                               Value = collection.Data[i],
                           };

            items = items.OrderBy(e => e.Key, StringComparer.OrdinalIgnoreCase);

            #line default
            #line hidden
WriteLiteral("
\r\n\r\n
");

            #line 178 "..\..\ErrorDetailPage.cshtml"
               Write(collection.Title);

            #line default
            #line hidden
WriteLiteral("
\r\n                ");

WriteLiteral(@"

                            Name
                            Value

");

            #line 194 "..\..\ErrorDetailPage.cshtml"
                         foreach (var item in items)
                        {

            #line default
            #line hidden
WriteLiteral("
\r\n                                ");

            #line 197 "..\..\ErrorDetailPage.cshtml"
                                               Write(item.Key);

            #line default
            #line hidden
WriteLiteral("	\r\n                                ");

            #line 198 "..\..\ErrorDetailPage.cshtml"
                                                 Write(item.Value);

            #line default
            #line hidden
WriteLiteral("	\r\n
\r\n");

            #line 200 "..\..\ErrorDetailPage.cshtml"
                        }

            #line default
            #line hidden
WriteLiteral("\r\n
\r\n
\r\n
\r\n");

            #line 205 "..\..\ErrorDetailPage.cshtml"
        }
    }

            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("\r\n");

        }
    }
}
#pragma warning restore 1591


text:
<?php

namespace PradoDigital\Rackspace\Apps\Entity;

use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;

class DomainList extends AbstractEntityList
{
    private $domains;

    public function __construct()
    {
        $this->domains = array();
    }

    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array())
    {
        if (isset($data['domains'])) {
            foreach ($data['domains'] as $value) {
                $domain = $denormalizer->denormalize($value, __NAMESPACE__ . '\\' . 'Domain');
                $this->addDomain($domain);
            }
            unset($data['domains']);
        }

        return parent::denormalize($denormalizer, $data, $format);
    }

    public function getIterator()
    {
        return new \ArrayIterator($this->getDomains());
    }

    public function getDomains()
    {
        return $this->domains;
    }

    public function addDomain(Domain $domain)
    {
        $this->domains[] = $domain;
        return $this;
    }
}


text:
Generate some fake email addresses based on potentially real data.

The API is pretty straight-forward: you pass it a name and it returns a fake email address.

    var fakeEmail = require('fake-email'),
        name = "Steve Kinney";

    fakeEmail(name); // returns 'steve-kinney@mailinator.com'
    fakeEmail(name); // returns 'kinney_steve@spamgourmet.com'
    fakeEmail(name); // returns 'sk34@incognitomail.com'


text:
package operation

import controller.IdParamType
import lib.NotificationType
import model._
import model.typebinder.{ ArticleId, UserId }
import org.scalatest.{ Matchers, fixture }
import scalikejdbc._
import scalikejdbc.scalatest.AutoRollback
import skinny.controller.Params

class LikeOperationSpec extends fixture.FunSpec with AutoRollback with Matchers with TestDBSettings {
  val operation = new LikeOperationImpl

  var uid1, uid2, uid3: UserId = _
  var aid1, aid2: ArticleId = _
  override def fixture(implicit session: DBSession): Unit = {
    val u = User.column
    uid1 = User.createWithNamedValues(u.name -> "苗字 名前1", u.email -> "hoge1@moge.jp", u.locale -> "ja", u.isActive -> true)
    uid2 = User.createWithNamedValues(u.name -> "苗字 名前2", u.email -> "hoge2@moge.jp", u.locale -> "ja", u.isActive -> true)
    uid3 = User.createWithNamedValues(u.name -> "苗字 名前3", u.email -> "hoge3@moge.jp", u.locale -> "ja", u.isActive -> true)
    val a = Article.column
    aid1 = Article.createWithNamedValues(a.userId -> uid1, a.title -> "title1", a.body -> "body1", a.stocksCount -> 0)
    aid2 = Article.createWithNamedValues(a.userId -> uid1, a.title -> "title2", a.body -> "body2", a.stocksCount -> 0)
    val l = Like.column
    Like.createWithNamedValues(l.userId -> uid2, l.articleId -> aid1)
    Like.createWithNamedValues(l.userId -> uid1, l.articleId -> aid1)
    Like.createWithNamedValues(l.userId -> uid3, l.articleId -> aid1)
  }

  describe("exists") {
    it("should return true if already liked") { implicit session =>
      val params = Params(Map(
        "user_id" -> uid2.value,
        "article_id" -> aid1.value
      ))
      val permittedParameters = params.permit(Seq(
        "user_id" -> IdParamType.UserId,
        "article_id" -> IdParamType.ArticleId
      ): _*)
      operation.exists(permittedParameters) shouldBe true
    }
    it("should return false if not liked") { implicit session =>
      val params = Params(Map(
        "user_id" -> uid2.value,
        "article_id" -> aid2.value
      ))
      val permittedParameters = params.permit(Seq(
        "user_id" -> IdParamType.UserId,
        "article_id" -> IdParamType.ArticleId
      ): _*)
      operation.exists(permittedParameters) shouldBe false
    }
  }

  describe("like") {
    it("should create like") { implicit session =>
      val params1 = Params(Map(
        "user_id" -> uid2,
        "article_id" -> aid2
      ))
      val permittedParameters1 = params1.permit(Seq(
        "user_id" -> IdParamType.UserId,
        "article_id" -> IdParamType.ArticleId
      ): _*)
      operation.like(Article.findById(aid2).get, permittedParameters1) should equal(1)
      Article.findById(aid2).get.likesCount should equal(1)

      val notification = Notification.findBy(sqls.eq(Notification.column.userId, uid1)).get
      notification.articleId should equal(aid2)
      notification.fragmentId shouldBe None
      notification.senderId should equal(uid2)
      notification.`type` should equal(NotificationType.Like.value)

      // --------
      val params2 = Params(Map(
        "user_id" -> uid3,
        "article_id" -> aid2
      ))
      val permittedParameters2 = params2.permit(Seq(
        "user_id" -> IdParamType.UserId,
        "article_id" -> IdParamType.ArticleId
      ): _*)
      operation.like(Article.findById(aid2).get, permittedParameters2) should equal(2)
      Article.findById(aid2).get.likesCount should equal(2)
    }

    it("should not notify when author liked") { implicit session =>
      val params = Params(Map(
        "user_id" -> uid1,
        "article_id" -> aid2
      ))
      val permittedParameters = params.permit(Seq(
        "user_id" -> IdParamType.UserId,
        "article_id" -> IdParamType.ArticleId
      ): _*)
      operation.like(Article.findById(aid2).get, permittedParameters) should equal(1)
      Article.findById(aid2).get.likesCount should equal(1)

      Notification.findBy(sqls.eq(Notification.column.userId, uid1)) shouldBe None
    }
  }

  describe("unlike") {
    it("should delete like") { implicit session =>
      val counter = operation.unlike(User.findById(uid2).get, aid1)
      counter should equal(2)
      Article.findById(aid1).get.likesCount should equal(2)
    }
  }

}


text:
RELNAME=binarytree
TABLE=blog

all:
	rebar get-deps; rebar compile; relx

run:
	_rel/bin/$(RELNAME) console

clean:
	rm -r _rel ebin/ deps

deps:
	rebar get-deps

docs:
	erl -noshell \
		-eval 'edoc:application($(RELNAME), ".", []), init:stop().'


text:
package water.udf;

/*
 * Note: At this point, we need to be careful.
 * The class is loaded by modified DkvClassLoader, so we need to make sure
 * that CFunc2 is available via parent classloader.
 * However, CFunc2 cannot be private (package), else
 * "java.lang.IllegalAccessError: class water.udf.TestFunc cannot access its superinterface water.udf.CFunc2"
 * exception is thrown during load of TestFunc from DKV via DkvClassLoader.
 *
 * We have to make sure that CFunc2 is public!
 *
 * Furthermore, to allow test to load the class via a different classloader and be accessible
 * in the test, it is necessary to make it public.
 */

import org.junit.Ignore;

@Ignore("Support for tests, but no actual tests here")
/**
 * Func: x,y => sum(x) + sum(y)
 */
public class TestCFunc2 implements CFunc2 {

  @Override
  public double apply(CBlock.CRow row1, CBlock.CRow row2) {
    double sum = 0.0;
    for (int i = 0; i < row1.len(); i++) {
      sum += row1.readDouble(i);
    }
    for (int i = 0; i < row2.len(); i++) {
      sum += row2.readDouble(i);
    }
    return sum;
  }
}


text:
'use strict';
import mongodb from "mongodb";
import { getCompanyAlias } from "../utils/ETL/companyETL.js"

export default class Job{
    constructor({_id,jobId=null,job=null,companyId=null,company=null,companyAlias=null,addr=null,info=null,workYear=null,education=null,salary=null,time=null,content=null,source=null,city=null,kd=null,pageContent=null,companyDetail=null,companyLogo=null}) {
       this._id = _id?mongodb.ObjectId(_id):new mongodb.ObjectId();
       this.id = jobId+source;
       this.jobId = jobId;
       this.job = job;
       this.companyId = companyId;
       this.company = company;
       this.companyAlias =  companyAlias;
       this.companyDetail = companyDetail;
       this.companyLogo = companyLogo;
       this.addr = addr;
       this.workYear = workYear;
       this.education = education;
       this.salary = salary;
       this.time = time;
       this.info = info;
       this.content = content; //ÏêÇéµÄµÄcontent
       this.pageContent = pageContent; //À´×ÔÁбíµÄcontent
       this.source = source;
       this.city = city;
       this.kd = kd;
       this.robotTime = new Date();
    }
}


text:
package multiplicity3.input.events;

import com.jme3.math.Vector2f;

public class MultiTouchObjectEvent extends MultiTouchEvent {
	private static final long serialVersionUID = 5751562305155702721L;

	public MultiTouchObjectEvent(long id, Vector2f position, Vector2f velocity) {
		super(id, position, velocity);
	}

	public MultiTouchObjectEvent(long id, Vector2f position, Vector2f velocity, float pressure, double angle) {
		super(id, position, velocity, pressure, angle);
	}
}


text:
    Developers might want to extend the core replica behavior during synchronization. The synchronization process can be extended by implementing a workspace extension that supports IWorkspaceReplicaSyncEvents. By implementing this interface in an extension, custom behavior can be executed before and after any replica synchronization process executed on a geodatabase.

*   This sample describes the process using the example of a developer wanting to copy new raster datasets from a raster catalog during the synchronization. In this example, when synchronization is executed, the extension identifies and copies the new raster datasets from the source geodatabase to the target geodatabase.

*   This sample is for connected synchronization where connections are made to local geodatabases.

*   This sample can be used as a reference for developers needing to extend synchronization for any reason.

```
Language:              C#, VB
Subject:               Geodatabase
Organization:          Esri, http://www.esri.com
Date:                  10/17/2019
ArcObjects SDK:        10.8
Visual Studio:         2017, 2019
.NET Target Framework: 4.5
```

### Resources

* [ArcObjects .NET API Reference online](http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm)
* [Sample Data Download](../../releases)
* [What's new](http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#91cabc68-2271-400a-8ff9-c7fb25108546.htm)
* [Download the ArcObjects SDK for .Net from MyEsri.com](https://my.esri.com/)

### Usage
#### Preparing the data
1. This sample requires that the raster catalog has a long integer column named "gen." If the replica has been created and has that column, proceed with Step 7 in this section.
1. Open the parent raster catalog to be synchronized in ArcMap.
1. Add the gen column to the raster catalog using the Add Field option in the attribute table.
1. Set the value of the gen column for any existing raster datasets in the raster catalog to 0. The field calculator can be used to do this quickly.
1. Repeat Steps 2-4 for the child raster catalog.
1. Create a replica of the raster catalog. For more information, see "How to create a replica in a connected environment" in the See Also section in this topic. The creation process copies the raster catalog and the raster datasets that intersect the replica geometry by default. To create the replica, at least one versioned feature class with edit permission must also be included in the replica. It is not possible to create a replica consisting only of the raster dataset.
1. Once the replica exists, make sure that the raster catalog exists in the parent and the child replica geodatabases, and that each has a long integer column named gen.
1. If there are common raster datasets, set the value in the gen column to 0 for the common datasets in the parent and child replica geodatabases.

#### Building the extension
1. Once the data is prepared, build the extension and register it with the replica geodatabases by completing the following steps.
1. Copy the solution locally and open the solution.
1. Open the RasterSyncWorkspaceExtension.cs (if working in C#) or RasterSyncWorkspaceExtension.vb (if working in VB .NET) source file.
1. There are two member variables in the extension that can be adjusted. The rasterCatalog variable (a private constant string, currently set to "ras_cat") is the name of the raster catalog to involve in the synchronization. By changing this value before building the assembly, the synchronized raster catalog can be changed.
1. The other variable is the replica variable (a private constant string, currently set to "myreplicaras"), which is the name of the replica whose synchronization event triggers this behavior. By changing this value before building the assembly, the replica with extended behavior can be changed.
1. Right-click the project and choose build. This creates the assembly in the project's debug or release directory (depending on the selected option).

#### Applying the extension to one or more geodatabases
1. Which geodatabase or geodatabases require the workspace extension depends on the type of replica being used. For one-way parent-to-child replication, both geodatabases involved with the replica requires the extension. For two-way replication, both geodatabases involved with the replica requires the extension. The RasterSynchExtensionReg* project compiles to an executable that registers the workspace extension with a geodatabase.
1. Right-click the RasterSyncExtensionReg* project and choose Set as StartUp Project.
1. Open RegisterExtension.cs.
1. Change the RegisterExtension.workspacePath value to the path of an ArcSDE connection file or local geodatabase that has the extension applied to it.
1. Change the RegisterExtension.geodatabaseType value to reflect the type of geodatabase on which the extension is being registered.
1. Right-click the project and choose build.
1. Press F5 to run the project.
1. Steps 2-7 in this section registers the extension with one of the replica geodatabases. If two-way replication is being used, repeat these steps for the other replica geodatabase. Once this is completed, synchronizing the replica identified in the previous steps executes the extension.

#### Using the extension
1. Synchronizing the replica associated with the extension using the wizards, or the geoprocessing tools in ArcCatalog or ArcMap, triggers the extension's behavior. To test this, assuming that a two-way replica is being used, complete the following steps.
1. Load one or more new raster datasets into the raster catalog in the parent geodatabase. When this is done, the gen column has a null value for the new raster datasets.
1. In the same way, load one or more new raster datasets into the raster catalog in the child.
1. In ArcCatalog, connect to the parent replica geodatabase and synchronize from the parent to the child. Notice that a value is assigned to the gen column of the new raster datasets. This is the generation number of the synchronization in which the raster datasets were sent.
1. In ArcCatalog, connect to the child replica geodatabase and preview the raster catalog. Notice that the raster datasets from the parent have been applied and have a gen value of –1. The –1 value indicates that these have been received from the parent.
1. In ArcCatalog, synchronize from the child to the parent. Notice that the raster datasets that were added to the child in Step 3 were applied to the parent and the values in the gen column for these datasets were adjusted.
1. As raster datasets are added and synchronized, the parent and child are kept up to date with the new raster datasets. The extension also supports cases where (for any reason) synchronization fails. Here, the generation information in the gen column is used to determine if rasters need to be resent.

#### Additional information

The main goal of the sample is to show how to extend replica synchronization. There are a number of enhancements that can be added to support your specific requirements. Some of these include the following:

#### See Also
[How to create a replica in a connected environment](http://desktop.arcgis.com/search/?q=How%20to%20create%20a%20replica%20in%20a%20connected%20environment&p=0&language=en&product=arcobjects-sdk-dotnet&version=&n=15&collection=help)

---------------------------------

#### Licensing
| Development licensing | Deployment licensing |
| ------------- | ------------- |
| ArcGIS Desktop Standard | ArcGIS Desktop Standard |
| ArcGIS Desktop Advanced | ArcGIS Desktop Advanced |
| Engine Developer Kit | Engine: Geodatabase Update |


text:
package nl.rivm.cib.demo;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

import io.coala.data.Table.Property;
import io.coala.data.Table.Tuple;

@SuppressWarnings( "serial" )
public interface Sites
{

	enum BuiltFunction
	{
		RESIDENCE, LARGE_ENTERPRISE, SMALL_ENTERPRISE, PRIMARY_EDUCATION,;
	}

	class SiteName extends AtomicReference<String> implements Property<String>
	{

	}

	class RegionRef extends AtomicReference<Object> implements Property<Object>
	{
	}

	class Latitude extends AtomicReference<Double> implements Property<Double>
	{
	}

	class Longitude extends AtomicReference<Double> implements Property<Double>
	{
	}

	class SiteFunction extends AtomicReference<Sites.BuiltFunction>
		implements Property<Sites.BuiltFunction>
	{
	}

	class EduCulture extends AtomicReference<Pedagogy>
		implements Property<Pedagogy>
	{
	}

	class Capacity extends AtomicReference<Integer> implements Property<Integer>
	{
	}

	class Occupancy extends AtomicReference<Integer>
		implements Property<Integer>
	{
	}

	class Pressure extends AtomicReference<Double> implements Property<Double>
	{
	}

	@SuppressWarnings( "rawtypes" )
	List<Class<? extends Property>> PROPERTIES = Arrays.asList(
			Sites.Pressure.class, Sites.Occupancy.class, Sites.SiteName.class,
			Sites.SiteFunction.class, Sites.EduCulture.class,
			Sites.RegionRef.class, Sites.Latitude.class, Sites.Longitude.class,
			Sites.Capacity.class );

	class SiteTuple extends Tuple
	{
		@Override
		@SuppressWarnings( "rawtypes" )
		public List<Class<? extends Property>> properties()
		{
			return PROPERTIES;
		}

	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<PRONOM-Report xmlns="http://pronom.nationalarchives.gov.uk">
  <report_format_detail>
    <FileFormat>
      <FormatID>2418</FormatID>
      <FormatName>ESRI ArcInfo Coverage Annotation File</FormatName>
      <FormatVersion>
      </FormatVersion>
      <FormatAliases>
      </FormatAliases>
      <FormatFamilies>
      </FormatFamilies>
      <FormatTypes>Text (Structured)</FormatTypes>
      <FormatDisclosure>
      </FormatDisclosure>
      <FormatDescription>Files which form part of an ArcInfo Coverage, which is a data model whose purpose is to store georelational data such as spatial location and descriptive data. Each ArcInfo Coverage resides in an ArcInfo workspace, a directory which contains two or more folders. These packages are generated using ArcGIS software, produced by Esri (https://www.esri.com/en-us/arcgis/about-arcgis/overview.) Files with the .txt extension contain text strings describing a geographic feature, formatted in user defined tables.</FormatDescription>
      <BinaryFileFormat>
      </BinaryFileFormat>
      <ByteOrders>
      </ByteOrders>
      <ReleaseDate>
      </ReleaseDate>
      <WithdrawnDate>
      </WithdrawnDate>
      <ProvenanceSourceID>234</ProvenanceSourceID>
      <ProvenanceName>National Library of Australia / National Library of Australia</ProvenanceName>
      <ProvenanceSourceDate>06 Jan 2022</ProvenanceSourceDate>
      <ProvenanceDescription>
      </ProvenanceDescription>
      <LastUpdatedDate>06 Jan 2022</LastUpdatedDate>
      <FormatNote>https://www.loc.gov/preservation/digital/formats/fdd/fdd000284.shtml</FormatNote>
      <FormatRisk>
      </FormatRisk>
      <TechnicalEnvironment>
      </TechnicalEnvironment>
      <FileFormatIdentifier>
        <Identifier>fmt/1591</Identifier>
        <IdentifierType>PUID</IdentifierType>
      </FileFormatIdentifier>
      <Support>
        <SupportID>221</SupportID>
        <SupportName>Esri</SupportName>
        <OrganisationName>Esri</OrganisationName>
        <SupportCompoundName>Esri / Esri</SupportCompoundName>
      </Support>
      <ExternalSignature>
        <ExternalSignatureID>2877</ExternalSignatureID>
        <Signature>txt</Signature>
        <SignatureType>File extension</SignatureType>
      </ExternalSignature>
      <InternalSignature>
        <SignatureID>1930</SignatureID>
        <SignatureName>ESRI ArcInfo Coverage Annotation File</SignatureName>
        <SignatureNote>Magic bytes, Absolute from beginning of file: ..'ÿÿÿ.½</SignatureNote>
        <ByteSequence>
          <ByteSequenceID>2232</ByteSequenceID>
          <PositionType>Absolute from BOF</PositionType>
          <Offset>0</Offset>
          <MaxOffset>0</MaxOffset>
          <IndirectOffsetLocation>
          </IndirectOffsetLocation>
          <IndirectOffsetLength>
          </IndirectOffsetLength>
          <Endianness>
          </Endianness>
          <ByteSequenceValue>0000270AFFFFFFBD</ByteSequenceValue>
        </ByteSequence>
      </InternalSignature>
    </FileFormat>
    <SearchCriteria>Criteria</SearchCriteria>
  </report_format_detail>
</PRONOM-Report>


text:
#ifndef VERTEXBUFFERD3D9_H_
#define VERTEXBUFFERD3D9_H_

#include "base/VertexBuffer.h"
#include "base/BufferData.h"
#include "d3d9/VertexLayoutD3D9.h"

namespace D3D9
{
	class VertexBufferD3D9 : public RenderBase::VertexBuffer
	{
		__DeclareSubClass(VertexBufferD3D9,RenderBase::VertexBuffer)
	public:
		/// constructor
		VertexBufferD3D9();
		/// destructor
		virtual ~VertexBufferD3D9();

		/// clear d3d resource
		void Discard();

		/// get pointer to d3d9 vertex buffer object
		IDirect3DVertexBuffer9* GetD3D9VertexBuffer() const;
		/// on device lost
		virtual void OnDeviceLost();
		/// on device reset
		virtual void OnDeviceReset();

		void UpdateData(const RenderBase::DataStream& stream);

		static void CreateVertexBuffer(const RenderBase::VertexBufferData* vbd, GPtr<VertexBufferD3D9>& out);
	private:
		/// set d3d9 vertex buffer pointer
		void _SetD3D9VertexBuffer(IDirect3DVertexBuffer9* ptr);
		void _SetD3d9VertexLayout(GPtr<VertexLayoutD3D9>& vertexLayout);
		IDirect3DVertexBuffer9* m_d3d9VertexBuffer;
	};

	//------------------------------------------------------------------------------
	/**
	*/
	inline void
		VertexBufferD3D9::_SetD3D9VertexBuffer(IDirect3DVertexBuffer9* ptr)
	{
		n_assert(0 != ptr);
		n_assert(0 == this->m_d3d9VertexBuffer);
		this->m_d3d9VertexBuffer = ptr;
	}

	//------------------------------------------------------------------------------
	/**
	*/
	inline IDirect3DVertexBuffer9*
		VertexBufferD3D9::GetD3D9VertexBuffer() const
	{
		n_assert(0 != this->m_d3d9VertexBuffer);
		return this->m_d3d9VertexBuffer;
	}

	inline void
		VertexBufferD3D9::_SetD3d9VertexLayout(GPtr<VertexLayoutD3D9>& vertexLayout)
	{
		this->vertexLayout = vertexLayout;
	}

}

#endif//VERTEXBUFFER_H_


text:
<?xml version="1.0"?>
<objecttypes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <objecttype name="Bubbles">
    <property name="BubbleSpawnFrequency" type="float" default="0.1" />
    <property name="BubbleLifeTime" type="float" default="11" />
    <property name="BubbleInitialVelocity" type="float" default="100" />
    <property name="RandomSpawnOffset" type="float" default="5" />
    <property name="AccellerationCoefficient" type="float" default="5" />
    <property name="RandomLifeTimeOffset" type="float" default="1" />
    <property name="DragCoefficient" type="float" default="1" />
    <property name="RandomXVelocityAdjustments" type="float" default="4.5" />
    <property name="YToDestroyAt" type="float" default="-497" />
  </objecttype>
  <objecttype name="DarknessTrigger">
    <property name="DarknessValue" type="float" default="0.5" />
    <property name="DarknessInterpolationTime" type="float" default="2.5" />
  </objecttype>
  <objecttype name="DisablerEntity">
    <property name="ObjectToDisable" type="string" />
  </objecttype>
  <objecttype name="EnablerEntity">
    <property name="ObjectToEnable" type="string" default="EndingScreen" />
  </objecttype>
  <objecttype name="LightEntity">
    <property name="VisualName" type="string" default="TestAnimation" />
  </objecttype>
  <objecttype name="MineralDeposit">
    <property name="CurrencyValue" type="int" />
    <property name="CollisionRadius" type="float" default="12" />
    <property name="VisualName" type="string" />
  </objecttype>
  <objecttype name="MoveToScreenEntity">
    <property name="Screen" type="string" default="EndingScreen" />
    <property name="Enabled" type="bool" default="false" />
  </objecttype>
  <objecttype name="Player">
    <property name="MaxSpeed" type="float" default="70" />
    <property name="AccelerationTime" type="float" default="1" />
    <property name="MaxExplorationTime" type="float" default="100" />
    <property name="ExplorationConsumptionRate" type="float" default="0.5" />
    <property name="ExplorationReplenishRate" type="float" default="10" />
    <property name="AdditionalLightConsumption" type="float" default="0.2" />
    <property name="PercentageForLowEnergyNotification" type="float" default="33" />
    <property name="EngineFadeTime" type="float" default="0.1" />
    <property name="MaxEngineSfxVolume" type="float" default="1" />
  </objecttype>
  <objecttype name="SafeZone">
    <property name="ActivationCost" type="int" />
    <property name="GeyserCollisionRadius" type="float" default="16" />
    <property name="IsVisible" type="bool" default="true" />
    <property name="EmitterYOffset" type="float" />
    <property name="BubbleYOffsetForDestroy" type="float" default="-76" />
    <property name="BuiltByPlayer" type="bool" />
    <property name="Enabled" type="bool" default="true" />
    <property name="MinSfxVolumeDistance" type="float" default="500" />
  </objecttype>
  <objecttype name="SafeZoneDisabler" />
  <objecttype name="SeaLife">
    <property name="VisualName" type="string" default="Dolphin" />
    <property name="XPatrolRange" type="float" default="50" />
    <property name="SwimVelocity" type="float" default="20" />
    <property name="YPatrolRange" type="float" default="10" />
  </objecttype>
  <objecttype name="WorldObjectEntity">
    <property name="QuestAward" type="string" />
    <property name="VisualName" type="string" />
    <property name="DialogKey" type="string" />
    <property name="IsConsumable" type="bool" />
    <property name="AutomaticDialogDisplay" type="bool" />
    <property name="CircleCollisionRadius" type="float" />
    <property name="ShouldToggleVisibility" type="bool" />
    <property name="ShouldPlaceOnUiLayer" type="bool" />
    <property name="AutomaticDismissTime" type="float" />
    <property name="Enabled" type="bool" default="true" />
  </objecttype>
</objecttypes>