text:
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable, ReplaySubject } from 'rxjs/Rx';

@Injectable()
export class LoadKillsService {
  private cache: ReplaySubject<number[]>;

  constructor(
    private http: Http
  ) { }

  get(url: string): Observable<number[]> {
    if (!this.cache) {
      this.cache = new ReplaySubject<number[]>(1);
      this.http
        .get(url)
        .map((r: Response) => r.json())
        .subscribe(data => this.cache.next(data),
        err => this.cache.error(err),
        () => this.cache.complete()
        );
    }
    return this.cache;
  }

}

redpajama_set_name: RedPajamaGithub


text:
@interface SSTextEntryCell ()

@property (nonatomic, strong) FBKVOController *kvoController;

@end

@implementation SSTextEntryCell

- (void)configureCell {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    _textFieldShouldReturn = NO;

    _textField = [[UITextField alloc] initWithFrame:self.contentView.bounds];
    self.textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
    self.textField.autocorrectionType = UITextAutocorrectionTypeNo;
    self.textField.textColor = [[SSThemes sharedThemer] valueForThemeKey:kThemeFontColor];
    self.textField.delegate = self;
    self.textField.clearButtonMode = UITextFieldViewModeNever;
    self.textField.returnKeyType = UIReturnKeyDone;
    self.textField.backgroundColor = [UIColor clearColor];

    [self.contentView addSubview:self.textField];
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(16);
        make.right.equalTo(self.contentView).offset(-16);
    }];

    _kvoController = [FBKVOController controllerWithObserver:self];

    [self.kvoController observe:[SSThemes sharedThemer].currentTheme
                        keyPath:kThemeFontColor
                        options:NSKeyValueObservingOptionNew
                          block:^(SSTextEntryCell *cell, id object, NSDictionary *change) {
                              UIColor *newColor = change[NSKeyValueChangeNewKey];
                              if (!newColor) newColor = [UIColor whiteColor];
                              [cell.textField setTextColor:newColor];
                          }];

    [SSThemes configureCell:self];
}

- (void)dealloc {
    _changeHandler = nil;
    _kvoController = nil;
    self.textField.delegate = nil;
}

#pragma mark - UITextFieldDelegate

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    return YES;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

    if (self.changeHandler) {
        self.changeHandler(textField);
    }

    if (self.textFieldShouldReturn) {
        [textField resignFirstResponder];
    }

    return self.textFieldShouldReturn;
}

@end


text:
namespace ParquetSharp.Schema
{
    public class TypeUtil
    {
        public static void checkValidWriteSchema(GroupType schema)
        {
            schema.accept(ValidWriteSchemaVisitor.Instance);
        }

        class ValidWriteSchemaVisitor : TypeVisitor
        {
            public static readonly TypeVisitor Instance = new ValidWriteSchemaVisitor();
            public void visit(GroupType groupType)
            {
                if (groupType.getFieldCount() <= 0)
                {
                    throw new InvalidSchemaException(
                        "Cannot write a schema with an empty group: " + groupType);
                }
                foreach (Type type in groupType.getFields())
                {
                    type.accept(this);
                }
            }

            public void visit(MessageType messageType)
            {
                visit((GroupType)messageType);
            }

            public void visit(PrimitiveType primitiveType)
            {
            }
        }
    }
}


text:
local common = require("test_scripts/Defects/5_0/1006/common")

--[[ Local Variables ]]
local rpcParams = {
  rpc = "SendHapticData",
  requestParam = { hapticRectData = {{ id = 1, rect = { x = 1, y = 1.5, width = 1, height = 1.5 }}}}
}

--[[ Local Functions ]]
local function ptuFunc(tbl)
  tbl.policy_table.app_policies[common.getParams().fullAppID].groups = { "Base-4", "HapticGroup" }
end

--[[ Test ]]
common.Title("Preconditions")
common.Step("Clean environment", common.preconditions)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("Register App", common.registerApp)
common.Step("Activate App", common.activateApp)
common.Step("Policy Table Update", common.policyTableUpdate, { ptuFunc })

common.Title("Test")
common.Step("App sends SendHapticData",  common.sendRPC, { rpcParams })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)


text:
package io.zbus.net.http;

import io.zbus.transport.Message;

public class HttpClientExample {

	public static void main(String[] args) throws Exception {
		HttpClient client = new HttpClient();
		Message message = new Message();
		message.setUrl("https://test.io");
		String res = client.string(message);
		System.out.println(res);
	}
}


