text:
<?php

namespace Tests\AcmePhp\Core\Http;

use AcmePhp\Core\Exception\AcmeCoreException;
use AcmePhp\Core\Http\Base64SafeEncoder;
use AcmePhp\Core\Http\SecureHttpClient;
use AcmePhp\Core\Http\ServerErrorHandler;
use AcmePhp\Ssl\Generator\KeyPairGenerator;
use AcmePhp\Ssl\Parser\KeyParser;
use AcmePhp\Ssl\Signer\DataSigner;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\RequestInterface;

class SecureHttpClientTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @param array $responses
     * @param bool  $willThrow
     *
     * @return SecureHttpClient
     */
    private function createMockedClient(array $responses, $willThrow = false)
    {
        $keyPairGenerator = new KeyPairGenerator();
        $httpClient = new Client(['handler' => HandlerStack::create(new MockHandler($responses))]);

        $errorHandler = $this->getMockBuilder(ServerErrorHandler::class)->getMock();

        if ($willThrow) {
            $errorHandler->expects($this->once())
                ->method('createAcmeExceptionForResponse')
                ->willReturn(new AcmeCoreException());
        }

        return new SecureHttpClient(
            $keyPairGenerator->generateKeyPair(),
            $httpClient,
            new Base64SafeEncoder(),
            new KeyParser(),
            new DataSigner(),
            $errorHandler
        );
    }

    public function testValidUnsignedStringRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], 'foo')], false);
        $body = $client->unsignedRequest('GET', '/foo', ['foo' => 'bar'], false);
        $this->assertEquals('foo', $body);
    }

    public function testValidUnsignedJsonRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], json_encode(['test' => 'ok']))], false);
        $data = $client->unsignedRequest('GET', '/foo', ['foo' => 'bar'], true);
        $this->assertEquals(['test' => 'ok'], $data);
    }

    /**
     * @expectedException \AcmePhp\Core\Exception\Protocol\ExpectedJsonException
     */
    public function testInvalidUnsignedJsonRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], 'invalid json')], false);
        $client->unsignedRequest('GET', '/foo', ['foo' => 'bar'], true);
    }

    public function testValidSignedStringRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], 'foo')], false);
        $body = $client->signedRequest('GET', '/foo', ['foo' => 'bar'], false);
        $this->assertEquals('foo', $body);
    }

    public function testValidSignedJsonRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], json_encode(['test' => 'ok']))], false);
        $data = $client->signedRequest('GET', '/foo', ['foo' => 'bar'], true);
        $this->assertEquals(['test' => 'ok'], $data);
    }

    /**
     * @expectedException \AcmePhp\Core\Exception\Protocol\ExpectedJsonException
     */
    public function testInvalidSignedJsonRequest()
    {
        $client = $this->createMockedClient([new Response(200, [], 'invalid json')], false);
        $client->signedRequest('GET', '/foo', ['foo' => 'bar'], true);
    }

    public function testSignedRequestPayload()
    {
        $container = [];

        $stack = HandlerStack::create(new MockHandler([new Response(200, [], json_encode(['test' => 'ok']))]));
        $stack->push(Middleware::history($container));

        $keyPairGenerator = new KeyPairGenerator();

        $dataSigner = $this->getMockBuilder(DataSigner::class)->getMock();
        $dataSigner->expects($this->once())
            ->method('signData')
            ->willReturn('foobar');

        $client = new SecureHttpClient(
            $keyPairGenerator->generateKeyPair(),
            new Client(['handler' => $stack]),
            new Base64SafeEncoder(),
            new KeyParser(),
            $dataSigner,
            $this->getMockBuilder(ServerErrorHandler::class)->getMock()
        );

        $client->signedRequest('POST', '/acme/new-reg', ['contact' => 'foo@bar.com'], true);

        // Check request object
        $this->assertCount(1, $container);

        /** @var RequestInterface $request */
        $request = $container[0]['request'];

        $this->assertInstanceOf(RequestInterface::class, $request);
        $this->assertEquals('POST', $request->getMethod());
        $this->assertEquals('/acme/new-reg', ($request->getUri() instanceof Uri) ? $request->getUri()->getPath() : $request->getUri());

        $body = \GuzzleHttp\Psr7\copy_to_string($request->getBody());
        $payload = @json_decode($body, true);

        $this->assertInternalType('array', $payload);
        $this->assertArrayHasKey('header', $payload);
        $this->assertArrayHasKey('alg', $payload['header']);
        $this->assertArrayHasKey('jwk', $payload['header']);
        $this->assertArrayHasKey('protected', $payload);
        $this->assertArrayHasKey('payload', $payload);
        $this->assertArrayHasKey('signature', $payload);
        $this->assertEquals('Zm9vYmFy', $payload['signature']);
    }
}


text:
<?php

namespace Navy\GitHub\WebHook;

class CommentCollection implements \Iterator
{
    protected $position;
    protected $comments;

    public function __construct(array $comments)
    {
        $this->comments = array_map(function ($v) {
            return ($v instanceof Comment) ? $v : new Comment($v);
        }, $comments);

        $this->rewind();
    }

    public function current()
    {
        return $this->comments[$this->position];
    }

    public function key()
    {
        return $this->position;
    }

    public function next()
    {
        $this->position++;
    }

    public function rewind()
    {
        $this->position = 0;
    }

    public function valid()
    {
        return isset($this->comments[$this->position]);
    }
}

redpajama_set_name: RedPajamaGithub


text:
import Data.Char

ucfirst :: String -> String
ucfirst "" = ""
ucfirst (c:cs) = toUpper c : cs

toUpperCase :: String -> String
toUpperCase = map toUpper

uchead :: String -> Char
uchead = head . (map toUpper)


text:
package edu.wpi.first.wpilibj.templates.commands;

//Simport org.usfirst.frc.team340.robot.RobotMap;

/**
 * Command to use the bin grabber to pick up a bin.
 * Potentially obsolete and I'm not sure what's up with the formatting in Eclipse
 * @author Dayle
 */
public class BinGrabberGetBin extends CommandBase {

    public BinGrabberGetBin() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    	requires (binGrabber);
    }

//    // Called just before this Command runs the first time
//    protected void initialize() {
//    	System.out.println("[BinGrabberGetBin: initialize] contracts grabber");
//    	binGrabber.contractGrabber();
//    }
//
//    // Called repeatedly when this Command is scheduled to run
//    protected void execute() {
//    	if (binGrabber.isGrabberLowered()){
//    		System.out.println("[BinGrabberGetBin: execute] lowered, stop moving, expand grabber");
//    		binGrabber.expandGrabber();
//    		binGrabber.stopMoving();
//    	}
//    	else {
//    		System.out.println("[BinGrabberGetBin: execute] lowering  grabber");
//    		binGrabber.lowerGrabber();
//    	}
//    }
//
//    // Make this return true when this Command no longer needs to run execute()
//    protected boolean isFinished() {
//        return binGrabber.isBinGrabbed();
//    }
//
//    // Called once after isFinished returns true
//    protected void end() {
//    	System.out.println("[BinGrabberGetBin: end] raise grabber");
//    	binGrabber.raiseGrabber();
//    }
//
//    // Called when another command which requires one or more of the same
//    // subsystems is scheduled to run
//    protected void interrupted() {
//    	System.out.println("[BinGrabberGetBin: interrupted] stop moving");
//    	//TODO: Add code here for when it is interrupted
//    	binGrabber.stopMoving();
//    }
 // Called just before this Command runs the first time
    protected void initialize() {
    	System.out.println("[BinGrabberGetBin: initialize] ");
    	this.setTimeout(.26);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	System.out.println("[BinGrabberGetBin: execute] un-hooking string");
    	binGrabber.raiseHook();
    	System.out.println("[BinGrabberGetBin: execute] lowered, stop moving");
    	binGrabber.stopMoving();
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return this.isTimedOut();
    }

    // Called once after isFinished returns true
    protected void end() {
    	System.out.println("[BinGrabberGetBin: end] raise hook");
    	binGrabber.stopMoving();
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    	System.out.println("[BinGrabberGetBin: interrupted] stop moving");
    	binGrabber.stopMoving();
    }

}


text:
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os/exec"
	"strings"
	"time"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/client"
	"github.com/docker/docker/internal/test/request"
	"github.com/docker/docker/pkg/parsers/kernel"
	"github.com/go-check/check"
	"github.com/kr/pty"
	"gotest.tools/assert"
)

func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "top")
	dockerCmd(c, "update", "-m", "500M", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")

	file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "524288000")
}

func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "top")
	dockerCmd(c, "update", "-m", "500M", name)
	dockerCmd(c, "restart", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")

	file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "524288000")
}

func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)

	name := "test-update-container"
	file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
	dockerCmd(c, "run", "--name", name, "-m", "300M", "busybox", "cat", file)
	dockerCmd(c, "update", "-m", "500M", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")

	out, _ := dockerCmd(c, "start", "-a", name)
	assert.Equal(c, strings.TrimSpace(out), "524288000")
}

func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, cpuShare)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "--cpu-shares", "1000", "busybox", "top")
	dockerCmd(c, "pause", name)
	dockerCmd(c, "update", "--cpu-shares", "500", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.CPUShares"), "500")

	dockerCmd(c, "unpause", name)
	file := "/sys/fs/cgroup/cpu/cpu.shares"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "500")
}

func (s *DockerSuite) TestUpdateWithUntouchedFields(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)
	testRequires(c, cpuShare)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "--cpu-shares", "800", "busybox", "top")
	dockerCmd(c, "update", "-m", "500M", name)

	// Update memory and not touch cpus, `cpuset.cpus` should still have the old value
	out := inspectField(c, name, "HostConfig.CPUShares")
	assert.Equal(c, out, "800")

	file := "/sys/fs/cgroup/cpu/cpu.shares"
	out, _ = dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "800")
}

func (s *DockerSuite) TestUpdateContainerInvalidValue(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true")
	out, _, err := dockerCmdWithError("update", "-m", "2M", name)
	assert.ErrorContains(c, err, "")
	expected := "Minimum memory limit allowed is 4MB"
	assert.Assert(c, strings.Contains(out, expected))
}

func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true")
	_, _, err := dockerCmdWithError("update", name)
	assert.ErrorContains(c, err, "")
}

func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) {
	testRequires(c, DaemonIsLinux, kernelMemorySupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "--kernel-memory", "50M", "busybox", "top")
	dockerCmd(c, "update", "--kernel-memory", "100M", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.KernelMemory"), "104857600")

	file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "104857600")
}