text:
<?php

	/**
	 * Folder structure and preferences.
	 *
	 * Please edit the following settings depending on your folder structure and preferences.
	 * It is not advised that you follow these values. Your system and application directories should be outside of your
	 * web root, whereas the content folder should stay visible within the web root.
	 *
	 * If you are going to keep the default values here, it doesn't matter if you remove this array.
	 * All other editable system settings can be found in "<system_folder>/config/*.php".
	 */
	$user_config = array(
		// Can be "ini" or "array". Defaults to "array".
		'config_type'     => 'array',
		'content_folder'  => '../www/public',
		'default_app'     => '../eventing/app',
		'modules_folder'  => '../eventing/modules',
		'system_folder'   => '../eventing/system',
		'skeleton'        => false,
	);

	/* END OF USER CONFIGURABLE SETTINGS. */

	// Killing two birds with one stone. Define a constant for other files to check that they're not being called
	// independently, and to set the core benchmark. The E_FRAMEWORK constant is REQUIRED!
	defined('E_FRAMEWORK') || define('E_FRAMEWORK', microtime(true));

	// We have set the initial time in our E_FRAMEWORK constant, so why not set the initial memory consumption? It will
	// enable the Output library to make a more accurate calculation on how much memory the application used.
	// This is not required, but recommended for the Output library.
	defined('E_MEMORY') || define('E_MEMORY', memory_get_usage());

	// This is usually where a PHP framework will define its version number. However, the only reference to a  version
	// number will be in this files DocComment; there is no point declaring it in the code as there are no feature
	// dependancies in this framework at the moment. Instead, versioning will be handles by Git in this project.

	// Right! Let's get this party started!
	$init = isset($user_config['system_folder'])
		? $user_config['system_folder'] . '/init.php'
		: 'system/init.php';

	// For obvious reasons, let's check if the initialisation script exists... If it doesn't, we'll give the user a big
	// slap in the face of epic disappointment by calling the exit function. SAD TIMES!
	($init = realpath($init)) || exit('Initialisation script not found.');

	// Great... Everything working so far. What a boring life we live! Don't forget to say which file is calling the
	// script. We are not going to define this as a constant because we can just use BASEPATH.SELF; to get it again.
	$main_file = __FILE__;
	require_once $init;


text:
package org.hawkular.alerts.engine;

import static org.hawkular.commons.cassandra.EmbeddedConstants.EMBEDDED_CASSANDRA_OPTION;
import static org.hawkular.commons.cassandra.EmbeddedConstants.HAWKULAR_BACKEND_PROPERTY;

import org.hawkular.alerts.api.services.ActionsCriteria;
import org.hawkular.alerts.api.services.AlertsCriteria;
import org.hawkular.alerts.api.services.EventsCriteria;
import org.hawkular.alerts.engine.impl.CassCluster;
import org.hawkular.commons.cassandra.EmbeddedCassandra;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;

import com.datastax.driver.core.Session;

/**
 * Basic tests for CassDefinitionsServiceImpl
 *
 * @author Lucas Ponce
 */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CassPersistenceTest extends PersistenceTest {

    private static final String JBOSS_DATA_DIR = "jboss.server.data.dir";

    static EmbeddedCassandra embeddedCassandra;
    static String keyspace;

    @BeforeClass
    public static void initSessionAndResetTestSchema() throws Exception {

        String testFolder = CassPersistenceTest.class.getResource("/").getPath();
        System.setProperty(JBOSS_DATA_DIR, testFolder);

        /*
            If not property defined, we initialized the embedded Cassandra
         */
        if (System.getProperty(HAWKULAR_BACKEND_PROPERTY) == null) {
            System.setProperty(HAWKULAR_BACKEND_PROPERTY, EMBEDDED_CASSANDRA_OPTION);
        }

        embeddedCassandra = new EmbeddedCassandra();
        embeddedCassandra.start();

        keyspace = "hawkular_alerts_test";
        System.setProperty("hawkular-alerts.cassandra-keyspace", keyspace);

        CassCluster.getSession(true);

        definitionsService = StandaloneAlerts.getDefinitionsService();
        alertsService = StandaloneAlerts.getAlertsService();
        actionsService = StandaloneAlerts.getActionsService();
    }

    @AfterClass
    public static void cleanTestSchema() throws Exception {

        // try an clean up
        try {
            Session session = CassCluster.getSession();
            session.execute("DROP KEYSPACE " + keyspace);
            if (embeddedCassandra != null) {
                embeddedCassandra.stop();
            }
        } catch (Throwable t) {
            // never mind, don't prevent further cleanup
        }
    }

    @Before
    public void cleanAlerts() throws Exception {
        AlertsCriteria criteria = new AlertsCriteria();
        System.out.printf("Deleted [%s] Alerts before test.\n", alertsService.deleteAlerts(TENANT, criteria));
    }

    @Before
    public void cleanEvents() throws Exception {
        EventsCriteria criteria = new EventsCriteria();
        System.out.printf("Deleted [%s] Events before test.\n", alertsService.deleteEvents(TENANT, criteria));
    }

    @Before
    public void cleanActions() throws Exception {
        ActionsCriteria criteria = new ActionsCriteria();
        System.out.printf("Deleted [%s] Actions before test.\n", actionsService.deleteActions(TENANT, criteria));
    }

}