func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
	testRequires(c, DaemonIsLinux, kernelMemorySupport)

	isNewKernel := CheckKernelVersion(4, 6, 0)
	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
	_, _, err := dockerCmdWithError("update", "--kernel-memory", "100M", name)
	// Update kernel memory to a running container without kernel memory initialized
	// is not allowed before kernel version 4.6.
	if !isNewKernel {
		assert.ErrorContains(c, err, "")
	} else {
		assert.NilError(c, err)
	}

	dockerCmd(c, "pause", name)
	_, _, err = dockerCmdWithError("update", "--kernel-memory", "200M", name)
	if !isNewKernel {
		assert.ErrorContains(c, err, "")
	} else {
		assert.NilError(c, err)
	}
	dockerCmd(c, "unpause", name)

	dockerCmd(c, "stop", name)
	dockerCmd(c, "update", "--kernel-memory", "300M", name)
	dockerCmd(c, "start", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.KernelMemory"), "314572800")

	file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "314572800")
}

// GetKernelVersion gets the current kernel version.
func GetKernelVersion() *kernel.VersionInfo {
	v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion)
	return v
}

// CheckKernelVersion checks if current kernel is newer than (or equal to)
// the given version.
func CheckKernelVersion(k, major, minor int) bool {
	return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) >= 0
}

func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)
	testRequires(c, swapMemorySupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "--memory-swap", "500M", "busybox", "top")
	dockerCmd(c, "update", "--memory-swap", "600M", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "629145600")

	file := "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "629145600")
}

func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)
	testRequires(c, swapMemorySupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "--memory-swap", "500M", "busybox", "top")
	_, _, err := dockerCmdWithError("update", "--memory-swap", "200M", name)
	// Update invalid swap memory should fail.
	// This will pass docker config validation, but failed at kernel validation
	assert.ErrorContains(c, err, "")

	// Update invalid swap memory with failure should not change HostConfig
	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "314572800")
	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "524288000")

	dockerCmd(c, "update", "--memory-swap", "600M", name)

	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "629145600")

	file := "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
	out, _ := dockerCmd(c, "exec", name, "cat", file)
	assert.Equal(c, strings.TrimSpace(out), "629145600")
}

func (s *DockerSuite) TestUpdateStats(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)
	testRequires(c, cpuCfsQuota)
	name := "foo"
	dockerCmd(c, "run", "-d", "-ti", "--name", name, "-m", "500m", "busybox")

	assert.NilError(c, waitRun(name))

	getMemLimit := func(id string) uint64 {
		resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
		assert.NilError(c, err)
		assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")

		var v *types.Stats
		err = json.NewDecoder(body).Decode(&v)
		assert.NilError(c, err)
		body.Close()

		return v.MemoryStats.Limit
	}
	preMemLimit := getMemLimit(name)

	dockerCmd(c, "update", "--cpu-quota", "2000", name)

	curMemLimit := getMemLimit(name)
	assert.Equal(c, preMemLimit, curMemLimit)
}

func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) {
	testRequires(c, DaemonIsLinux)
	testRequires(c, memoryLimitSupport)
	testRequires(c, swapMemorySupport)

	name := "test-update-container"
	dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "busybox", "top")
	out, _, err := dockerCmdWithError("update", "--memory", "800M", name)
	assert.ErrorContains(c, err, "")
	assert.Assert(c, strings.Contains(out, "Memory limit should be smaller than already set memoryswap limit"))

	dockerCmd(c, "update", "--memory", "800M", "--memory-swap", "1000M", name)
}

func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *check.C) {
	testRequires(c, DaemonIsLinux, cpuShare)

	out, _ := dockerCmd(c, "run", "-tid", "--restart=always", "busybox", "sh")
	id := strings.TrimSpace(string(out))
	dockerCmd(c, "update", "--cpu-shares", "512", id)

	cpty, tty, err := pty.Open()
	assert.NilError(c, err)
	defer cpty.Close()

	cmd := exec.Command(dockerBinary, "attach", id)
	cmd.Stdin = tty

	assert.NilError(c, cmd.Start())
	defer cmd.Process.Kill()

	_, err = cpty.Write([]byte("exit\n"))
	assert.NilError(c, err)

	assert.NilError(c, cmd.Wait())

	// container should restart again and keep running
	err = waitInspect(id, "{{.RestartCount}}", "1", 30*time.Second)
	assert.NilError(c, err)
	assert.NilError(c, waitRun(id))
}

func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) {
	testRequires(c, cpuCfsQuota, cpuCfsPeriod)

	file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
	file2 := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"

	out, _ := dockerCmd(c, "run", "-d", "--cpus", "0.5", "--name", "top", "busybox", "top")
	assert.Assert(c, strings.TrimSpace(out) != "")

	out, _ = dockerCmd(c, "exec", "top", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
	assert.Equal(c, strings.TrimSpace(out), "50000\n100000")

	clt, err := client.NewClientWithOpts(client.FromEnv)
	assert.NilError(c, err)
	inspect, err := clt.ContainerInspect(context.Background(), "top")
	assert.NilError(c, err)
	assert.Equal(c, inspect.HostConfig.NanoCPUs, int64(500000000))

	out = inspectField(c, "top", "HostConfig.CpuQuota")
	assert.Equal(c, out, "0", "CPU CFS quota should be 0")
	out = inspectField(c, "top", "HostConfig.CpuPeriod")
	assert.Equal(c, out, "0", "CPU CFS period should be 0")

	out, _, err = dockerCmdWithError("update", "--cpu-quota", "80000", "top")
	assert.ErrorContains(c, err, "")
	assert.Assert(c, strings.Contains(out, "Conflicting options: CPU Quota cannot be updated as NanoCPUs has already been set"))

	dockerCmd(c, "update", "--cpus", "0.8", "top")
	inspect, err = clt.ContainerInspect(context.Background(), "top")
	assert.NilError(c, err)
	assert.Equal(c, inspect.HostConfig.NanoCPUs, int64(800000000))

	out = inspectField(c, "top", "HostConfig.CpuQuota")
	assert.Equal(c, out, "0", "CPU CFS quota should be 0")
	out = inspectField(c, "top", "HostConfig.CpuPeriod")
	assert.Equal(c, out, "0", "CPU CFS period should be 0")

	out, _ = dockerCmd(c, "exec", "top", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
	assert.Equal(c, strings.TrimSpace(out), "80000\n100000")
}


text:
//#include "geode_includes.hpp"
#include "CqState.hpp"
#include <vcclr.h>

#include "impl/ManagedString.hpp"
using namespace System;
using namespace System::Runtime::InteropServices;

namespace Apache
{
  namespace Geode
  {
    namespace Client
    {

      String^ CqState::ToString()
      {
		  return ManagedString::Get(NativePtr->toString());
      }

      bool CqState::IsRunning()
      {
        return NativePtr->isRunning();
      }

      bool CqState::IsStopped()
      {
        return NativePtr->isStopped();
      }

      bool CqState::IsClosed()
      {
	return NativePtr->isClosed();
      }

      bool CqState::IsClosing()
      {
	return NativePtr->isClosing();
      }

      void CqState::SetState( CqStateType state )
      {
		  apache::geode::client::CqState::StateType st =apache::geode::client::CqState::INVALID;
		  if(state == CqStateType::STOPPED)
			  st = apache::geode::client::CqState::STOPPED;
		  else if(state == CqStateType::RUNNING)
			  st = apache::geode::client::CqState::RUNNING;
		  else if(state == CqStateType::CLOSED)
			  st = apache::geode::client::CqState::CLOSED;
		  else if(state == CqStateType::CLOSING)
			  st = apache::geode::client::CqState::CLOSING;

		  NativePtr->setState( st );
      }

      CqStateType CqState::GetState( )
      {
		apache::geode::client::CqState::StateType st =  NativePtr->getState( );
        CqStateType state;
		if(st==apache::geode::client::CqState::STOPPED)
			state = CqStateType::STOPPED;
		else if(st==apache::geode::client::CqState::RUNNING)
			state = CqStateType::RUNNING;
		else if(st==apache::geode::client::CqState::CLOSED)
			state = CqStateType::CLOSED;
		else if(st==apache::geode::client::CqState::CLOSING)
			state = CqStateType::CLOSING;
		else
			state = CqStateType::INVALID;
		return state;
    }  // namespace Client
  }  // namespace Geode
}  // namespace Apache

 } //namespace


text:
<?php

namespace Build\Core\Bauhaus\Widgets\Input;

use Build\Core\Bauhaus\Widgets\Widget;

class Select extends Widget
{

    /**
     * Override the view path.
     * @var string
     */
    protected $view = 'build.core::components.bauhaus.input.select';

    /**
     * Get the data tags for this field.
     *
     * @return string
     */
    public function getData()
    {
        $data = $this->get('data', []);

        return implode(' ', array_map(function ($v, $k) {
            return sprintf('data-%s="%s"', $k, $v);
        }, $data, array_keys($data)));
    }

    /**
     * Get the data tags for this field.
     *
     * @return string
     */
    public function getAttributes()
    {
        $attr = $this->get('attributes', []);

        return implode(' ', array_map(function ($v, $k) {
            return sprintf('%s="%s"', $k, $v);
        }, $attr, array_keys($attr)));
    }

    /**
     * Return the old input value.
     *
     * @param  mixed  $default
     * @return mixed  The old input value
     */
    public function getOld($default = null)
    {
        if ( ! $default) {
            $default = $default ? : $this->get('selected', $this->isMultiple() ? [] : null);
        }

        return old($this->get('name'), $this->get('value', $default));
    }

    /**
     * Returns wether this select is a multiple.
     *
     * @return boolean
     */
    public function isMultiple()
    {
        return $this->get('multiple', false) == true;
    }

    /**
     * Retrieves all the Options in key=>value fashion.
     *
     * @return array
     */
    public function getOptions()
    {
        return $this->get('options', []);
    }

    public function isSelected($key) {

        if ($this->isMultiple()) {
            return in_array($key, $this->getOld());
        }

        return $key === $this->getOld();
    }
}


text:
'use strict';

module.exports = {
  preIteration(controllerState) {
    if (controllerState.success) {
      return 'done';
    }

    return 'nextIteration';
  },
};


text:
package net.pubnative.api.core.request.model.api;

import java.io.Serializable;
import java.util.Map;

public class PNAPIV3DataModel implements Serializable {

    public String type;
    public Map    data;

    public String getText() {

        return getStringField("text");
    }

    public Double getNumber() {

        return getNumberField("number");
    }

    public String getURL() {

        return getStringField("url");
    }

    public String getHtml() {

        return getStringField("html");
    }

    public String getStringField(String field) {

        return (String) getDataField(field);
    }

    public Double getNumberField(String field) {

        return (Double) getDataField(field);
    }

    protected Object getDataField(String dataField) {

        Object result = null;
        if (data != null && data.containsKey(dataField)) {
            result = data.get(dataField);
        }
        return result;
    }
}


text:
#ifndef  _KQUEUE_PRIVATE_H
#define  _KQUEUE_PRIVATE_H

#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "tree.h"

/* Maximum events returnable in a single kevent() call */
#define MAX_KEVENT  512

struct kqueue;
struct kevent;
struct knote;
struct map;
struct eventfd;
struct evfilt_data;

#if defined(_WIN32)
# include "../windows/platform.h"
# include "../common/queue.h"
# if !defined(NDEBUG) && !defined(__GNUC__)
#  include <crtdbg.h>
# endif
#elif defined(__linux__)
# include "../posix/platform.h"
# include "../linux/platform.h"
#elif defined(__sun)
# include "../posix/platform.h"
# include "../solaris/platform.h"
#else
# error Unknown platform
#endif

#include "debug.h"

/* Workaround for Android */
#ifndef EPOLLONESHOT
# define EPOLLONESHOT (1 << 30)
#endif

struct eventfd {
    int ef_id;
#if defined(EVENTFD_PLATFORM_SPECIFIC)
    EVENTFD_PLATFORM_SPECIFIC;
#endif
};

/*
 * Flags used by knote->kn_flags
 */
#define KNFL_PASSIVE_SOCKET  (0x01)  /* Socket is in listen(2) mode */
#define KNFL_REGULAR_FILE    (0x02)  /* File descriptor is a regular file */
#define KNFL_KNOTE_DELETED   (0x10)  /* The knote object is no longer valid */

struct knote {
    struct kevent     kev;
    int               kn_flags;
    union {
        /* OLD */
        int           pfd;       /* Used by timerfd */
        int           events;    /* Used by socket */
        struct {
            nlink_t   nlink;  /* Used by vnode */
            off_t     size;   /* Used by vnode */
        } vnode;
        timer_t       timerid;
        struct sleepreq *sleepreq; /* Used by posix/timer.c */
		void          *handle;      /* Used by win32 filters */
    } data;
	struct kqueue*	   kn_kq;
    volatile uint32_t  kn_ref;
#if defined(KNOTE_PLATFORM_SPECIFIC)
    KNOTE_PLATFORM_SPECIFIC;
#endif
    RB_ENTRY(knote)   kn_entries;
};

#define KNOTE_ENABLE(ent)           do {                            \
            (ent)->kev.flags &= ~EV_DISABLE;                        \
} while (0/*CONSTCOND*/)

#define KNOTE_DISABLE(ent)          do {                            \
            (ent)->kev.flags |=  EV_DISABLE;                        \
} while (0/*CONSTCOND*/)

struct filter {
    short     kf_id;

    /* filter operations */

    int     (*kf_init)(struct filter *);
    void    (*kf_destroy)(struct filter *);
    int     (*kf_copyout)(struct kevent *, struct knote *, void *);

    /* knote operations */

    int     (*kn_create)(struct filter *, struct knote *);
    int     (*kn_modify)(struct filter *, struct knote *,
                            const struct kevent *);
    int     (*kn_delete)(struct filter *, struct knote *);
    int     (*kn_enable)(struct filter *, struct knote *);
    int     (*kn_disable)(struct filter *, struct knote *);

    struct eventfd kf_efd;             /* Used by user.c */

    //MOVE TO POSIX?
    int       kf_pfd;                   /* fd to poll(2) for readiness */
    int       kf_wfd;                   /* fd to write when an event occurs */
    //----?

    struct evfilt_data *kf_data;	    /* filter-specific data */
    RB_HEAD(knt, knote) kf_knote;
    pthread_rwlock_t    kf_knote_mtx;
    struct kqueue      *kf_kqueue;
#if defined(FILTER_PLATFORM_SPECIFIC)
    FILTER_PLATFORM_SPECIFIC;
#endif
};

/* Use this to declare a filter that is not implemented */
#define EVFILT_NOTIMPL { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }

struct kqueue {
    int             kq_id;
    struct filter   kq_filt[EVFILT_SYSCOUNT];
    fd_set          kq_fds, kq_rfds;
    int             kq_nfds;
    tracing_mutex_t kq_mtx;
    volatile uint32_t kq_ref;
#if defined(KQUEUE_PLATFORM_SPECIFIC)
    KQUEUE_PLATFORM_SPECIFIC;
#endif
    RB_ENTRY(kqueue) entries;
};

struct kqueue_vtable {
    int  (*kqueue_init)(struct kqueue *);
    void (*kqueue_free)(struct kqueue *);
    // @param timespec can be given as timeout
    // @param int the number of events to wait for
    // @param kqueue the queue to wait on
	int  (*kevent_wait)(struct kqueue *, int, const struct timespec *);
    // @param kqueue the queue to look at
    // @param int The number of events that should be ready
    // @param kevent the structure to copy the events into
    // @param int The number of events to copy
    // @return the actual number of events copied
    int  (*kevent_copyout)(struct kqueue *, int, struct kevent *, int);
    int  (*filter_init)(struct kqueue *, struct filter *);
    void (*filter_free)(struct kqueue *, struct filter *);
    int  (*eventfd_init)(struct eventfd *);
    void (*eventfd_close)(struct eventfd *);
    int  (*eventfd_raise)(struct eventfd *);
    int  (*eventfd_lower)(struct eventfd *);
    int  (*eventfd_descriptor)(struct eventfd *);
};
extern const struct kqueue_vtable kqops;

/*
 * kqueue internal API
 */
#define kqueue_lock(kq)     tracing_mutex_lock(&(kq)->kq_mtx)
#define kqueue_unlock(kq)   tracing_mutex_unlock(&(kq)->kq_mtx)

/*
 * knote internal API
 */
struct knote * knote_lookup(struct filter *, uintptr_t);
//DEADWOOD: struct knote * knote_get_by_data(struct filter *filt, intptr_t);
struct knote * knote_new(void);
#define knote_retain(kn) atomic_inc(&kn->kn_ref)
void knote_release(struct knote *);
void knote_insert(struct filter *, struct knote *);
int  knote_delete(struct filter *, struct knote *);
int  knote_init(void);
int  knote_disable(struct filter *, struct knote *);
#define knote_get_filter(knt) &((knt)->kn_kq->kq_filt[(knt)->kev.filter])

int         filter_lookup(struct filter **, struct kqueue *, short);
int      	filter_register_all(struct kqueue *);
void     	filter_unregister_all(struct kqueue *);
const char *filter_name(short);

int         kevent_wait(struct kqueue *, const struct timespec *);
int         kevent_copyout(struct kqueue *, int, struct kevent *, int);
void 		kevent_free(struct kqueue *);
const char *kevent_dump(const struct kevent *);
struct kqueue * kqueue_lookup(int);
int         kqueue_validate(struct kqueue *);

struct map *map_new(size_t);
int         map_insert(struct map *, int, void *);
int         map_remove(struct map *, int, void *);
int         map_replace(struct map *, int, void *, void *);
void       *map_lookup(struct map *, int);
void       *map_delete(struct map *, int);
void        map_free(struct map *);

/* DEADWOOD: No longer needed due to the un-smerging of POSIX and Linux

int  posix_evfilt_user_init(struct filter *);
void posix_evfilt_user_destroy(struct filter *);
int  posix_evfilt_user_copyout(struct kevent *, struct knote *, void *ptr UNUSED);
int  posix_evfilt_user_knote_create(struct filter *, struct knote *);
int  posix_evfilt_user_knote_modify(struct filter *, struct knote *, const struct kevent *);
int  posix_evfilt_user_knote_delete(struct filter *, struct knote *);
int  posix_evfilt_user_knote_enable(struct filter *, struct knote *);
int  posix_evfilt_user_knote_disable(struct filter *, struct knote *);

*/

#endif  /* ! _KQUEUE_PRIVATE_H */


text:
<?php

namespace BaoPham\DynamoDb\Parsers;

class Placeholder
{
    /**
     * @var int
     */
    private $counter;

    public function __construct()
    {
        $this->reset();
    }

    public function next()
    {
        $this->counter += 1;
        return "a{$this->counter}";
    }

    public function reset()
    {
        $this->counter = 0;

        return $this;
    }
}


text:
<?
defined('C5_EXECUTE') or die("Access Denied.");
if (Loader::helper('validation/token')->validate('process')) {

	$js = Loader::helper('json');
	$obj = new stdClass;
	$pae = FileUploaderPermissionAccessEntity::getOrCreate();
	$obj->peID = $pae->getAccessEntityID();
	$obj->label = $pae->getAccessEntityLabel();
	print $js->encode($obj);

}


text:
program test

use spherical_splines

implicit none
real(8) :: h,d,h_ref
real(8),parameter :: tol = 0.001_8
integer :: iostatus

!  Read values from file with precomputed half-widths (radians) and values of h
open(10,file='half-width.text')

iostatus = 0
do while (iostatus == 0)
   read(10,*,iostat=iostatus) h_ref,d
   if (iostatus < 0) exit  ! EOF
   if (iostatus > 0) then
      write(0,'(a)') 'Problem reading file'
      stop
   endif
   h = sph_splines_AP_width2h(d)
   if (abs(h-h_ref) > tol) write(*,'(a,f0.5)') 'h and h_ref differ by more than ',tol
enddo

close(10)

end program test


text:
using System;

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

using AppStudio.Services;
using AppStudio.ViewModels;

namespace AppStudio.Views
{
    public sealed partial class VideosList : Page
    {
        private NavigationHelper _navigationHelper;

        public VideosList()
        {
            this.InitializeComponent();
            _navigationHelper = new NavigationHelper(this);

            VideosModel = new VideosViewModel();

            SizeChanged += OnSizeChanged;
        }

        public VideosViewModel VideosModel { get; private set; }

        public NavigationHelper NavigationHelper
        {
            get { return _navigationHelper; }
        }

        private void OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (e.NewSize.Width < 500)
            {
                VisualStateManager.GoToState(this, "SnappedView", true);
            }
            else
            {
                VisualStateManager.GoToState(this, "FullscreenView", true);
            }
        }

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _navigationHelper.OnNavigatedTo(e);
            await VideosModel.LoadItemsAsync();

            DataContext = this;
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            _navigationHelper.OnNavigatedFrom(e);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace OpenQA.Selenium.Interactions
{
    /// <summary>
    /// Represents a pause action.
    /// </summary>
    internal class PauseInteraction : Interaction
    {
        private TimeSpan duration = TimeSpan.Zero;

        /// <summary>
        /// Initializes a new instance of the <see cref="PauseInteraction"/> class.
        /// </summary>
        /// <param name="sourceDevice">The input device on which to execute the pause.</param>
        public PauseInteraction(InputDevice sourceDevice)
            : this(sourceDevice, TimeSpan.Zero)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PauseInteraction"/> class.
        /// </summary>
        /// <param name="sourceDevice">The input device on which to execute the pause.</param>
        /// <param name="duration">The length of time to pause for.</param>
        public PauseInteraction(InputDevice sourceDevice, TimeSpan duration)
            : base(sourceDevice)
        {
            if (duration < TimeSpan.Zero)
            {
                throw new ArgumentException("Duration must be greater than or equal to zero", nameof(duration));
            }

            this.duration = duration;
        }

        /// <summary>
        /// Returns a value for this action that can be transmitted across the wire to a remote end.
        /// </summary>
        /// <returns>A <see cref="Dictionary{TKey, TValue}"/> representing this action.</returns>
        public override Dictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> toReturn = new Dictionary<string, object>();

            toReturn["type"] = "pause";
            toReturn["duration"] = Convert.ToInt64(this.duration.TotalMilliseconds);

            return toReturn;
        }

        /// <summary>
        /// Gets a value indicating whether this action is valid for the specified type of input device.
        /// </summary>
        /// <param name="sourceDeviceKind">The type of device to check.</param>
        /// <returns><see langword="true"/> if the action is valid for the specified type of input device;
        /// otherwise, <see langword="false"/>.</returns>
        public override bool IsValidFor(InputDeviceKind sourceDeviceKind)
        {
            return true;
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "Pause [duration: {0} ms]", this.duration.TotalMilliseconds);
        }
    }
}