text:
package org.springframework.boot.test.autoconfigure.properties;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.context.annotation.PropertySource;
import org.springframework.test.context.TestPropertySource;

/**
 * Indicates that attributes from a test annotation should be mapped into a
 * {@link PropertySource}. Can be used at the type level, or on individual attributes. For
 * example, the following annotation declaration:

 * @Retention(RUNTIME)
 * @PropertyMapping("my.example")
 * public @interface Example {
 *
 *   String name();
 *
 * }
 *
 When used on a test class as follows:

 * @Example(name="Spring")
 * public class MyTest {
 * }
 *
 will result in a {@literal my.example.name} property being added with the value
 * {@literal "Spring"}.
 *

 *
 * @author Phillip Webb
 * @since 1.4.0
 * @see AnnotationsPropertySource
 * @see TestPropertySource
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
public @interface PropertyMapping {

	/**
	 * Defines the property mapping. When used at the type-level, this value will be used
	 * as a prefix for all mapped attributes. When used on an attribute, the value
	 * overrides the generated (kebab case) name.
	 * @return the property mapping
	 */
	String value() default "";

	/**
	 * Determines if mapping should be skipped. When specified at the type-level indicates
	 * if skipping should occur by default or not. When used at the attribute-level,
	 * overrides the type-level default.
	 * @return if mapping should be skipped
	 */
	SkipPropertyMapping skip() default SkipPropertyMapping.NO;

}


text:
layout       : blocks/working-session
title        : Integrating Security into a Portfolio Kanban
type         : workshop
owasp-project: no
track        : Agile AppSec
technology   :
related-to   :
status       : need more content
when-day     : Tue
when-time    : PM-2
location     : Room-3
organizers   :
participants : Ante Gulam,Irene Michlin, Mamta Vuppu
---

Integrating security into sales channels is extremely important to every organisation that has a strong sales-driven component. In most cases, information security professionals must re-engineer processes and perform other tasks to oversee the current sales streams across different products.

## Why

Integrating information security into the Portfolio Kanban enables organisations to have fully secure workstreams through every stage of the project development cycle. In the agile world, the integration of security must start at the earliest possible stage, which in most cases is the portfolio management workstream definition stage. This is a stage that normally utilises Kanban. This session will discuss the challenges and advantages of that approach and how to plan and execute this model across environments.

The main purpose of this working session is to discuss and discover new ways of integrating information security into established sales channel workstreams within an organisation. Usually, such organisations utilise a B2B model, and most of the requirements for new components and features come directly from the customer. This session will discuss how to achieve visibility over the process, how to ensure that the process is secure, and how to ensure that the sales channel workstreams have security controls and processes within them.

## What

- What is a scaled agile framework?
- How to plan and execute the Portfolio Kanban security integration
- What are the challenges and opportunities for process optimisation?
- What are the challenges of integrating and optimising security into the sales channels?
- How to mobilise programme management on security integration
- How to create security flows towards MVP development
- Educating and training the relevant parties
- Process re-engineering to fit security needs
- Automating security over sales workstreams

## Outcomes

- Playbook that defines staged industry best practices on how to integrate security into the general programme management workflow

### Synopsis and Takeaways

Ante Gulam drove a lively, participatory conversation; the conclusion being that while the idea is interesting, the scope, structure, processor and profile are difficult to scale and standardize.  Any playbook would have to be tailored to a specific organization's needs.

Outline Playbook.

Stage 1
Standardize the concept

Stage 2
Create Security Champions in Programme Management
Plan meetings which include Security Champions

Stage 3
Tagging by Security Champions
Tagging can also be outsourced to Programme Management

Stage 4
Defining SLAs
Security review by security squad

Stage 5
SDLC security process

## Who

The target audience for this Working Session is:

- Security Professionals
- CISOs
- DevSecOps
- SecDevOps
- Agile practitioners
- Agile coaches
- Project and programme managers

---

# Working materials

Here are the current 'work in progress' materials for this session (please add as much information as possible before the sessions)


text:
using System;
using ZyGames.Framework.Common.Log;
using ZyGames.Framework.Game.Runtime;

namespace GameServer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                new ConsoleRuntimeHost().Start();
                Console.WriteLine("exited.");
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Main error:{0}", ex);
                Console.Read();
            }
        }
    }
}


text:
% containers-auth.json 5

# NAME
containers-auth.json - syntax for the registry authentication file

# DESCRIPTION

A credentials file in JSON format used to authenticate against container image registries.
The primary (read/write) file is stored at `${XDG_RUNTIME_DIR}/containers/auth.json` on Linux;
on Windows and macOS, at `$HOME/.config/containers/auth.json`.

When searching for the credential for a registry, the following files will be read in sequence until the valid credential is found:
first reading the primary (read/write) file, or the explicit override using an option of the calling application.
If credentials are not present, search in `${XDG_CONFIG_HOME}/containers/auth.json` (usually `~/.config/containers/auth.json`), `$HOME/.docker/config.json`, `$HOME/.dockercfg`.