text:
package io.moquette.fce.model.configuration;

import com.google.gson.annotations.SerializedName;

/**
 * Enum which describes all available AdminPermissions.
 *
 * @author lants1
 *
 */
public enum AdminPermission {
	@SerializedName("NONE")
	NONE,
	@SerializedName("ALL")
	ALL;

}


text:
export
    avio_find_protocol_name,
    avio_check,
    avio_alloc_context,
    avio_w8,
    avio_write,
    avio_wl64,
    avio_wb64,
    avio_wl32,
    avio_wb32,
    avio_wl24,
    avio_wb24,
    avio_wl16,
    avio_wb16,
    avio_put_str,
    avio_put_str16le,
    avio_seek,
    avio_skip,
    avio_tell,
    avio_size,
    url_feof,
    avio_flush,
    avio_read,
    avio_r8,
    avio_rl16,
    avio_rl24,
    avio_rl32,
    avio_rl64,
    avio_rb16,
    avio_rb24,
    avio_rb32,
    avio_rb64,
    avio_get_str,
    avio_get_str16le,
    avio_get_str16be,
    avio_open,
    avio_open2,
    avio_close,
    avio_closep,
    avio_open_dyn_buf,
    avio_close_dyn_buf,
    avio_enum_protocols,
    avio_pause,
    avio_seek_time

function avio_find_protocol_name(url)
    ccall((:avio_find_protocol_name,libavformat),Ptr{Uint8},(Ptr{Uint8},),url)
end

function avio_check(url,flags::Integer)
    ccall((:avio_check,libavformat),Cint,(Ptr{Uint8},Cint),url,flags)
end

function avio_alloc_context(buffer,buffer_size::Integer,write_flag::Integer,opaque,read_packet,write_packet,seek)
    ccall((:avio_alloc_context,libavformat),Ptr{AVIOContext},(Ptr{Cuchar},Cint,Cint,Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void}),buffer,buffer_size,write_flag,opaque,read_packet,write_packet,seek)
end

function avio_w8(s,b::Integer)
    ccall((:avio_w8,libavformat),Void,(Ptr{AVIOContext},Cint),s,b)
end

function avio_write(s,buf,size::Integer)
    ccall((:avio_write,libavformat),Void,(Ptr{AVIOContext},Ptr{Cuchar},Cint),s,buf,size)
end

function avio_wl64(s,val::Uint64)
    ccall((:avio_wl64,libavformat),Void,(Ptr{AVIOContext},Uint64),s,val)
end

function avio_wb64(s,val::Uint64)
    ccall((:avio_wb64,libavformat),Void,(Ptr{AVIOContext},Uint64),s,val)
end

function avio_wl32(s,val::Integer)
    ccall((:avio_wl32,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_wb32(s,val::Integer)
    ccall((:avio_wb32,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_wl24(s,val::Integer)
    ccall((:avio_wl24,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_wb24(s,val::Integer)
    ccall((:avio_wb24,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_wl16(s,val::Integer)
    ccall((:avio_wl16,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_wb16(s,val::Integer)
    ccall((:avio_wb16,libavformat),Void,(Ptr{AVIOContext},Uint32),s,val)
end

function avio_put_str(s,str)
    ccall((:avio_put_str,libavformat),Cint,(Ptr{AVIOContext},Ptr{Uint8}),s,str)
end

function avio_put_str16le(s,str)
    ccall((:avio_put_str16le,libavformat),Cint,(Ptr{AVIOContext},Ptr{Uint8}),s,str)
end

function avio_seek(s,offset::Int64,whence::Integer)
    ccall((:avio_seek,libavformat),Int64,(Ptr{AVIOContext},Int64,Cint),s,offset,whence)
end

function avio_skip(s,offset::Int64)
    ccall((:avio_skip,libavformat),Int64,(Ptr{AVIOContext},Int64),s,offset)
end

function avio_tell(s)
    ccall((:avio_tell,libavformat),Int64,(Ptr{AVIOContext},),s)
end

function avio_size(s)
    ccall((:avio_size,libavformat),Int64,(Ptr{AVIOContext},),s)
end

function url_feof(s)
    ccall((:url_feof,libavformat),Cint,(Ptr{AVIOContext},),s)
end

function avio_flush(s)
    ccall((:avio_flush,libavformat),Void,(Ptr{AVIOContext},),s)
end

function avio_read(s,buf,size::Integer)
    ccall((:avio_read,libavformat),Cint,(Ptr{AVIOContext},Ptr{Cuchar},Cint),s,buf,size)
end

function avio_r8(s)
    ccall((:avio_r8,libavformat),Cint,(Ptr{AVIOContext},),s)
end

function avio_rl16(s)
    ccall((:avio_rl16,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rl24(s)
    ccall((:avio_rl24,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rl32(s)
    ccall((:avio_rl32,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rl64(s)
    ccall((:avio_rl64,libavformat),Uint64,(Ptr{AVIOContext},),s)
end

function avio_rb16(s)
    ccall((:avio_rb16,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rb24(s)
    ccall((:avio_rb24,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rb32(s)
    ccall((:avio_rb32,libavformat),Uint32,(Ptr{AVIOContext},),s)
end

function avio_rb64(s)
    ccall((:avio_rb64,libavformat),Uint64,(Ptr{AVIOContext},),s)
end

function avio_get_str(pb,maxlen::Integer,buf,buflen::Integer)
    ccall((:avio_get_str,libavformat),Cint,(Ptr{AVIOContext},Cint,Ptr{Uint8},Cint),pb,maxlen,buf,buflen)
end

function avio_get_str16le(pb,maxlen::Integer,buf,buflen::Integer)
    ccall((:avio_get_str16le,libavformat),Cint,(Ptr{AVIOContext},Cint,Ptr{Uint8},Cint),pb,maxlen,buf,buflen)
end

function avio_get_str16be(pb,maxlen::Integer,buf,buflen::Integer)
    ccall((:avio_get_str16be,libavformat),Cint,(Ptr{AVIOContext},Cint,Ptr{Uint8},Cint),pb,maxlen,buf,buflen)
end

function avio_open(s,url,flags::Integer)
    ccall((:avio_open,libavformat),Cint,(Ptr{Ptr{AVIOContext}},Ptr{Uint8},Cint),s,url,flags)
end

function avio_open2(s,url,flags::Integer,int_cb,options)
    ccall((:avio_open2,libavformat),Cint,(Ptr{Ptr{AVIOContext}},Ptr{Uint8},Cint,Ptr{AVIOInterruptCB},Ptr{Ptr{AVDictionary}}),s,url,flags,int_cb,options)
end

function avio_close(s)
    ccall((:avio_close,libavformat),Cint,(Ptr{AVIOContext},),s)
end

function avio_closep(s)
    ccall((:avio_closep,libavformat),Cint,(Ptr{Ptr{AVIOContext}},),s)
end

function avio_open_dyn_buf(s)
    ccall((:avio_open_dyn_buf,libavformat),Cint,(Ptr{Ptr{AVIOContext}},),s)
end

function avio_close_dyn_buf(s,pbuffer)
    ccall((:avio_close_dyn_buf,libavformat),Cint,(Ptr{AVIOContext},Ptr{Ptr{Uint8}}),s,pbuffer)
end

function avio_enum_protocols(opaque,output::Integer)
    ccall((:avio_enum_protocols,libavformat),Ptr{Uint8},(Ptr{Ptr{Void}},Cint),opaque,output)
end

function avio_pause(h,pause::Integer)
    ccall((:avio_pause,libavformat),Cint,(Ptr{AVIOContext},Cint),h,pause)
end

function avio_seek_time(h,stream_index::Integer,timestamp::Int64,flags::Integer)
    ccall((:avio_seek_time,libavformat),Int64,(Ptr{AVIOContext},Cint,Int64,Cint),h,stream_index,timestamp,flags)
end


text:
    Geben Sie eine Liste von Jobnamen an. Mehrere Namen können mit einem Komma
    getrennt werden, z.B. "<tt>foo, bar</tt>".


text:
from pysmt.shortcuts import Symbol, Int, And, GE, LE, LT
from pysmt.typing import INT

# x86_64 BarrelfishOS user-space system call argument conventions
machine_description = lambda regs: And(
    # each register in regs has to be loaded from user stack
    And(reg.has_valid_stack_slot() for reg in regs.values()),

    # x86 syscall callframe load dependency graph
    regs['%rcx'].precedes(regs['%r11']),
    regs['%r11'].precedes(regs['%rbx']),
    regs['%rbx'].precedes(regs['%rbp']),
    regs['%rbp'].precedes(regs['%rax']),
    regs['%rax'].precedes(regs['%r15']),
    regs['%rax'].precedes(regs['%r15']),
    regs['%r15'].precedes(regs['%r14']),
    regs['%r14'].precedes(regs['%r13']),
    regs['%r13'].precedes(regs['%r12']),
    regs['%r12'].precedes(regs['%r9']),
    regs['%r9'].precedes(regs['%r8']),
    regs['%r8'].precedes(regs['%r10']),
)

class X86StackRegister(object):
    """
    An X86StackRegister is a logical atom. It stores a mapping a from x86_64
    register name to an slot index into the user-space stack arguments loaded into
    the kernel stack in a system call handler.
    """

    stack = range(0, 12)

    register_names = [
        '%r10', '%r11', '%r12', '%r13', '%r14', '%r15', '%r8', '%r9', '%rax', '%rbp',
        '%rbx', '%rcx'
    ]

    def __init__(self, name):
        assert name in X86StackRegister.register_names
        self.name = name
        self.sym = Symbol(name, INT)

    # condition: is a register that needs to be loaded from user-space stack
    def has_valid_stack_slot(self):
	return And(GE(self.sym, Int(min(self.stack))),
		   LE(self.sym, Int(max(self.stack))))

    # condition: needs to be loaded from user-space stack before register
    def precedes(self, register):
        return LT(self.sym, register.sym)

    def pushq(self):
        return '    pushq  %s' % (self.name)

    @classmethod
    def get_stack_registers(cls):
        return {name: cls(name) for name in cls.register_names}

    def get_stack_index(self, model):
        return model.get_py_value(self.sym)

    @classmethod
    def pushqs(cls, registers):
        asm = '\n'.join([reg.pushq() for reg in registers])
        block = '/* SYNTHESIZED_%s */\n'
        asm = block % 'START' + asm  + '\n' + block % 'END'
        print '    ' + asm.replace('\n', '\n    ')
        return asm


text:
package com.thoughtworks.go.server.service;

import java.io.File;

import com.thoughtworks.go.config.AgentConfig;
import com.thoughtworks.go.domain.AgentRuntimeStatus;
import com.thoughtworks.go.remote.AgentIdentifier;
import com.thoughtworks.go.util.SystemEnvironment;
import org.apache.commons.io.FileUtils;
import org.hamcrest.core.Is;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

public class AgentRuntimeInfoTest {
    private static final int OLD_IDX = 0;
    private static final int NEW_IDX = 1;
    private File pipelinesFolder;

    @Before public void setup() throws Exception {
        pipelinesFolder = new File("pipelines");
        pipelinesFolder.mkdirs();
    }

    @After public void teardown() throws Exception {
        FileUtils.deleteQuietly(pipelinesFolder);
    }

    @Test(expected = Exception.class)
    public void should() throws Exception {
        AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "127.0.0.1"), false, "", 0L, "linux");
    }

    @Test
    public void shouldUsingIdleWhenRegistrationRequestIsFromLocalAgent() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(
                new AgentConfig("uuid", "localhost", "127.0.0.1"), false, "/var/lib", 0L, "linux");

        assertThat(agentRuntimeInfo.getRuntimeStatus(), Is.is(AgentRuntimeStatus.Idle));
    }

    @Test
    public void shouldBeUnknownWhenRegistrationRequestIsFromLocalAgent() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(
                new AgentConfig("uuid", "localhost", "176.19.4.1"), false, "/var/lib", 0L, "linux");

        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Unknown));
    }

    @Test
    public void shouldUsingIdleWhenRegistrationRequestIsFromAlreadyRegisteredAgent() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(
                new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");

        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
    }

    @Test
    public void shouldNotifyStatusChangeListenerOnStatusUpdate() {
        final AgentRuntimeStatus[] oldAndNewStatus = new AgentRuntimeStatus[2];
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");

        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
        assertThat(oldAndNewStatus[OLD_IDX], is(nullValue()));
        agentRuntimeInfo.setRuntimeStatus(AgentRuntimeStatus.Building, new AgentRuntimeStatus.ChangeListener() {
            public void statusUpdateRequested(AgentRuntimeInfo runtimeInfo, AgentRuntimeStatus newStatus) {
                oldAndNewStatus[OLD_IDX] = runtimeInfo.getRuntimeStatus();
                oldAndNewStatus[NEW_IDX] = newStatus;
            }
        });
        assertThat(oldAndNewStatus[OLD_IDX], is(AgentRuntimeStatus.Idle));
        assertThat(oldAndNewStatus[NEW_IDX], is(AgentRuntimeStatus.Building));
        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Building));
    }

    @Test
    public void shouldNotUpdateStatusWhenOldValueIsEqualToNewValue() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");

        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
        AgentRuntimeStatus.ChangeListener listener = mock(AgentRuntimeStatus.ChangeListener.class);
        agentRuntimeInfo.setRuntimeStatus(AgentRuntimeStatus.Idle, listener);
        verify(listener, never()).statusUpdateRequested(any(AgentRuntimeInfo.class), any(AgentRuntimeStatus.class));
        assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
    }

    @Test
    public void shouldNotMatchRuntimeInfosWithDifferentOperatingSystems() {
        AgentRuntimeInfo linux = AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");
        AgentRuntimeInfo osx = AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "foo bar");
        assertThat(linux, is(not(osx)));
    }

    @Test
    public void shouldInitializeTheFreeSpaceAtAgentSide() {
        AgentIdentifier id = new AgentConfig("uuid", "localhost", "176.19.4.1").getAgentIdentifier();
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromAgent(id, "cookie", null);

        assertThat(agentRuntimeInfo.getUsableSpace(), is(not(0L)));
    }

    @Test
    public void shouldNotBeLowDiskSpaceForMissingAgent(){
        assertThat(AgentRuntimeInfo.initialState(new AgentConfig("uuid")).isLowDiskSpace(10L), is(false));
    }

    @Test
    public void shouldReturnTrueIfUsableSpaceLessThanLimit(){
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.initialState(new AgentConfig("uuid"));
        agentRuntimeInfo.setUsableSpace(10L);
        assertThat(agentRuntimeInfo.isLowDiskSpace(20L), is(true));
    }

    @Test
    public void shouldUnderstandOperatingSystem() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "abc"), "cookie", null);
        assertThat(agentRuntimeInfo.getOperatingSystem(), is(new SystemEnvironment().getOperatingSystemName()));
    }

    @Test
    public void shouldHaveRelevantFieldsInDebugString() throws Exception {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), "cookie", null);
        assertThat(agentRuntimeInfo.agentInfoDebugString(), is("Agent [localhost, 127.0.0.1, uuid, cookie]"));
    }

    @Test
    public void shouldHaveBeautifulPhigureLikeDisplayString() throws Exception {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), "cookie", null);
        agentRuntimeInfo.setLocation("/nim/appan/mane");
        assertThat(agentRuntimeInfo.agentInfoForDisplay(), is("Agent located at [localhost, 127.0.0.1, /nim/appan/mane]"));
    }

    @Test
    public void shouldTellIfHasCookie() throws Exception {
        assertThat(AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), "cookie", null).hasDuplicateCookie("cookie"), is(false));
        assertThat(AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), "cookie", null).hasDuplicateCookie("different"), is(true));
        assertThat(AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), null, null).hasDuplicateCookie("cookie"), is(false));
        assertThat(AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), "cookie", null).hasDuplicateCookie(null), is(false));
    }

    @Test
    public void shouldUpdateSelfForAnIdleAgent() {
        AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromAgent(new AgentIdentifier("localhost", "127.0.0.1", "uuid"));
        AgentRuntimeInfo newRuntimeInfo = AgentRuntimeInfo.fromAgent(new AgentIdentifier("go02", "10.10.10.1", "uuid"), "cookie", "12.3");
        newRuntimeInfo.setBuildingInfo(new AgentBuildingInfo("Idle",""));
        newRuntimeInfo.setLocation("home");
        newRuntimeInfo.setUsableSpace(10L);
        newRuntimeInfo.setOperatingSystem("Linux");

        agentRuntimeInfo.updateSelf(newRuntimeInfo);

        assertThat(agentRuntimeInfo.getBuildingInfo(), is(newRuntimeInfo.getBuildingInfo()));
        assertThat(agentRuntimeInfo.getLocation(), is(newRuntimeInfo.getLocation()));
        assertThat(agentRuntimeInfo.getUsableSpace(), is(newRuntimeInfo.getUsableSpace()));
        assertThat(agentRuntimeInfo.getOperatingSystem(), is(newRuntimeInfo.getOperatingSystem()));
        assertThat(agentRuntimeInfo.getAgentLauncherVersion(), is(newRuntimeInfo.getAgentLauncherVersion()));
    }
}


text:
try:
    from waterbutler import settings
except ImportError:
    settings = {}

config = settings.get('BOX_PROVIDER_CONFIG', {})

BASE_URL = config.get('BASE_URL', 'https://api.box.com/2.0')
BASE_UPLOAD_URL = config.get('BASE_CONTENT_URL', 'https://upload.box.com/api/2.0')


text:
package v2ch11.composite;

import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;

/**
 * This component draws two shapes, composed with a composition rule.
 */
class CompositeComponent extends JComponent
{
   private int rule;
   private Shape shape1;
   private Shape shape2;
   private float alpha;

   public CompositeComponent()
   {
      shape1 = new Ellipse2D.Double(100, 100, 150, 100);
      shape2 = new Rectangle2D.Double(150, 150, 150, 100);
   }

   public void paintComponent(Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;

      BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
      Graphics2D gImage = image.createGraphics();
      gImage.setPaint(Color.red);
      gImage.fill(shape1);
      AlphaComposite composite = AlphaComposite.getInstance(rule, alpha);
      gImage.setComposite(composite);
      gImage.setPaint(Color.blue);
      gImage.fill(shape2);
      g2.drawImage(image, null, 0, 0);
   }

   /**
    * Sets the composition rule.
    * @param r the rule (as an AlphaComposite constant)
    */
   public void setRule(int r)
   {
      rule = r;
      repaint();
   }

   /**
    * Sets the alpha of the source.
    * @param a the alpha value between 0 and 100
    */
   public void setAlpha(int a)
   {
      alpha = (float) a / 100.0F;
      repaint();
   }
}


text:
#import "ZJMineController.h"
#import "WifeButlerNetWorking.h"
#import "WifeButlerHomeTableHeaderView.h"
#import "WifeButlerDefine.h"
#import "PersonalPort.h"
//跳转控制器
#import "ZTHuiZhuanDingDan1ViewController.h"
#import "UserQRViewController.h"
#import "WifeButlerSettingViewController.h"
#import "ZTPersonGouWuCheViewController.h"
#import "ZTGuangYuMyViewController.h"
#import "ZTYiJianFanKuiViewController.h"
#import "BalanceViewController.h"
#import "CardPocketListViewController.h"
#import "ZTYouHuiJuanViewController.h"
#import "ScoreViewController.h"
#import "ZJGuangLiShouHuoDiZhiViewController.h"
#import "ZTDuiHuanDingDanViewController.h"
#import "ZTBianJiZiliaoTableViewController.h"
#import "MJRefresh.h"

@class WifeButlerHomeCircleButton;

@interface ZJMineController ()
/**头像*/
@property (weak, nonatomic) IBOutlet UIImageView *userIconView;
/**用户姓名*/
@property (weak, nonatomic) IBOutlet UIButton *nameLabel;
/**用户等级*/
@property (weak, nonatomic) IBOutlet UILabel *levelLabel;

/**用户余额*/
@property (weak, nonatomic) IBOutlet UIButton *userMoney;

/**用户积分*/
@property (weak, nonatomic) IBOutlet UIButton *userScore;
/**用户卡包*/
@property (weak, nonatomic) IBOutlet UIButton *userCardPocket;
/**优惠券*/
@property (weak, nonatomic) IBOutlet UIButton *userDiscountCoupon;

/**底部view*/
@property (weak, nonatomic) IBOutlet UIView *bottomContentView;
@property (weak, nonatomic) IBOutlet UIScrollView *backScrollView;

@end