Except the primary (read/write) file, other files are read-only, unless the user use an option of the calling application explicitly points at it as an override.

## FORMAT

The auth.json file stores encrypted authentication information for the
user to container image registries.  The file can have zero to many entries and
is created by a `login` command from a container tool such as `podman login`,
`buildah login` or `skopeo login`. Each entry either contains a single
hostname (e.g. `docker.io`) or a namespace (e.g. `quay.io/user/image`) as a key
and an auth token in the form of a base64 encoded string as value of `auth`. The
token is built from the concatenation of the username, a colon, and the
password. The registry name can additionally contain a repository name (an image
name without tag or digest) and namespaces. The path (or namespace) is matched
in its hierarchical order when checking for available authentications. For
example, an image pull for `my-registry.local/namespace/user/image:latest` will
result in a lookup in `auth.json` in the following order:

- `my-registry.local/namespace/user/image`
- `my-registry.local/namespace/user`
- `my-registry.local/namespace`
- `my-registry.local`

This way it is possible to setup multiple credentials for a single registry
which can be distinguished by their path.

The following example shows the values found in auth.json after the user logged in to
their accounts on quay.io and docker.io:

```
{
	"auths": {
		"docker.io": {
			"auth": "erfi7sYi89234xJUqaqxgmzcnQ2rRFWM5aJX0EC="
		},
		"quay.io": {
			"auth": "juQAqGmz5eR1ipzx8Evn6KGdw8fEa1w5MWczmgY="
		}
	}
}
```

This example demonstrates how to use multiple paths for a single registry, while
preserving a fallback for `my-registry.local`:

```
{
	"auths": {
		"my-registry.local/foo/bar/image": {
			"auth": "…"
		},
		"my-registry.local/foo": {
			"auth": "…"
		},
		"my-registry.local": {
			"auth": "…"
		},
	}
}
```

An entry can be removed by using a `logout` command from a container
tool such as `podman logout` or `buildah logout`.

In addition, credential helpers can be configured for specific registries and the credentials-helper
software can be used to manage the credentials in a more secure way than depending on the base64 encoded authentication
provided by `login`.  If the credential helpers are configured for specific registries, the base64 encoded authentication will not be used
for operations concerning credentials of the specified registries.

When the credential helper is in use on a Linux platform, the auth.json file would contain keys that specify the registry domain, and values that specify the suffix of the program to use (i.e. everything after docker-credential-).  For example:

```
{
    "auths": {
        "localhost:5001": {}
    },
    "credHelpers": {
		"registry.example.com": "secretservice"
	}
}
```