@implementation ZJMineController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.initBottomUI().listenNotification().GetLocalData().GetHttpData();
}
#pragma mark - 初始化UI
- (ZJMineController * (^)())initBottomUI{

    return ^{

        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"personNoti"] style:UIBarButtonItemStylePlain target:self action:@selector(usermsgclick)];

        //头像处理
        self.userIconView.layer.cornerRadius = 30;
        self.userIconView.layer.borderWidth = 1;
        self.userIconView.layer.borderColor = WifeButlerTableBackGaryColor.CGColor;
        self.userIconView.clipsToBounds = YES;
        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headerClick)];
        [self.userIconView addGestureRecognizer:tap];

        NSArray * titleArray = @[@"积分兑换",@"购物车",@"地址管理",@"我要开店",@"意见反馈",@"我的客服",@"关于我们",@"设置"];
        NSArray * imageNameArray = @[@"numberConversion",@"shopingCart",@"locationManage",@"setupShop",@"PersonFeedBack",@"MyService",@"aboutUs",@"personSetting"];

        CGFloat btnW = 50;
        CGFloat btnH = 60;
        CGFloat margin = (iphoneWidth - 4*btnW)/5;
        CGFloat Hmargin = (self.bottomContentView.height - 2* btnH)/3;
        for (int i = 0; i<8; i++) {
            int row = i/4;
            int cloum = i%4;
            WifeButlerHomeCircleButton * button = [[WifeButlerHomeCircleButton alloc]initWithImageName:imageNameArray[i]  andtitle:titleArray[i]];

            button.tag = i+2017;
            [button addTarget:self action:@selector(roundButtonClick:) forControlEvents:UIControlEventTouchUpInside];
            button.frame = CGRectMake(margin + cloum *(btnW+margin), Hmargin + row * (btnH + Hmargin), btnW, btnH);
            [self.bottomContentView addSubview:button];
        }

        WEAKSELF
        self.backScrollView.mj_header = [MJRefreshHeader headerWithRefreshingBlock:^{

            weakSelf.GetLocalData().GetHttpData();
        }];
        return self;
    };
}
#pragma mark- 监听通知
- (ZJMineController * (^)())listenNotification{

    return ^{
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(regetData) name:LoginViewControllerDidLoginSuccessNotification object:nil];

        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(userLogOut) name:WifeButlerUserDidLogOutNotification object:nil];

        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getCurrentUserData) name:UserDataDidFinishUpDate object:nil];

        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(regetData) name:UserImportantInfoDidSuccessChangeNotification object:nil];
        return self;
    };
}
#pragma mark - 资产点击事件
/**余额点击*/
- (IBAction)balanceClick {
    WifeButlerLetUserLoginCode

    BalanceViewController * b = [[BalanceViewController alloc]init];
    [self.navigationController pushViewController:b animated:YES];
}
/**积分点击*/
- (IBAction)scoreClick {
    WifeButlerLetUserLoginCode

    ScoreViewController *vc = [[ScoreViewController alloc]init];
    vc.scoreTxt = self.userScore.titleLabel.text;
    [self.navigationController pushViewController:vc animated:YES];
}
/**卡包点击*/
- (IBAction)cardPocketClick {
    WifeButlerLetUserLoginCode

    CardPocketListViewController * p = [[CardPocketListViewController alloc]init];
    [self.navigationController pushViewController:p animated:YES];
}
/**优惠券点击*/
- (IBAction)couponClick {
    WifeButlerLetUserLoginCode

    UIStoryboard * sb = [UIStoryboard storyboardWithName:@"ZJMineController" bundle:nil];
        ZTYouHuiJuanViewController * vc = [sb instantiateViewControllerWithIdentifier:@"ZTYouHuiJuanViewController"];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - 8个圆形按钮点击事件
- (void)roundButtonClick:(UIButton *)button
{
    NSUInteger index = button.tag - 2017;
    WifeButlerLetUserLoginCode
    switch (index) {

        case 0:{ //兑换订单
            UIStoryboard * sb = [UIStoryboard storyboardWithName:@"ZTDuiHuanDingDan" bundle:nil];
            ZTDuiHuanDingDanViewController * vc = [sb instantiateViewControllerWithIdentifier:@"ZTDuiHuanDingDanViewController"];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 1:{ //购物车

            UIStoryboard *sb = [UIStoryboard storyboardWithName:@"ZTGouWuChe" bundle:nil];
            ZTPersonGouWuCheViewController *vc = [sb instantiateViewControllerWithIdentifier:@"ZTPersonGouWuCheViewController"];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:{ //地址管理
            ZJGuangLiShouHuoDiZhiViewController * dizhi = [[ZJGuangLiShouHuoDiZhiViewController alloc]init];
            [self.navigationController pushViewController:dizhi animated:YES];
        }
            break;
        case 3:{ //我要开店
            [SVProgressHUD showInfoWithStatus:@"开店请联系客服.."];
        }
            break;
        case 4:{//意见反馈
            ZTYiJianFanKuiViewController * fankui = [[ZTYiJianFanKuiViewController alloc]init];
            [self.navigationController pushViewController:fankui animated:YES];
        }
            break;
        case 5:{ //打电话给客服
            D_CommonAlertShow(@"确定要拨打客服电话吗",^{

                NSString * str = @"telprompt://01051921371";
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
            });
        }
            //01051921371
            break;
        case 6:{
            ZTGuangYuMyViewController * guanYU = [[ZTGuangYuMyViewController alloc]init];
            [self.navigationController pushViewController:guanYU animated:YES];
        }
            break;
        case 7:{ //设置
            WifeButlerSettingViewController * setting = [WifeButlerSettingViewController new];
            [self.navigationController pushViewController:setting animated:YES];
        }
            break;

        default:
            break;
    }
}
#pragma mark - 头部点击
/**姓名点击*/
- (IBAction)nameClick:(UIButton *)sender {

    if([WifeButlerAccount sharedAccount].isLogin) return;

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"ZJLogin" bundle:nil];
    ZJLoginController *vc = [sb instantiateViewControllerWithIdentifier:@"ZJLoginController"];
    vc.isLogo = YES;
    [self.navigationController pushViewController:vc animated:YES];
}
/**点击头像*/
- (void)headerClick
{
    if(![WifeButlerAccount sharedAccount].isLogin) return; //没有登录不处理
    UIStoryboard * sb = [UIStoryboard storyboardWithName:@"ZTBianJiInfo" bundle:nil];
    ZTBianJiZiliaoTableViewController * vc = [sb instantiateViewControllerWithIdentifier:@"ZTBianJiZiliaoTableViewController"];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - 获取个人数据
- (ZJMineController * (^)())GetLocalData
{
    return ^{

        [self getCurrentUserData];

        return self;
    };
}

/**获取个人网络数据*/
- (ZJMineController * (^)())GetHttpData
{
    return ^{
        if ([WifeButlerAccount sharedAccount].isLogin) {

            WifeButlerUserParty * party = [WifeButlerAccount sharedAccount].userParty;
            NSMutableDictionary * parm = [NSMutableDictionary dictionary];
            parm[@"userid"] = party.Id;
            parm[@"token"] = party.token_app;
            [WifeButlerNetWorking postPackagingHttpRequestWithURLsite:KUserPocket parameter:parm success:^(NSDictionary * resultCode) {

                NSLog(@"%@",resultCode);

                [self.userCardPocket setTitle:resultCode[@"bankcardnum"]forState:UIControlStateNormal] ;
                [self.userScore setTitle:resultCode[@"integrals"] forState:UIControlStateNormal] ;
                [self.userMoney setTitle: [NSString stringWithFormat:@"¥%@",resultCode[@"money"]] forState:UIControlStateNormal];
                [self.userDiscountCoupon setTitle:[NSString stringWithFormat:@"%@", resultCode[@"voucher"]]  forState:UIControlStateNormal] ;

                [self.backScrollView.mj_header endRefreshing];
            } failure:^(NSError *error) {
                [self.backScrollView.mj_header endRefreshing];
                SVDCommonErrorDeal
            }];
        }

        return self;
    };
}

#pragma mark - 按钮事件
- (IBAction)orderClick {

    WifeButlerLetUserLoginCode
    UIStoryboard * story = [UIStoryboard storyboardWithName:@"ZTHuiZhuanDingDan" bundle:nil];
    ZTHuiZhuanDingDan1ViewController * vc = [story instantiateViewControllerWithIdentifier:@"ZTHuiZhuanDingDan1ViewController"];
    [self.navigationController pushViewController:vc animated:YES];

}
- (IBAction)QRClick {
    WifeButlerLetUserLoginCode
    WifeButlerUserParty * party = [WifeButlerAccount sharedAccount].userParty;
    if (party.defaultAddress.length == 0) {
        [SVProgressHUD showInfoWithStatus:@"请添加默认收货地址"];
        return;
    }
    UserQRViewController *qrVc = [[UserQRViewController alloc]init];
    [self.navigationController pushViewController:qrVc animated:YES];
}

#pragma mark - 通知Notification
- (void)userLogOut
{
    self.GetLocalData();
}

- (void)regetData
{
    self.GetLocalData().GetHttpData();
}

- (void)getCurrentUserData
{
    WifeButlerUserParty * party = [WifeButlerAccount sharedAccount].userParty;
    if (![WifeButlerAccount sharedAccount].isLogin) {

        [self.nameLabel setTitle:@"登录/注册" forState:UIControlStateNormal];
        self.levelLabel.text = @"";
        self.userIconView.image = [UIImage imageNamed:@"placeHolderIcon"];
        [self.userCardPocket setTitle:@"0" forState:UIControlStateNormal] ;
        [self.userScore setTitle:@"0" forState:UIControlStateNormal] ;
        [self.userMoney setTitle:@"¥0" forState:UIControlStateNormal];
        [self.userDiscountCoupon setTitle:@"0"forState:UIControlStateNormal] ;

    }else{
        [self.nameLabel setTitle:party.nickname forState:UIControlStateNormal];
        self.levelLabel.text = @"环保达人";
        NSString * iconStr = [KImageUrl stringByAppendingString:party.avatar];
        [self.userIconView sd_setImageWithURL:[NSURL URLWithString:iconStr] placeholderImage:[UIImage imageNamed:@"placeHolderIcon"]];
    }
}

- (void)usermsgclick
{

}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter]removeObserver:self];
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="horizontal"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_weight="1"
        tools:text="0"
        android:textSize="40sp"
        android:textColor="@android:color/white"
        android:background="@color/colorPrimary"
        android:gravity="center"
        android:padding="20dp"
        android:typeface="monospace"
        android:id="@+id/textView1" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_weight="1"
        tools:text="0"
        android:textSize="40sp"
        android:textColor="@android:color/white"
        android:background="@color/colorAccent"
        android:gravity="center"
        android:padding="20dp"
        android:visibility="invisible"
        android:typeface="monospace"
        android:id="@+id/textView2" />

</LinearLayout>


text:
MathJax.Localization.addTranslation("ia","TeX",{
        version: "2.7.9",
        isLoaded: true,
        strings: {

        }
});

MathJax.Ajax.loadComplete("[MathJax]/localization/ia/TeX.js");


text:
class IOThread;

namespace net {
class IOBuffer;
}

namespace extensions {

class Socket;

// A simple interface to ApiResourceManager<Socket> or derived class. The goal
// of this interface is to allow Socket API functions to use distinct instances
// of ApiResourceManager<> depending on the type of socket (old version in
// "socket" namespace vs new version in "socket.xxx" namespaces).
class SocketResourceManagerInterface {
 public:
  virtual ~SocketResourceManagerInterface() {}

  virtual bool SetProfile(Profile* profile) = 0;
  virtual int Add(Socket *socket) = 0;
  virtual Socket* Get(const std::string& extension_id,
                      int api_resource_id) = 0;
  virtual void Remove(const std::string& extension_id,
                      int api_resource_id) = 0;
  virtual base::hash_set<int>* GetResourceIds(
      const std::string& extension_id) = 0;
};

// Implementation of SocketResourceManagerInterface using an
// ApiResourceManager<T> instance (where T derives from Socket).
template<typename T>
class SocketResourceManager : public SocketResourceManagerInterface {
 public:
  SocketResourceManager()
      : manager_(NULL) {
  }

  virtual bool SetProfile(Profile* profile) OVERRIDE {
    manager_ = ApiResourceManager<T>::Get(profile);
    DCHECK(manager_) << "There is no socket manager. "
      "If this assertion is failing during a test, then it is likely that "
      "TestExtensionSystem is failing to provide an instance of "
      "ApiResourceManager<Socket>.";
    return manager_ != NULL;
  }

  virtual int Add(Socket *socket) OVERRIDE {
    // Note: Cast needed here, because "T" may be a subclass of "Socket".
    return manager_->Add(static_cast<T*>(socket));
  }

  virtual Socket* Get(const std::string& extension_id,
                      int api_resource_id) OVERRIDE {
    return manager_->Get(extension_id, api_resource_id);
  }

  virtual void Remove(const std::string& extension_id,
                      int api_resource_id) OVERRIDE {
    manager_->Remove(extension_id, api_resource_id);
  }

  virtual base::hash_set<int>* GetResourceIds(
      const std::string& extension_id) OVERRIDE {
    return manager_->GetResourceIds(extension_id);
  }

 private:
  ApiResourceManager<T>* manager_;
};

class SocketAsyncApiFunction : public AsyncApiFunction {
 public:
  SocketAsyncApiFunction();

 protected:
  virtual ~SocketAsyncApiFunction();

  // AsyncApiFunction:
  virtual bool PrePrepare() OVERRIDE;
  virtual bool Respond() OVERRIDE;

  virtual scoped_ptr<SocketResourceManagerInterface>
      CreateSocketResourceManager();

  int AddSocket(Socket* socket);
  Socket* GetSocket(int api_resource_id);
  void RemoveSocket(int api_resource_id);
  base::hash_set<int>* GetSocketIds();

 private:
  scoped_ptr<SocketResourceManagerInterface> manager_;
};

class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction {
 protected:
  SocketExtensionWithDnsLookupFunction();
  virtual ~SocketExtensionWithDnsLookupFunction();

  void StartDnsLookup(const std::string& hostname);
  virtual void AfterDnsLookup(int lookup_result) = 0;

  std::string resolved_address_;

 private:
  void OnDnsLookup(int resolve_result);

  // This instance is widely available through BrowserProcess, but we need to
  // acquire it on the UI thread and then use it on the IO thread, so we keep a
  // plain pointer to it here as we move from thread to thread.
  IOThread* io_thread_;

  scoped_ptr<net::HostResolver::RequestHandle> request_handle_;
  scoped_ptr<net::AddressList> addresses_;
};

class SocketCreateFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.create", SOCKET_CREATE)

  SocketCreateFunction();

 protected:
  virtual ~SocketCreateFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  FRIEND_TEST_ALL_PREFIXES(SocketUnitTest, Create);
  enum SocketType {
    kSocketTypeInvalid = -1,
    kSocketTypeTCP,
    kSocketTypeUDP
  };

  scoped_ptr<api::socket::Create::Params> params_;
  SocketType socket_type_;
};

class SocketDestroyFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.destroy", SOCKET_DESTROY)

 protected:
  virtual ~SocketDestroyFunction() {}

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  int socket_id_;
};

class SocketConnectFunction : public SocketExtensionWithDnsLookupFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.connect", SOCKET_CONNECT)

  SocketConnectFunction();

 protected:
  virtual ~SocketConnectFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;

  // SocketExtensionWithDnsLookupFunction:
  virtual void AfterDnsLookup(int lookup_result) OVERRIDE;

 private:
  void StartConnect();
  void OnConnect(int result);

  int socket_id_;
  std::string hostname_;
  int port_;
  Socket* socket_;
};

class SocketDisconnectFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.disconnect", SOCKET_DISCONNECT)

 protected:
  virtual ~SocketDisconnectFunction() {}

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  int socket_id_;
};

class SocketBindFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.bind", SOCKET_BIND)

 protected:
  virtual ~SocketBindFunction() {}

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  int socket_id_;
  std::string address_;
  int port_;
};

class SocketListenFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.listen", SOCKET_LISTEN)

  SocketListenFunction();

 protected:
  virtual ~SocketListenFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::Listen::Params> params_;
};

class SocketAcceptFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.accept", SOCKET_ACCEPT)

  SocketAcceptFunction();

 protected:
  virtual ~SocketAcceptFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;

 private:
  void OnAccept(int result_code, net::TCPClientSocket *socket);
  scoped_ptr<api::socket::Accept::Params> params_;
};

class SocketReadFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.read", SOCKET_READ)

  SocketReadFunction();

 protected:
  virtual ~SocketReadFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;
  void OnCompleted(int result, scoped_refptr<net::IOBuffer> io_buffer);

 private:
  scoped_ptr<api::socket::Read::Params> params_;
};

class SocketWriteFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.write", SOCKET_WRITE)

  SocketWriteFunction();

 protected:
  virtual ~SocketWriteFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;
  void OnCompleted(int result);

 private:
  int socket_id_;
  scoped_refptr<net::IOBuffer> io_buffer_;
  size_t io_buffer_size_;
};

class SocketRecvFromFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.recvFrom", SOCKET_RECVFROM)

  SocketRecvFromFunction();

 protected:
  virtual ~SocketRecvFromFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;
  void OnCompleted(int result,
                   scoped_refptr<net::IOBuffer> io_buffer,
                   const std::string& address,
                   int port);

 private:
  scoped_ptr<api::socket::RecvFrom::Params> params_;
};

class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.sendTo", SOCKET_SENDTO)

  SocketSendToFunction();

 protected:
  virtual ~SocketSendToFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void AsyncWorkStart() OVERRIDE;
  void OnCompleted(int result);

  // SocketExtensionWithDnsLookupFunction:
  virtual void AfterDnsLookup(int lookup_result) OVERRIDE;

 private:
  void StartSendTo();

  int socket_id_;
  scoped_refptr<net::IOBuffer> io_buffer_;
  size_t io_buffer_size_;
  std::string hostname_;
  int port_;
  Socket* socket_;
};

class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.setKeepAlive", SOCKET_SETKEEPALIVE)

  SocketSetKeepAliveFunction();

 protected:
  virtual ~SocketSetKeepAliveFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::SetKeepAlive::Params> params_;
};

class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.setNoDelay", SOCKET_SETNODELAY)

  SocketSetNoDelayFunction();

 protected:
  virtual ~SocketSetNoDelayFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::SetNoDelay::Params> params_;
};

class SocketGetInfoFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.getInfo", SOCKET_GETINFO)

  SocketGetInfoFunction();

 protected:
  virtual ~SocketGetInfoFunction();

  // AsyncApiFunction:
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::GetInfo::Params> params_;
};

class SocketGetNetworkListFunction : public AsyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.getNetworkList", SOCKET_GETNETWORKLIST)

 protected:
  virtual ~SocketGetNetworkListFunction() {}
  virtual bool RunImpl() OVERRIDE;

 private:
  void GetNetworkListOnFileThread();
  void HandleGetNetworkListError();
  void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list);
};

class SocketJoinGroupFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.joinGroup", SOCKET_MULTICAST_JOIN_GROUP)

  SocketJoinGroupFunction();

 protected:
  virtual ~SocketJoinGroupFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::JoinGroup::Params> params_;
};

class SocketLeaveGroupFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.leaveGroup", SOCKET_MULTICAST_LEAVE_GROUP)

  SocketLeaveGroupFunction();

 protected:
  virtual ~SocketLeaveGroupFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::LeaveGroup::Params> params_;
};

class SocketSetMulticastTimeToLiveFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.setMulticastTimeToLive",
                             SOCKET_MULTICAST_SET_TIME_TO_LIVE)

  SocketSetMulticastTimeToLiveFunction();

 protected:
  virtual ~SocketSetMulticastTimeToLiveFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::SetMulticastTimeToLive::Params> params_;
};

class SocketSetMulticastLoopbackModeFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.setMulticastLoopbackMode",
                             SOCKET_MULTICAST_SET_LOOPBACK_MODE)

  SocketSetMulticastLoopbackModeFunction();

 protected:
  virtual ~SocketSetMulticastLoopbackModeFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::SetMulticastLoopbackMode::Params> params_;
};

class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("socket.getJoinedGroups",
                             SOCKET_MULTICAST_GET_JOINED_GROUPS)

  SocketGetJoinedGroupsFunction();

 protected:
  virtual ~SocketGetJoinedGroupsFunction();

  // AsyncApiFunction
  virtual bool Prepare() OVERRIDE;
  virtual void Work() OVERRIDE;

 private:
  scoped_ptr<api::socket::GetJoinedGroups::Params> params_;
};
}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DNXMVC6TypeScriptAngular2Example1.Models
{
    public class ConfigModel
    {
        public string ApplicationName {get; set;}
        public string ApplicationNameFull { get; set; }
        public string Version { get; set; }
    }
}