For more information on credential helpers, please reference the [GitHub docker-credential-helpers project](https://github.com/docker/docker-credential-helpers/releases).

# SEE ALSO
    buildah-login(1), buildah-logout(1), podman-login(1), podman-logout(1), skopeo-login(1), skopeo-logout(1)

# HISTORY
Feb 2020, Originally compiled by Tom Sweeney <tsweeney@redhat.com>


text:
module ArticlesHelper
  def make_html(string)
    string.html_safe
  end

  def clean_string_from_html(string)
    string = ActionView::Base.full_sanitizer.sanitize(string)
    string = string.gsub(/(
)/, "")
    string = string.gsub(/(")/, "")
  end

  def recent_articles(string)
    string = clean_string_from_html(string)
    string[0..60]
  end

  def feature_articles(string)
    string = clean_string_from_html(string)
    string[0..150]
  end

  def find_subheading(article)
    heading_matcher = /((\r\n){2}
)([\w ]*\w[\w ])(<\/p>(\r\n){2})/
    link = '\3'
    p link
    link_open_tag = ''
    link_close_tag = ''
    replacement_text = '\1' + link_open_tag +'\3' + link_close_tag + '\4'
    article.content.gsub(heading_matcher, replacement_text)
  end
end


text:
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

unless defined?(JRUBY_VERSION)
  require 'coveralls'
  Coveralls.wear!
end

require 'childprocess'
require 'rspec'
require 'tempfile'
require 'socket'
require 'stringio'

module ChildProcessSpecHelper
  RUBY = defined?(Gem) ? Gem.ruby : 'ruby'

  def ruby_process(*args)
    @process = ChildProcess.build(RUBY , *args)
  end

  def sleeping_ruby
    ruby_process("-e", "sleep")
  end

  def invalid_process
    @process = ChildProcess.build("unlikelytoexist")
  end

  def ignored(signal)
    code = <<-RUBY
      trap(#{signal.inspect}, "IGNORE")
      sleep
    RUBY

    ruby_process tmp_script(code)
  end

  def write_env(path)
    code = <<-RUBY
      File.open(#{path.inspect}, "w") { |f| f << ENV.inspect }
    RUBY

    ruby_process tmp_script(code)
  end

  def write_argv(path, *args)
    code = <<-RUBY
      File.open(#{path.inspect}, "w") { |f| f << ARGV.inspect }
    RUBY

    ruby_process(tmp_script(code), *args)
  end

  def write_pid(path)
    code = <<-RUBY
      File.open(#{path.inspect}, "w") { |f| f << Process.pid }
    RUBY

    ruby_process tmp_script(code)
  end

  def exit_with(exit_code)
    ruby_process(tmp_script("exit(#{exit_code})"))
  end

  def with_env(hash)
    hash.each { |k,v| ENV[k] = v }
    begin
      yield
    ensure
      hash.each_key { |k| ENV[k] = nil }
    end
  end

  def tmp_script(code)
    # use an ivar to avoid GC
    @tf = Tempfile.new("childprocess-temp")
    @tf << code
    @tf.close

    puts code if $DEBUG

    @tf.path
  end

  def within(seconds, &blk)
    end_time   = Time.now + seconds
    ok         = false
    last_error = nil

    until ok || Time.now >= end_time
      begin
        ok = yield
      rescue RSpec::Expectations::ExpectationNotMetError => last_error
      end
    end

    raise last_error unless ok
  end

  def cat
    if ChildProcess.os == :windows
      ruby(<<-CODE)
            STDIN.sync = STDOUT.sync = true
            IO.copy_stream(STDIN, STDOUT)
          CODE
    else
      ChildProcess.build("cat")
    end
  end

  def echo
    if ChildProcess.os == :windows
      ruby(<<-CODE)
            STDIN.sync  = true
            STDOUT.sync = true

            puts "hello"
          CODE
    else
      ChildProcess.build("echo", "hello")
    end
  end

  def ruby(code)
    ruby_process(tmp_script(code))
  end

  def with_executable_at(path, &blk)
    if ChildProcess.os == :windows
      path << ".cmd"
      content = "@echo foo"
    else
      content = "#!/bin/sh\necho foo"
    end

    File.open(path, 'w', 0744) { |io| io << content }
    proc = ChildProcess.build(path)

    begin
      yield proc
    ensure
      proc.stop if proc.alive?
      File.delete path
    end
  end

  def exit_timeout
    10
  end

  def random_free_port
    server = TCPServer.new('127.0.0.1', 0)
    port   = server.addr[1]
    server.close

    port
  end

  def with_tmpdir(&blk)
    name = "#{Time.now.strftime("%Y%m%d")}-#{$$}-#{rand(0x100000000).to_s(36)}"
    FileUtils.mkdir_p(name)

    begin
      yield File.expand_path(name)
    ensure
      FileUtils.rm_rf name
    end
  end

  def wait_until(timeout = 10, &blk)
    end_time = Time.now + timeout
    last_exception = nil

    until Time.now >= end_time
      begin
        return if yield
      rescue RSpec::Expectations::ExpectationNotMetError => ex
        last_exception = ex
      end

      sleep 0.01
    end

    msg = "timed out after #{timeout} seconds"
    msg << ":\n#{last_exception.message}" if last_exception

    raise msg
  end

  def can_bind?(host, port)
    TCPServer.new(host, port).close
    true
  rescue
    false
  end

  def rewind_and_read(io)
    io.rewind
    io.read
  end

end # ChildProcessSpecHelper

Thread.abort_on_exception = true

RSpec.configure do |c|
  c.include(ChildProcessSpecHelper)
  c.after(:each) {
    defined?(@process) && @process.alive? && @process.stop
  }

  if ChildProcess.jruby? && ChildProcess.new("true").instance_of?(ChildProcess::JRuby::Process)
    c.filter_run_excluding :process_builder => false
  end

  if ChildProcess.linux? && ChildProcess.posix_spawn?
    c.filter_run_excluding :posix_spawn_on_linux => false
  end
end


text:
require 'integration/test_helper'

describe Azure::CloudServiceManagementService do
  include Azure::Core::Utility

  subject { Azure::CloudServiceManagementService.new }

  let(:options) do
    {
      location: 'West US',
      description: 'Test'
    }
  end

  before do
    Azure::Loggerx.expects(:puts).returns(nil).at_least(0)
  end

  describe '#delete_cloud_service' do
    before do
      @cloud_name = random_string('test-service-cloud', 10)
      subject.create_cloud_service(@cloud_name, options)
    end

    it 'Deletes the cloud service in Microsoft Azure.' do
      subject.delete_cloud_service(@cloud_name)
      cloud_service = subject.get_cloud_service(@cloud_name)
      cloud_service.must_equal nil
    end
  end
end


text:
package com.blazebit.persistence.view.impl.update.listener;

import com.blazebit.persistence.view.EntityViewManager;
import com.blazebit.persistence.view.PostRollbackListener;
import com.blazebit.persistence.view.ViewListener;
import com.blazebit.persistence.view.ViewTransition;

import javax.persistence.EntityManager;

/**
 *
 * @author Christian Beikov
 * @since 1.4.0
 */
public class ViewPostRollbackListenerImpl<T> implements PostRollbackListener<T> {

    private final ViewListener<T> listener;

    public ViewPostRollbackListenerImpl(ViewListener<T> listener) {
        this.listener = listener;
    }

    @Override
    public void postRollback(EntityViewManager entityViewManager, EntityManager entityManager, T view, ViewTransition transition) {
        listener.call(view);
    }
}


text:
"""Tests for initializers."""

# Dependency imports
import numpy as np
from scipy import stats as sp_stats

import tensorflow.compat.v2 as tf

from tensorflow_probability.python.distributions import exponential
from tensorflow_probability.python.distributions import kullback_leibler
from tensorflow_probability.python.internal import test_util
from tensorflow_probability.python.math import gradient

@test_util.test_all_tf_execution_regimes
class ExponentialTest(test_util.TestCase):

  def testExponentialLogPDF(self):
    batch_size = 6
    lam = tf.constant([2.0] * batch_size)
    lam_v = 2.0
    x = np.array([2.5, 2.5, 4.0, 0.1, 1.0, 2.0], dtype=np.float32)
    dist = exponential.Exponential(rate=lam, validate_args=True)

    log_pdf = dist.log_prob(x)
    self.assertEqual(log_pdf.shape, (6,))

    pdf = dist.prob(x)
    self.assertEqual(pdf.shape, (6,))

    expected_log_pdf = sp_stats.expon.logpdf(x, scale=1 / lam_v)
    self.assertAllClose(self.evaluate(log_pdf), expected_log_pdf)
    self.assertAllClose(self.evaluate(pdf), np.exp(expected_log_pdf))

  def testExponentialLogPDFBoundary(self):
    # Check that Log PDF is finite at 0.
    rate = np.array([0.1, 0.5, 1., 2., 5., 10.], dtype=np.float32)
    dist = exponential.Exponential(rate=rate, validate_args=False)
    log_pdf = dist.log_prob(0.)
    self.assertAllClose(np.log(rate), self.evaluate(log_pdf))

  def testExponentialCDF(self):
    batch_size = 6
    lam = tf.constant([2.0] * batch_size)
    lam_v = 2.0
    x = np.array([2.5, 2.5, 4.0, 0.1, 1.0, 2.0], dtype=np.float32)

    dist = exponential.Exponential(rate=lam, validate_args=True)

    cdf = dist.cdf(x)
    self.assertEqual(cdf.shape, (6,))

    expected_cdf = sp_stats.expon.cdf(x, scale=1 / lam_v)
    self.assertAllClose(self.evaluate(cdf), expected_cdf)

  def testExponentialLogSurvival(self):
    batch_size = 7
    lam = tf.constant([2.0] * batch_size)
    lam_v = 2.0
    x = np.array([2.5, 2.5, 4.0, 0.1, 1.0, 2.0, 10.0], dtype=np.float32)

    dist = exponential.Exponential(rate=lam, validate_args=True)

    log_survival = dist.log_survival_function(x)
    self.assertEqual(log_survival.shape, (7,))

    expected_log_survival = sp_stats.expon.logsf(x, scale=1 / lam_v)
    self.assertAllClose(self.evaluate(log_survival), expected_log_survival)

  def testExponentialMean(self):
    lam_v = np.array([1.0, 4.0, 2.5])
    dist = exponential.Exponential(rate=lam_v, validate_args=True)
    self.assertEqual(dist.mean().shape, (3,))
    expected_mean = sp_stats.expon.mean(scale=1 / lam_v)
    self.assertAllClose(self.evaluate(dist.mean()), expected_mean)

  def testExponentialVariance(self):
    lam_v = np.array([1.0, 4.0, 2.5])
    dist = exponential.Exponential(rate=lam_v, validate_args=True)
    self.assertEqual(dist.variance().shape, (3,))
    expected_variance = sp_stats.expon.var(scale=1 / lam_v)
    self.assertAllClose(self.evaluate(dist.variance()), expected_variance)

  def testExponentialEntropy(self):
    lam_v = np.array([1.0, 4.0, 2.5])
    dist = exponential.Exponential(rate=lam_v, validate_args=True)
    self.assertEqual(dist.entropy().shape, (3,))
    expected_entropy = sp_stats.expon.entropy(scale=1 / lam_v)
    self.assertAllClose(self.evaluate(dist.entropy()), expected_entropy)

  def testExponentialSample(self):
    lam = tf.constant([3.0, 4.0])
    lam_v = [3.0, 4.0]
    n = tf.constant(100000)
    dist = exponential.Exponential(rate=lam, validate_args=True)

    samples = dist.sample(n, seed=test_util.test_seed())
    sample_values = self.evaluate(samples)
    self.assertEqual(sample_values.shape, (100000, 2))
    self.assertFalse(np.any(sample_values < 0.0))
    for i in range(2):
      self.assertLess(
          sp_stats.kstest(sample_values[:, i],
                          sp_stats.expon(scale=1.0 / lam_v[i]).cdf)[0], 0.01)

  def testExponentialSampleMultiDimensional(self):
    batch_size = 2
    lam_v = [3.0, 22.0]
    lam = tf.constant([lam_v] * batch_size)

    dist = exponential.Exponential(rate=lam, validate_args=True)

    n = 100000
    samples = dist.sample(n, seed=test_util.test_seed())
    self.assertEqual(samples.shape, (n, batch_size, 2))

    sample_values = self.evaluate(samples)

    self.assertFalse(np.any(sample_values < 0.0))
    for i in range(2):
      self.assertLess(
          sp_stats.kstest(sample_values[:, 0, i],
                          sp_stats.expon(scale=1.0 / lam_v[i]).cdf)[0], 0.01)
      self.assertLess(
          sp_stats.kstest(sample_values[:, 1, i],
                          sp_stats.expon(scale=1.0 / lam_v[i]).cdf)[0], 0.01)

  @test_util.numpy_disable_gradient_test
  def testFullyReparameterized(self):
    lam = tf.constant([0.1, 1.0])
    _, grad_lam = gradient.value_and_gradient(
        lambda l: exponential.Exponential(rate=lam, validate_args=True).  # pylint: disable=g-long-lambda
        sample(100, seed=test_util.test_seed()),
        lam)
    self.assertIsNotNone(grad_lam)

  def testExponentialExponentialKL(self):
    a_rate = np.arange(0.5, 1.6, 0.1)
    b_rate = np.arange(0.5, 1.6, 0.1)

    # This reshape is intended to expand the number of test cases.
    a_rate = a_rate.reshape((len(a_rate), 1))
    b_rate = b_rate.reshape((1, len(b_rate)))

    a = exponential.Exponential(rate=a_rate, validate_args=True)
    b = exponential.Exponential(rate=b_rate, validate_args=True)

    # Consistent with
    # http://www.mast.queensu.ca/~communications/Papers/gil-msc11.pdf, page 108
    true_kl = np.log(a_rate) - np.log(b_rate) + (b_rate - a_rate) / a_rate

    kl = kullback_leibler.kl_divergence(a, b)

    x = a.sample(int(4e5), seed=test_util.test_seed())
    kl_samples = a.log_prob(x) - b.log_prob(x)

    kl_, kl_samples_ = self.evaluate([kl, kl_samples])
    self.assertAllClose(true_kl, kl_, atol=0., rtol=1e-12)
    self.assertAllMeansClose(kl_samples_, true_kl, axis=0, atol=0., rtol=8e-2)

    zero_kl = kullback_leibler.kl_divergence(a, a)
    true_zero_kl_, zero_kl_ = self.evaluate([tf.zeros_like(zero_kl), zero_kl])
    self.assertAllEqual(true_zero_kl_, zero_kl_)

  @test_util.tf_tape_safety_test
  def testGradientThroughRate(self):
    rate = tf.Variable(3.)
    d = exponential.Exponential(rate=rate)
    with tf.GradientTape() as tape:
      loss = -d.log_prob([1., 2., 4.])
    grad = tape.gradient(loss, d.trainable_variables)
    self.assertLen(grad, 1)
    self.assertAllNotNone(grad)

  def testAssertsPositiveRate(self):
    rate = tf.Variable([1., 2., -3.])
    self.evaluate(rate.initializer)
    with self.assertRaisesOpError("Argument `rate` must be positive."):
      d = exponential.Exponential(rate=rate, validate_args=True)
      self.evaluate(d.sample(seed=test_util.test_seed()))

  def testAssertsPositiveRateAfterMutation(self):
    rate = tf.Variable([1., 2., 3.])
    self.evaluate(rate.initializer)
    d = exponential.Exponential(rate=rate, validate_args=True)
    self.evaluate(d.mean())
    with self.assertRaisesOpError("Argument `rate` must be positive."):
      with tf.control_dependencies([rate.assign([1., 2., -3.])]):
        self.evaluate(d.sample(seed=test_util.test_seed()))

  def testExpontentialQuantile(self):
    dist = exponential.Exponential(rate=[1., 2.], validate_args=True)

    # Corner cases.
    result = self.evaluate(dist.quantile([0., 1.]))
    self.assertAllClose(result, [0., np.inf])

    # Two sample values calculated by hand.
    result = self.evaluate(dist.quantile(0.5))
    self.assertAllClose(result, [0.693147, 0.346574])

  def testExponentialQuantileIsInverseOfCdf(self):
    dist = exponential.Exponential(rate=[1., 2.], validate_args=False)
    values = [2 * [t / 10.] for t in range(0, 11)]
    result = self.evaluate(dist.cdf(dist.quantile(values)))
    self.assertAllClose(result, values)

  def testSupportBijectorOutsideRange(self):
    rate = np.array([2., 4., 5.])
    dist = exponential.Exponential(rate, validate_args=True)
    x = np.array([-8.3, -0.4, -1e-6])
    bijector_inverse_x = dist.experimental_default_event_space_bijector(
        ).inverse(x)
    self.assertAllNan(self.evaluate(bijector_inverse_x))

if __name__ == "__main__":
  test_util.main()


text:
var express = require('express');
var router = express.Router();
var title = { title: 'Quiz @danielearning' };

var quizController = require('../controllers/quiz_controller');
var commentController = require('../controllers/comment_controller');
var sessionController = require('../controllers/session_controller');
var statisticsController = require('../controllers/statistics_controller');

/* GET home page. */
router.get('/', function(req, res) {
  res.render('index', title);
});

router.param('quizId', quizController.load);  // autoload :quizId
router.param('commentId', commentController.load);  // autoload :commentId

router.get('/quizes',                      quizController.index);
router.get('/quizes/:quizId(\\d+)',        quizController.show);
router.get('/quizes/:quizId(\\d+)/answer', quizController.answer);

router.get('/quizes/new',                  sessionController.loginRequired, quizController.new);
router.post('/quizes/create',              sessionController.loginRequired, quizController.create);
router.get('/quizes/:quizId(\\d+)/edit',   sessionController.loginRequired, quizController.edit);
router.put('/quizes/:quizId(\\d+)',        sessionController.loginRequired, quizController.update);
router.delete('/quizes/:quizId(\\d+)',     sessionController.loginRequired, quizController.destroy);

router.get ('/quizes/:quizId(\\d+)/comments/new',    commentController.new);
router.post('/quizes/:quizId(\\d+)/comments/create', commentController.create);
router.put ('/comments/:commentId(\\d+)/publish',    commentController.publish);

router.get   ('/login', sessionController.new);
router.post  ('/login', sessionController.create);
router.delete('/login', sessionController.destroy);

router.get('/author', function(req, res) {
  res.render('author', title);
});

router.get('/statistics', statisticsController.retrieve);

module.exports = router;


text:
#ifndef _GAB_SERIAL_NODE_HPP_
#define _GAB_SERIAL_NODE_HPP_

#include <cstddef>
#include <list>
#include <memory>
#include <sstream>
#include <map>

namespace gab
{
  class serial_node
  {
  public:
    typedef std::string key_type;
    typedef std::string value_type;
  private:
    typedef std::map<key_type, value_type> attribute_container_type;
  public:
    typedef std::shared_ptr<serial_node> ptr_type;
    typedef std::list<ptr_type> child_container_type;
    typedef std::size_t size_type;

    void set_attribute(const key_type &key, const value_type &value);
    template<typename T>
    void set_attribute(const key_type &key, const T &value)
    {
      std::ostringstream o;
      o << value;
      set_attribute(key, o.str());
    }

    template<typename T>
    T get_attribute(const key_type &key, const T &def = T()) const
    {
      const attribute_container_type::const_iterator it = _attributes.find(key);
      if(it == _attributes.end()) return def;
      std::istringstream i(it->second);
      T ret;
      i >> ret;
      return ret;
    }

    bool remove_attribute(const key_type &key);
    void clear_attributes();

    void add_child(const serial_node::ptr_type &child);
    bool remove_child(const serial_node::ptr_type &child);
    void clear_children();
    child_container_type::iterator children_begin();
    child_container_type::iterator children_end();
    size_type num_children() const;

  private:
    child_container_type _children;
    attribute_container_type _attributes;
  };
}

#endif


text:
#include "DevsimReader.hh"
#include "DevsimLoader.hh"

namespace dsDevsimParse {
int meshlineno;
dsMesh::DevsimLoaderPtr  DevsimLoader = nullptr;
dsMesh::MeshRegionPtr    MeshRegion = nullptr;
dsMesh::MeshContactPtr   MeshContact = nullptr;
dsMesh::MeshInterfacePtr MeshInterface = nullptr;
dsMesh::SolutionPtr      Sol= nullptr;
dsMesh::EquationPtr      Equation= nullptr;
std::string errors;
}

namespace dsDevsimParse
{
void DeletePointers()
{
//    delete DevsimLoader;
    delete MeshRegion;
    delete MeshContact;
    delete MeshInterface;
    delete Sol;
    delete Equation;

    //// This is owned by the meshkeeper
    //// We should look to see if this is wise to keep around.  But, it has already been added to the MeshKeeper
//    DevsimLoader = nullptr;
    MeshRegion = nullptr;
    MeshContact = nullptr;
    MeshInterface = nullptr;
    Sol = nullptr;
    Equation = nullptr;
}
}