text:
"""DeepDream.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os.path
import zipfile

import numpy as np
import PIL.Image

import tensorflow as tf

FLAGS = tf.app.flags.FLAGS

tf.app.flags.DEFINE_string('data_dir',
                           '/tmp/inception/',
                           'Directory for storing Inception network.')

tf.app.flags.DEFINE_string('jpeg_file',
                           'output.jpg',
                           'Where to save the resulting JPEG.')

def get_layer(layer):
  """Helper for getting layer output Tensor in model Graph.

  Args:
   layer: string, layer name

  Returns:
    Tensor for that layer.
  """
  graph = tf.get_default_graph()
  return graph.get_tensor_by_name('import/%s:0' % layer)

def maybe_download(data_dir):
  """Maybe download pretrained Inception network.

  Args:
    data_dir: string, path to data
  """
  url = ('https://storage.googleapis.com/download.tensorflow.org/models/'
         'inception5h.zip')
  basename = 'inception5h.zip'
  local_file = tf.contrib.learn.python.learn.datasets.base.maybe_download(
      basename, data_dir, url)

  # Uncompress the pretrained Inception network.
  print('Extracting', local_file)
  zip_ref = zipfile.ZipFile(local_file, 'r')
  zip_ref.extractall(FLAGS.data_dir)
  zip_ref.close()

def normalize_image(image):
  """Stretch the range and prepare the image for saving as a JPEG.

  Args:
    image: numpy array

  Returns:
    numpy array of image in uint8
  """
  # Clip to [0, 1] and then convert to uint8.
  image = np.clip(image, 0, 1)
  image = np.uint8(image * 255)
  return image

def save_jpeg(jpeg_file, image):
  pil_image = PIL.Image.fromarray(image)
  pil_image.save(jpeg_file)
  print('Saved to file: ', jpeg_file)

def main(unused_argv):
  # Maybe download and uncompress pretrained Inception network.
  maybe_download(FLAGS.data_dir)

  model_fn = os.path.join(FLAGS.data_dir, 'tensorflow_inception_graph.pb')

  # Load the pretrained Inception model as a GraphDef.
  with tf.gfile.FastGFile(model_fn, 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())

  with tf.Graph().as_default():
    # Input for the network.
    input_image = tf.placeholder(np.float32, name='input')
    pixel_mean = 117.0
    input_preprocessed = tf.expand_dims(input_image - pixel_mean, 0)
    tf.import_graph_def(graph_def, {'input': input_preprocessed})

    # Grab a list of the names of Tensor's that are the output of convolutions.
    graph = tf.get_default_graph()
    layers = [op.name for op in graph.get_operations()
              if op.type == 'Conv2D' and 'import/' in op.name]
    feature_nums = [int(graph.get_tensor_by_name(name+':0').get_shape()[-1])
                    for name in layers]
    # print('Layers available: %s' % ','.join(layers))
    print('Number of layers', len(layers))
    print('Number of features:', sum(feature_nums))

    # Pick an internal layer and node to visualize.
    # Note that we use outputs before applying the ReLU nonlinearity to
    # have non-zero gradients for features with negative initial activations.
    layer = 'mixed4d_3x3_bottleneck_pre_relu'
    channel = 139
    layer_channel = get_layer(layer)[:, :, :, channel]
    print('layer %s, channel %d: %s' % (layer, channel, layer_channel))

    # Define the optimization as the average across all spatial locations.
    score = tf.reduce_mean(layer_channel)

    # Automatic differentiation with TensorFlow. Magic!
    input_gradient = tf.gradients(score, input_image)[0]

    # Employ random noise as a image.
    noise_image = np.random.uniform(size=(224, 224, 3)) + 100.0
    image = noise_image.copy()

    ################################################################
    # EXERCISE: Implemement the Deep Dream algorithm here!
    ################################################################

  # Save the image.
  stddev = 0.1
  image = (image - image.mean()) / max(image.std(), 1e-4) * stddev + 0.5
  image = normalize_image(image)
  save_jpeg(FLAGS.jpeg_file, image)

if __name__ == '__main__':
  tf.app.run()


text:
import json

from django.http import HttpResponse
from functools import wraps

from apps.api.models import AccessToken

def json_response(view):
    def _wrap(request, *args, **kwargs):
        value = view(request, *args, **kwargs)
        if isinstance(value, HttpResponse):
            return value
        try:
            return HttpResponse(json.dumps(value), content_type="application/json")
        except Exception as e:
            error = {
                'message': str(e),
                'type': e.__class__.__name__
            }
            return HttpResponse(json.dumps(error), status=500, content_type="application/json")
    return _wrap

def token_auth(view):
    @wraps(view)
    def _decorator(request, *args, **kwargs):
        if 'HTTP_AUTHORIZATION' in request.META:
            authmeth, token = request.META['HTTP_AUTHORIZATION'].split(' ', 1)

            if authmeth.lower() == 'token':
                try:
                    act = AccessToken.objects.get(access_key=token, is_active=True)
                    user = act.user
                except:
                    user = None

                if user:
                    request.user = user

        if request.user.is_authenticated():
            return view(request, *args, **kwargs)
        else:
            response = HttpResponse('Unauthorized', status=401)
            response['WWW-Authenticate'] = 'Token'
            return response

    return _decorator

def allow_methods(methods):
    def _wrap(view):
        def wrapped_view(request, *args, **kwargs):
            if not request.method in methods:
                return HttpResponse(status=405)
            return view(request, *args, **kwargs)
        wrapped_view.csrf_exempt = True
        return wrapped_view
    return _wrap


text:
package org.apache.jackrabbit.core.query.lucene.directory;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Test suite that includes all testcases for the directory module.
 */
public class TestAll extends TestCase {

    /**
     * Returns a Test suite that executes all tests inside this
     * package.
     *
     * @return a Test suite that executes all tests inside this
     *         package.
     */
    public static Test suite() {
        TestSuite suite = new TestSuite("Directory tests");

        suite.addTestSuite(IndexInputStreamTest.class);
        suite.addTestSuite(IndexOutputStreamTest.class);
        suite.addTestSuite(DirectoryManagerTest.class);

        return suite;
    }
}


text:
package com.amazonaws.services.ec2.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.ec2.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * GetConsoleScreenshotRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetConsoleScreenshotRequestMarshaller implements Marshaller<Request<GetConsoleScreenshotRequest>, GetConsoleScreenshotRequest> {

    public Request<GetConsoleScreenshotRequest> marshall(GetConsoleScreenshotRequest getConsoleScreenshotRequest) {

        if (getConsoleScreenshotRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<GetConsoleScreenshotRequest> request = new DefaultRequest<GetConsoleScreenshotRequest>(getConsoleScreenshotRequest, "AmazonEC2");
        request.addParameter("Action", "GetConsoleScreenshot");
        request.addParameter("Version", "2016-11-15");
        request.setHttpMethod(HttpMethodName.POST);

        if (getConsoleScreenshotRequest.getInstanceId() != null) {
            request.addParameter("InstanceId", StringUtils.fromString(getConsoleScreenshotRequest.getInstanceId()));
        }

        if (getConsoleScreenshotRequest.getWakeUp() != null) {
            request.addParameter("WakeUp", StringUtils.fromBoolean(getConsoleScreenshotRequest.getWakeUp()));
        }

        return request;
    }

}


text:
require 'shck/version'
require 'shck/cli'
require 'shck/config'
require 'shck/cui'
require 'shck/shell'


text:
@interface GOMainViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>

#pragma mark - Outlets

@property (weak, nonatomic) IBOutlet UIView *mainView;
@property (weak, nonatomic) IBOutlet UITableView *backgroundTableView;
@property (weak, nonatomic) IBOutlet UIView *deviceContainerView;
@property (weak, nonatomic) IBOutlet UIView *settingsContainerView;
@property (weak, nonatomic) IBOutlet UIView *groupsContainerView;
@property (weak, nonatomic) IBOutlet UIView *rulesContainerView;
@property (weak, nonatomic) IBOutlet UIView *usersContainerView;

@property (strong, nonatomic) IBOutlet UIPanGestureRecognizer *panGestureRecognizer;

@property (weak, nonatomic) IBOutlet UIView *blockingView;

@property (weak, nonatomic) IBOutlet UIView *errorView;
@property (weak, nonatomic) IBOutlet UILabel *errorLabel;

#pragma mark - Actions

- (IBAction)onDragMoveMainView:(id)sender;

#pragma mark - Methods

- (void)toggleMainView;
- (void)showErrorViewWithText:(NSString *)text;

@end


text:
<?php

/*
 * GENERATED CODE WARNING
 * This file was automatically generated - do not edit!
 */

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START retail_v2alpha_generated_ProductService_UpdateProduct_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Retail\V2alpha\Product;
use Google\Cloud\Retail\V2alpha\ProductServiceClient;

/**
 * Updates a [Product][google.cloud.retail.v2alpha.Product].
 *
 * @param string $productTitle Product title.
 *
 *                             This field must be a UTF-8 encoded string with a length limit of 1,000
 *                             characters. Otherwise, an INVALID_ARGUMENT error is returned.
 *
 *                             Google Merchant Center property
 *                             [title](https://support.google.com/merchants/answer/6324415). Schema.org
 *                             property [Product.name](https://schema.org/name).
 */
function update_product_sample(string $productTitle): void
{
    // Create a client.
    $productServiceClient = new ProductServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $product = (new Product())
        ->setTitle($productTitle);

    // Call the API and handle any network failures.
    try {
        /** @var Product $response */
        $response = $productServiceClient->updateProduct($product);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $productTitle = '[TITLE]';

    update_product_sample($productTitle);
}
// [END retail_v2alpha_generated_ProductService_UpdateProduct_sync]


text:
.class public interface abstract annotation Lo/abh$ˋ;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Ljava/lang/annotation/Annotation;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lo/abh;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2609
    name = "\u02cb"
.end annotation


text:
copyright:
 years: 2015, 2016

---

# Ricezione di notifiche di push su dispositivi iOS
{: #enable-push-ios-notifications-receiving}

Ricezione di notifiche di push su dispositivi iOS.

##Objective-C
Per ricevere notifiche di push sui dispositivi ioS, aggiungi il seguente metodo Objective-C al delegato applicazione della tua applicazione.

```
// Per Objective-C
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
//il dizionario userInfo conterrà i dati inviati dal server.
}
```

##Swift
Per ricevere notifiche di push sui dispositivi ioS, aggiungi il seguente metodo Swift al delegato applicazione della tua applicazione.

```
 // Per Swift
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
       //Il dizionario UserInfo conterrà i dati inviati dal server
   }
```


text:
namespace sky {
namespace shell {

class RasterizerMojo : public Rasterizer {
 public:
  explicit RasterizerMojo();
  ~RasterizerMojo() override;

  base::WeakPtr<RasterizerMojo> GetWeakPtr();

  base::WeakPtr<Rasterizer> GetWeakRasterizerPtr() override;

  void ConnectToRasterizer(
       mojo::InterfaceRequest<rasterizer::Rasterizer> request) override;

  void Init(mojo::ApplicationConnectorPtr connector,
            mojo::gfx::composition::ScenePtr scene);

 private:
  void Draw(uint64_t layer_tree_ptr, const DrawCallback& callback) override;

  struct GLState {
    explicit GLState(mojo::ApplicationConnector* connector);
    ~GLState();

    mojo::GLContextOwner gl_context_owner;
    GLTextureRecycler gl_texture_recycler;
    mojo::skia::GaneshContext ganesh_context;
  };

  mojo::Binding<rasterizer::Rasterizer> binding_;
  mojo::gfx::composition::ScenePtr scene_;
  std::unique_ptr<GLState> gl_state_;
  flow::PaintContext paint_context_;

  base::WeakPtrFactory<RasterizerMojo> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(RasterizerMojo);
};

}  // namespace shell
}  // namespace sky

#endif  // SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_