text:
package water.fvec;

import static org.junit.Assert.assertTrue;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import water.*;

public class ParseExceptionTest extends TestUtil {
  @BeforeClass public static void stall() { stall_till_cloudsize(3); }

  @Test public void testParserRecoversFromException() {
    Throwable ex = null;
    Key fkey0=null,fkey1=null,fkey2=null,okey=null;
    try {
      okey = Key.make("junk.hex");
      fkey0 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_0.csv"));
      fkey1 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_1.csv"));
      fkey2 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_2.csv"));
      // Now "break" one of the files.  Globally.
      new Break(fkey1).invokeOnAllNodes();

      ParseDataset2.parse(okey, new Key[]{fkey0,fkey1,fkey2});

    } catch( Throwable e2 ) {
      ex = e2;                  // Record expected exception
    }
    assertTrue( "Parse should throw an NPE",ex!=null);
    assertTrue( "All input & output keys not removed", DKV.get(fkey0)==null );
    assertTrue( "All input & output keys not removed", DKV.get(fkey1)==null );
    assertTrue( "All input & output keys not removed", DKV.get(fkey2)==null );
    assertTrue( "All input & output keys not removed", DKV.get(okey )==null );

    // Try again, in the same test, same inputs & outputs but not broken.
    // Should recover completely.
    okey = Key.make("junk.hex");
    fkey0 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_0.csv"));
    fkey1 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_1.csv"));
    fkey2 = NFSFileVec.make(new File("smalldata/parse_folder_test/prostate_2.csv"));
    Frame fr = ParseDataset2.parse(okey, new Key[]{fkey0,fkey1,fkey2});
    fr.delete();

    assertTrue( "All input & output keys not removed", DKV.get(fkey0)==null );
    assertTrue( "All input & output keys not removed", DKV.get(fkey1)==null );
    assertTrue( "All input & output keys not removed", DKV.get(fkey2)==null );
    assertTrue( "All input & output keys not removed", DKV.get(okey )==null );
  }

  private static class Break extends DRemoteTask<Break> {
    final Key _key;
    Break(Key key ) { _key = key; }
    @Override public void lcompute() {
      Vec vec = DKV.get(_key).get();
      Chunk chk = vec.chunkForChunkIdx(0); // Load the chunk (which otherwise loads only lazily)
      chk._mem = null;                     // Illegal setup: Chunk _mem should never be null
      tryComplete();
    }
    @Override public void reduce(Break drt ) {}
  }

}


text:
<?php

// KlientBundle:Portfel:edit.html.twig
return array (
);

redpajama_set_name: RedPajamaGithub


text:
module StorytimeAdmin
  module ToCsv
    extend ActiveSupport::Concern

    module ClassMethods
      def csv_columns
        column_names
      end

      def to_csv
        CSV.generate(headers: true) do |csv|
          csv << self.csv_columns
          all.each do |record|
            csv << self.csv_columns.map{ |attr| record.send(attr) }
          end
        end
      end
    end
  end
end

ActiveRecord::Base.send :include, StorytimeAdmin::ToCsv


text:
package org.abstractform.binding.eclipse;

import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;

public class RequiredValidator implements IValidator {

	public static final RequiredValidator INSTANCE = new RequiredValidator();

	private RequiredValidator() {

	}

	@Override
	public IStatus validate(Object value) {
		if (value == null) {
			return RequiredValidationStatus.INSTANCE;
		} else {
			return RequiredValidationStatus.OK_STATUS;
		}
	}
}


text:
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { bootloader } from '@angularclass/hmr';
import { decorateModuleRef } from './app/environment';
import {AppModule} from './app/app.module';

export function main(): Promise<any> {
  return platformBrowserDynamic()
    .bootstrapModule(AppModule)
    .then(decorateModuleRef)
    .catch((err) => console.error(err));
}

bootloader(main);


text:
<?php
	declare(strict_types=1);
	/**
	 * Created by PhpStorm.
	 * User: lewis
	 * Date: 22/07/2018
	 * Time: 00:46
	 */

	namespace Framework\Application\UtilitiesV2\Interfaces;

	/**
	 * Interface Script
	 * @package Framework\Application\UtilitiesV2\Interfaces
	 */
	interface Script
	{

		/**
		 * @param $arguments
		 *
		 * @return bool
		 */

		public function execute($arguments);

		/**
		 * @return array|bool|null
		 */

		public function requiredArguments();

		/**
		 * @return array
		 */

		public function help();
	}


text:
#pragma once
#include <aws/awstransfer/Transfer_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Transfer
{
namespace Model
{

  /**
   *
Reserved for future use.

See Also:
   AWS
   * API Reference

   */
  class AWS_TRANSFER_API EfsFileLocation
  {
  public:
    EfsFileLocation();
    EfsFileLocation(Aws::Utils::Json::JsonView jsonValue);
    EfsFileLocation& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline const Aws::String& GetFileSystemId() const{ return m_fileSystemId; }

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline bool FileSystemIdHasBeenSet() const { return m_fileSystemIdHasBeenSet; }

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline void SetFileSystemId(const Aws::String& value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId = value; }

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline void SetFileSystemId(Aws::String&& value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId = std::move(value); }

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline void SetFileSystemId(const char* value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId.assign(value); }

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline EfsFileLocation& WithFileSystemId(const Aws::String& value) { SetFileSystemId(value); return *this;}

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline EfsFileLocation& WithFileSystemId(Aws::String&& value) { SetFileSystemId(std::move(value)); return *this;}

    /**
     *
The ID of the file system, assigned by Amazon EFS.

     */
    inline EfsFileLocation& WithFileSystemId(const char* value) { SetFileSystemId(value); return *this;}

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline const Aws::String& GetPath() const{ return m_path; }

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline bool PathHasBeenSet() const { return m_pathHasBeenSet; }

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline void SetPath(const Aws::String& value) { m_pathHasBeenSet = true; m_path = value; }

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline void SetPath(Aws::String&& value) { m_pathHasBeenSet = true; m_path = std::move(value); }

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline void SetPath(const char* value) { m_pathHasBeenSet = true; m_path.assign(value); }

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline EfsFileLocation& WithPath(const Aws::String& value) { SetPath(value); return *this;}

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline EfsFileLocation& WithPath(Aws::String&& value) { SetPath(std::move(value)); return *this;}

    /**
     *
The pathname for the folder being used by a workflow.

     */
    inline EfsFileLocation& WithPath(const char* value) { SetPath(value); return *this;}

  private:

    Aws::String m_fileSystemId;
    bool m_fileSystemIdHasBeenSet;

    Aws::String m_path;
    bool m_pathHasBeenSet;
  };

} // namespace Model
} // namespace Transfer
} // namespace Aws


text:
<chapter id="spring-ojb">
  <title>OJB Gps Device Support</title>

  <sect1 id="spring-ojb-introduction">
   <title>Introduction</title>
    <para>
      Compass OJB support is built on top of Spring ORM support for Apache OJB (Object Relational Broker) and the Compass::Gps support for OJB device. This provides simpler integration with OJB. For a complete and working sample, please see the petclinic sample.
    </para>
  </sect1>
  <sect1 id="spring-ojb-device">
    <title>SpringOjbGpsDevice</title>
    <para>
      <literal>SpringOjbGpsDevice</literal> is an extension of the <literal>OjbGpsDevice</literal> and utilizes Spring ojb features. This devices Uses Spring <literal>PersistenceBrokerTemplate</literal> and <literal>OjbFactoryUtils</literal> to get the current <literal>PersistenceBroker</literal> for batch indexing (the <literal>index()</literal> operation).
    </para>
    <para>
      You can provide the <literal>PersistenceBrokerTemplate</literal>, though it is not required since it is created the same way the <literal>PersistenceBrokerDaoSupport</literal> does.
    </para>
    <para>
      The device can be used with <literal>SpringOjbGpsDeviceInterceptor</literal> to provide real-time data mirroring without the need to write any code (described in the next section).
    </para>
  </sect1>
  <sect1 id="spring-ojb-interceptor">
    <title>SpringOjbGpsDeviceInterceptor</title>
    <para>
      <literal>SpringOjbGpsDeviceInterceptor</literal> Uses Spring's AOP capabilities to attach and remove lifecycle event listeners to the <literal>PersistenceBroker</literal> (the device acts as the listener). Uses <literal>OjbGpsDeviceUtils</literal> to perform it on the supplied <literal>SpringOjbGpsDevice</literal>.
    </para>
    <para>
      Mainly used as a post interceptor with transaction proxies that manage service layer operations on an OJB enabled DAO layer.
    </para>
  </sect1>
</chapter>


text:
Simple multi-stream protocol for use with ZigBee wireless modules. Adds an additional layer of encryption and allows advanced streams such as file transfers.

## Overview
I have a few particular needs for my current use of the ZigBee protocol. None of which were currently implemented by anything that is publicly available. Instead of relying on serial type data connectivity between nodes, I needed to be able to transfer files, issue commands to other modules etc. This project is the beginning of my work in this area.

Prior to transferring any stream types, the Handler and Agent must mutually authenticate using a Diffie-Hellman key exchange. The key exchange packets are signed using an existing pre shared key between the modules. This provides forward secrecy for communication, and doesn't compromise the entire network if a module goes missing. Pre shared keys should be unique between each module pair that is comunicating.

## Packet format
The packet header was intentionally kept small due to the length restrictions on ZigBee packets. The total packet length is restricted to 100 bytes (minus two byte destination header, and the 12 byte Andrena header below). This means that we a maximum of 86 byte payload per packet. The python module splits up byte streams into appropriate chunk sizes and sends them as streams to the remote clients.
```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------------------------------------------------------+
|      Type     |   Stream Id   |      Flags    |     Length    |
+---------------------------------------------------------------+
|                             Seq Num                           |
+---------------------------------------------------------------+
|                               Tag                             |
+---------------------------------------------------------------+
|                             Payload...                        |
+---------------------------------------------------------------+
```

### Stream Types
```
  AGENT_HELLO   = 0X01 # Implemented
  HANDLER_HELLO = 0X02 # Implemented
  AGENT_ACK     = 0X03
  PING_REQUEST  = 0X04
  PING_REPLY    = 0X05
  FILE_TRANSFER = 0X06 # Implemented
  COMMAND       = 0X07
  ANNOUNCEMENT  = 0X08
  ACK           = 0x09
```

### Seq Num
Counter IV for AES encryption, also helps keep streams in sync.

### Tag
Sha1 HMAC of each packet. Diffie Hellman exchanges are HMACed with the pre shared key between clients to protect against man in the middle attacks.

## Example
Included in the examples folder is a handler and an agent. The agent connects to the handler, initiates the DH key exchange, and upon successful negotiation sends the README.md file to the handler. You obviously need two XBee modules for this to work. Ensure the PSK for the client contexts match otherwise the DH exchange will fail.

## Disclaimer
I am neither a full time developer, nor a cryptographer. If you see any issues with either of these, please submit a pull request. This is still very much experimental technology, and in pre-alpha stages as most of the protocol is still not implemented. Use at your own risk.


text:
<?php

namespace app\modules\common\widgets\frontend;

use Yii;
use yii\base\Widget;
use yii\helpers\ArrayHelper;
use yii\data\ActiveDataProvider;

class Comment extends Widget{

    public $_params;

    public function init() {
        $this->registerAssets();
        parent::init();
    }

    public function run() {
        $module = ArrayHelper::getValue($this->_params, 'module');
        $view = ArrayHelper::getValue($this->_params, 'view');

        $comment = \app\modules\comment\models\Comment::find();
        $comment->orderBy('create_time DESC');
        $comment->where(['status' => 1, 'item_id' => ArrayHelper::getValue($this->_params, 'parent_id'), 'module' => (!empty($module)) ? $module: 'comment']);

        $dataProvider = new ActiveDataProvider([
            'query' => $comment,
            'pagination' => false,
        ]);

        $this->_params['model'] = $dataProvider;

        return $this->render((!empty($view)) ? $view : 'comment', $this->_params);
    }

    private function registerAssets(){
        Yii::$app->view->registerJS("
            function checkEnter(event, element) {
                if (event.keyCode == 13) {
                    $('#formDefault').submit();
                }
            }

            $('.buttonLike').click(function(){
                var id = '" . ArrayHelper::getValue($this->_params, 'parent_id') . "';
                var type = $(this).attr('data-type');
                var comment_id = $(this).attr('data-id');
                $.ajax({
                    url: '" . yii\helpers\Url::to(['/question/ajax/like']) . "',
                    type: 'post',
                    data: {type: type, comment_id: comment_id, id: id},
                }).done(function (status) {
                    if (status != 1){
                        $('.buttonLike[data-id=\"' + comment_id + '\"]').text('Like')
                        $('.buttonLike[data-id=\"' + comment_id + '\"]').attr('data-type', 'like');
                    } else {
                        $('.buttonLike[data-id=\"' + comment_id + '\"]').text('Unlike')
                        $('.buttonLike[data-id=\"' + comment_id + '\"]').attr('data-type', 'unlike');
                    }
                });
            });
        ", yii\web\View::POS_END);
    }

}


text:
.. only:: not (epub or latex or html)

    WARNING: You are looking at unreleased Cilium documentation.
    Please use the official rendered version released here:
    https://docs.cilium.io

.. _ipam_gke:

########################
Google Kubernetes Engine
########################

When running Cilium on Google GKE following the :ref:`k8s_install_gke` guide,
the native networking layer of Google Cloud will be utilized for address
management and IP forwarding.

************
Architecture
************

.. image:: gke_ipam_arch.png
    :align: center

Cilium running in a GKE configuration mode utilizes the Kubernetes hostscope
IPAM mode. It will configure the Cilium agent to wait until the Kubernetes node
resource is populated with a ``spec.podCIDR`` or ``spec.podCIDRs`` as required
by the enabled address families (IPv4/IPv6). See :ref:`k8s_hostscope` for
additional details of this IPAM mode.

The corresponding datapath is described in section :ref:`gke_datapath`.

See the getting started guide :ref:`k8s_install_gke` to install Cilium Google
Kubernetes Engine (GKE).

*************
Configuration
*************

The GKE IPAM mode can be enabled by setting the Helm option
``config.ipam=kubernetes`` or by setting the ConfigMap option ``ipam:
kubernetes``.

***************
Troubleshooting
***************

Validate the exposed PodCIDR field
==================================

Check if the Kubernetes nodes contain a value in the ``podCIDR`` field:

.. code:: bash

    kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.podCIDR}{"\n"}{end}'
    gke-cluster4-default-pool-b195a3f3-k431	10.4.0.0/24
    gke-cluster4-default-pool-b195a3f3-zv3p	10.4.1.0/24

Check the Cilium status
=======================

Run ``cilium status`` on the node in question and validate that the CIDR used
for IPAM matches the PodCIDR announced in the Kubernetes node:

.. code:: bash

    kubectl -n cilium get pods -o wide | grep gke-cluster4-default-pool-b195a3f3-k431
    cilium-lv4xd                       1/1     Running   0          3h8m   10.164.0.112   gke-cluster4-default-pool-b195a3f3-k431   <none>           <none>

    kubectl -n cilium exec -ti cilium-lv4xd -- cilium status
    KVStore:                Ok   Disabled
    Kubernetes:             Ok   1.14+ (v1.14.10-gke.27) [linux/amd64]
    Kubernetes APIs:        ["CustomResourceDefinition", "cilium/v2::CiliumClusterwideNetworkPolicy", "cilium/v2::CiliumEndpoint", "cilium/v2::CiliumNetworkPolicy", "cilium/v2::CiliumNode", "core/v1::Endpoint", "core/v1::Namespace", "core/v1::Pods", "core/v1::Service", "networking.k8s.io/v1::NetworkPolicy"]
    KubeProxyReplacement:   Probe   []
    Cilium:                 Ok      OK
    NodeMonitor:            Disabled
    Cilium health daemon:   Ok
    IPAM:                   IPv4: 7/255 allocated from 10.4.0.0/24,
    Controller Status:      36/36 healthy
    Proxy Status:           OK, ip 10.4.0.190, 0 redirects active on ports 10000-20000
    Hubble:                 Disabled
    Cluster health:         2/2 reachable   (2020-04-23T13:46:36Z)


text:
<?php

require_once '../../csrest_lists.php';

$wrap = new CS_REST_Lists('List ID', 'Your API Key');

$result = $wrap->delete();

echo "Result of DELETE /api/v3/lists/{ID}\n
";
if($result->was_successful()) {
    echo "Deleted with code\n
".$result->http_status_code;
} else {
    echo 'Failed with code '.$result->http_status_code."\n

";
    var_dump($result->response);
    echo '
';
}


text:
license: >
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

title: Windows Phone Befehlszeilentools
---

# Windows Phone Befehlszeilentools

Die `cordova` Befehlszeilen-Dienstprogramm ist ein High-Level Tool, das Ihnen erlaubt, Anwendungen auf mehreren Plattformen gleichzeitig zu erstellen. Eine ältere Version von Cordova Rahmen bietet Gruppen von Befehlszeilentools, die spezifisch für jede Plattform. Wenn sie als Alternative zu den CLI verwenden möchten, müssen Sie diese Version von Cordova von [cordova.apache.org][1]herunterladen. Der Download enthält separate Archiv für jede Plattform. Erweitern Sie die gewünschte Ziel-Plattform. Die hier beschriebenen Tools sind in der Regel in der obersten Ebene `bin` Verzeichnis, sonst finden Sie in die **README** -Datei ausführlichere Wegbeschreibung.

 [1]: http://cordova.apache.org

Informationen über die Low-Level-Befehlszeilenschnittstelle, die Plugins ermöglicht, finden Sie unter Verwendung von Plugman zu Plugins verwalten. Eine [Übersicht](../../overview/index.html) finden Sie unter Application Plugins.

## Windows Phone

Die Windows Phone-Befehlszeilen-Tools unterstützen, erstellen, Erstellung und Ausführung von neuen Projekten. Befehle müssen über eine Cmd oder Powershell-Eingabeaufforderung ausgeführt werden.

WP8-Repo jetzt enthält Code zum Erstellen von WP7 + WP8 apps. Das Repo hat Unterverzeichnisse für die einzelnen: `wp7/` und`wp8/`.

## Erstellen Sie ein Projekt

Es gibt 2 Möglichkeiten, gehen Sie zum Erstellen einer neuen Apache Cordova WP7 oder WP8.

### Führen Sie die Batchdatei erstellen und installieren Sie die Vorlagen

*   Der Stamm der Repo enthält eine `createTemplates.bat` Datei. Doppelklick erzeugt zwei `.zip` Dateien: `CordovaWP7_x_x_x.zip` und `CordovaWP8_x_x_x.zip` , wobei *x.x.x* die aktuelle Versionsnummer darstellt. Um diese Dateien in Visual Studio leicht zu verwenden, zu kopieren, sie zu `My Documents\Visual Studio
2012\Templates\ProjectTemplates\` . Sie können dann neue Apache Cordova Windows Phone-Anwendungen aus Visual Studio erstellen **Datei → neues Projekt** Menü.

*   Wenn Sie die Batch-Datei von der Befehlszeile aus ausführen, können Sie auch mit einem Parameter automatisch installieren aufrufen

Führen Sie das Skript:

    > createTemplates.bat-installieren

### Verwenden Sie Create-Skripts über die Befehlszeile

Führen Sie den `create` Befehl, der vorhandenen Pfad für das Projekt, die Reverse-Domäne-Style Paket-ID und die app-Anzeigenamen angeben. Hier ist die Syntax für Windows Phone 7 und 8:

    >.\wp7\bin\create PathToNewProject [ PackageName ] [ AppName ]
    >.\wp8\bin\create PathToNewProject [ PackageName ] [ AppName ]

    >PathToNewProject : The path to where you wish to create the project
    >PackageName      : The namespace for the project (default is Cordova.Example)
    >AppName          : The name of the application (default is CordovaWP8AppProj or CordovaWP7AppProj)

    >examples:
    >.\wp7\bin\create C:\path\to\my_new_project
    >.\wp8\bin\create C:\path\to\my_new_project io.cordova.example CordovaWP8App

Starten Sie Visual Studio und öffnen Sie die Projektmappendatei (.sln) in (C:\path\to\my\_new\_project)

Erstellen und ausführen

## Erstellen des Projekts (reinigen, dann bauen)

*   Debug

    $ C:\path\to\my\_new\_project\cordova\build --debug

*   Release

    $ C:\path\to\my\_new\_project\cordova\build --release

## Die App ausgeführt

Führen Sie den Befehl "ausführen" mit den folgenden *optionalen* Parametern

*   Lastenheft. Dazu gehören `--emulator` , `--device` , oder`--target=<targetID>`.

*   Spezifikation zu bauen. Dazu gehören `--debug` , `--release` , oder`--nobuild`.

    $ C:\path\to\my\_new\_project\cordova\run \[Target\] \[Build\]

In der Standardeinstellung der `run` Befehl wird aufgerufen, mit `--emulator --debug` Wenn Flaggen nicht bereitgestellt werden.

## Reinigung

    $ C:\path\to\my_new_project\cordova\clean


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace SharedModule
{
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        public int Left, Top, Right, Bottom;

        public RECT(int left, int top, int right, int bottom)
        {
            Left = left;
            Top = top;
            Right = right;
            Bottom = bottom;
        }

        public RECT(System.Drawing.Rectangle r) : this(r.Left, r.Top, r.Right, r.Bottom) { }

        public int X
        {
            get { return Left; }
            set { Right -= (Left - value); Left = value; }
        }

        public int Y
        {
            get { return Top; }
            set { Bottom -= (Top - value); Top = value; }
        }

        public int Height
        {
            get { return Bottom - Top; }
            set { Bottom = value + Top; }
        }

        public int Width
        {
            get { return Right - Left; }
            set { Right = value + Left; }
        }

        public System.Drawing.Point Location
        {
            get { return new System.Drawing.Point(Left, Top); }
            set { X = value.X; Y = value.Y; }
        }

        public System.Drawing.Size Size
        {
            get { return new System.Drawing.Size(Width, Height); }
            set { Width = value.Width; Height = value.Height; }
        }

        public static implicit operator System.Drawing.Rectangle(RECT r)
        {
            return new System.Drawing.Rectangle(r.Left, r.Top, r.Width, r.Height);
        }

        public static implicit operator RECT(System.Drawing.Rectangle r)
        {
            return new RECT(r);
        }

        public static bool operator ==(RECT r1, RECT r2)
        {
            return r1.Equals(r2);
        }

        public static bool operator !=(RECT r1, RECT r2)
        {
            return !r1.Equals(r2);
        }

        public bool Equals(RECT r)
        {
            return r.Left == Left && r.Top == Top && r.Right == Right && r.Bottom == Bottom;
        }

        public override bool Equals(object obj)
        {
            if (obj is RECT)
                return Equals((RECT)obj);
            else if (obj is System.Drawing.Rectangle)
                return Equals(new RECT((System.Drawing.Rectangle)obj));
            return false;
        }

        public override int GetHashCode()
        {
            return ((System.Drawing.Rectangle)this).GetHashCode();
        }

        public override string ToString()
        {
            return string.Format(System.Globalization.CultureInfo.CurrentCulture, "{{Left={0},Top={1},Right={2},Bottom={3}}}", Left, Top, Right, Bottom);
        }
    }
}


text:
set -e
set -x

# some vars to make this easy to change
SELENIUM_HUB_URL='http://127.0.0.1:4444'
SELENIUM_JAR=/usr/share/selenium/selenium-server-standalone.jar
SELENIUM_DOWNLOAD_URL=http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar

# If selenium is not available, get it
if [ ! -f "$SELENIUM_JAR" ]
then
    sudo mkdir -p $(dirname "$SELENIUM_JAR")
    sudo wget -nv -O "$SELENIUM_JAR" "$SELENIUM_DOWNLOAD_URL"
fi

# Update/Install Fx or chrome
#sudo apt-get install firefox -y --no-install-recommends
wget http://chromedriver.googlecode.com/files/chromedriver_linux32_23.0.1240.0.zip && unzip chromedriver_linux32_23.0.1240.0.zip && sudo mv chromedriver /usr/bin

# Start Selenium
export DISPLAY=:99.0
sudo xvfb-run java -Dwebdriver.chromedriver.bin=/usr/bin/chromedriver -jar "$SELENIUM_JAR" > /tmp/selenium.log &
wget --retry-connrefused --tries=120 --waitretry=3 --output-file=/dev/null "$SELENIUM_HUB_URL/wd/hub/status" -O /dev/null

# Test to see if the selenium server really did start
if [ ! $? -eq 0 ]
then
    echo "Selenium Failed"
else
    echo "Selenium Success"
fi

# Setup a directory to hold screenshots of failed tests
sudo mkdir /var/www/screenshots && chmod 777 /var/www/screenshots


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/content_app_manager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.emma.mobilesafe.acitivity.AppManagerActivity"
    tools:showIn="@layout/activity_app_manager">

    <RelativeLayout
        android:layout_width="match_parent"
        android:padding="5dp"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/tv_memory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="磁盘可用"/>

        <TextView
            android:id="@+id/tv_sd_memory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:text="磁盘可用"/>
    </RelativeLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ListView
            android:id="@+id/lv_app_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"></ListView>

        <TextView
            android:id="@+id/tv_des"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#ccc"
            android:textColor="#000"
            android:textSize="18sp"/>

    </FrameLayout>
</LinearLayout>


text:
@implementation MyRequestQueue

+ (MyRequestQueue *)sharedInstance
{
    static MyRequestQueue *_sharedInstance = nil;

    if (_sharedInstance == nil) {
        _sharedInstance = [[MyRequestQueue alloc] init];
    }

    return _sharedInstance;
}

@end


text:
WebInspector.CodeMirrorCompletionController = function(codeMirror, delegate, stopCharactersRegex)
{
    WebInspector.Object.call(this);

    console.assert(codeMirror);

    this._codeMirror = codeMirror;
    this._stopCharactersRegex = stopCharactersRegex || null;
    this._delegate = delegate || null;

    this._startOffset = NaN;
    this._endOffset = NaN;
    this._lineNumber = NaN;
    this._prefix = "";
    this._completions = [];
    this._extendedCompletionProviders = {};

    this._suggestionsView = new WebInspector.CompletionSuggestionsView(this);

    this._keyMap = {
        "Up": this._handleUpKey.bind(this),
        "Down": this._handleDownKey.bind(this),
        "Right": this._handleRightOrEnterKey.bind(this),
        "Esc": this._handleEscapeKey.bind(this),
        "Enter": this._handleRightOrEnterKey.bind(this),
        "Tab": this._handleTabKey.bind(this),
        "Cmd-A": this._handleHideKey.bind(this),
        "Cmd-Z": this._handleHideKey.bind(this),
        "Shift-Cmd-Z": this._handleHideKey.bind(this),
        "Cmd-Y": this._handleHideKey.bind(this)
    };

    this._handleChangeListener = this._handleChange.bind(this);
    this._handleCursorActivityListener = this._handleCursorActivity.bind(this);
    this._handleHideActionListener = this._handleHideAction.bind(this);

    this._codeMirror.addKeyMap(this._keyMap);

    this._codeMirror.on("change", this._handleChangeListener);
    this._codeMirror.on("cursorActivity", this._handleCursorActivityListener);
    this._codeMirror.on("blur", this._handleHideActionListener);
    this._codeMirror.on("scroll", this._handleHideActionListener);
};

WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex = /[\s=:;,]/;
WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap = {"css": /[\s:;,{}()]/, "javascript": /[\s=:;,!+\-*/%&|^~?<>.{}()[\]]/};
WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap = {"javascript": /[\s=:;,!+\-*/%&|^~?<>]/};
WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex = /[({[]/;
WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex = /[)}\]]/;
WebInspector.CodeMirrorCompletionController.MatchingBrackets = {"{": "}", "(": ")", "[": "]", "}": "{", ")": "(", "]": "["};
WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName = "completion-hint";
WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay = 250;
WebInspector.CodeMirrorCompletionController.CompletionTypingDelay = 250;
WebInspector.CodeMirrorCompletionController.CompletionOrigin = "+completion";
WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin = "+delete-completion";

WebInspector.CodeMirrorCompletionController.prototype = {
    constructor: WebInspector.CodeMirrorCompletionController,

    // Public

    get delegate()
    {
        return this._delegate;
    },

    addExtendedCompletionProvider: function(modeName, provider)
    {
        this._extendedCompletionProviders[modeName] = provider;
    },

    updateCompletions: function(completions, implicitSuffix)
    {
        if (isNaN(this._startOffset) || isNaN(this._endOffset) || isNaN(this._lineNumber))
            return;

        if (!completions || !completions.length) {
            this.hideCompletions();
            return;
        }

        this._completions = completions;

        if (typeof implicitSuffix === "string")
            this._implicitSuffix = implicitSuffix;

        var from = {line: this._lineNumber, ch: this._startOffset};
        var to = {line: this._lineNumber, ch: this._endOffset};

        var firstCharCoords = this._codeMirror.cursorCoords(from);
        var lastCharCoords = this._codeMirror.cursorCoords(to);
        var bounds = new WebInspector.Rect(firstCharCoords.left, firstCharCoords.top, lastCharCoords.right - firstCharCoords.left, firstCharCoords.bottom - firstCharCoords.top);

        // Try to restore the previous selected index, otherwise just select the first.
        var index = this._currentCompletion ? completions.indexOf(this._currentCompletion) : 0;
        if (index === -1)
            index = 0;

        if (this._forced || completions.length > 1 || completions[index] !== this._prefix) {
            // Update and show the suggestion list.
            this._suggestionsView.update(completions, index);
            this._suggestionsView.show(bounds);
        } else if (this._implicitSuffix) {
            // The prefix and the completion exactly match, but there is an implicit suffix.
            // Just hide the suggestion list and keep the completion hint for the implicit suffix.
            this._suggestionsView.hide();
        } else {
            // The prefix and the completion exactly match, hide the completions. Return early so
            // the completion hint isn't updated.
            this.hideCompletions();
            return;
        }

        this._applyCompletionHint(completions[index]);
    },

    isCompletionChange: function(change)
    {
        return this._ignoreChange || change.origin === WebInspector.CodeMirrorCompletionController.CompletionOrigin || change.origin === WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin;
    },

    isShowingCompletions: function()
    {
        return this._suggestionsView.visible || (this._completionHintMarker && this._completionHintMarker.find());
    },

    isHandlingClickEvent: function()
    {
        return this._suggestionsView.isHandlingClickEvent();
    },

    hideCompletions: function()
    {
        this._suggestionsView.hide();

        this._removeCompletionHint();

        this._startOffset = NaN;
        this._endOffset = NaN;
        this._lineNumber = NaN;
        this._prefix = "";
        this._completions = [];
        this._implicitSuffix = "";
        this._forced = false;

        if (this._completionDelayTimeout) {
            clearTimeout(this._completionDelayTimeout);
            delete this._completionDelayTimeout;
        }

        delete this._currentCompletion;
        delete this._ignoreNextCursorActivity;
    },

    close: function()
    {
        this._codeMirror.removeKeyMap(this._keyMap);

        this._codeMirror.off("change", this._handleChangeListener);
        this._codeMirror.off("cursorActivity", this._handleCursorActivityListener);
        this._codeMirror.off("blur", this._handleHideActionListener);
        this._codeMirror.off("scroll", this._handleHideActionListener);
    },

    // Protected

    completionSuggestionsSelectedCompletion: function(suggestionsView, completionText)
    {
        this._applyCompletionHint(completionText);
    },

    completionSuggestionsClickedCompletion: function(suggestionsView, completionText)
    {
        // The clicked suggestion causes the editor to loose focus. Restore it so the user can keep typing.
        this._codeMirror.focus();

        this._applyCompletionHint(completionText);
        this._commitCompletionHint();
    },

    // Private

    get _currentReplacementText()
    {
        return this._currentCompletion + this._implicitSuffix;
    },

    _hasPendingCompletion: function()
    {
        return !isNaN(this._startOffset) && !isNaN(this._endOffset) && !isNaN(this._lineNumber);
    },

    _notifyCompletionsHiddenSoon: function()
    {
        function notify()
        {
            if (this._completionHintMarker)
                return;

            if (this._delegate && typeof this._delegate.completionControllerCompletionsHidden === "function")
                this._delegate.completionControllerCompletionsHidden(this);
        }

        if (this._notifyCompletionsHiddenIfNeededTimeout)
            clearTimeout(this._notifyCompletionsHiddenIfNeededTimeout);
        this._notifyCompletionsHiddenIfNeededTimeout = setTimeout(notify.bind(this), WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay);
    },

    _applyCompletionHint: function(completionText)
    {
        console.assert(completionText);
        if (!completionText)
            return;

        function update()
        {
            this._currentCompletion = completionText;

            this._removeCompletionHint(true, true);

            var replacementText = this._currentReplacementText;

            var from = {line: this._lineNumber, ch: this._startOffset};
            var cursor = {line: this._lineNumber, ch: this._endOffset};
            var to = {line: this._lineNumber, ch: this._startOffset + replacementText.length};

            this._codeMirror.replaceRange(replacementText, from, cursor, WebInspector.CodeMirrorCompletionController.CompletionOrigin);
            this._removeLastChangeFromHistory();

            this._codeMirror.setCursor(cursor);

            if (cursor.ch !== to.ch)
                this._completionHintMarker = this._codeMirror.markText(cursor, to, {className: WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName});
        }

        this._ignoreChange = true;
        this._ignoreNextCursorActivity = true;

        this._codeMirror.operation(update.bind(this));

        delete this._ignoreChange;
    },

    _commitCompletionHint: function()
    {
        function update()
        {
            this._removeCompletionHint(true, true);

            var replacementText = this._currentReplacementText;

            var from = {line: this._lineNumber, ch: this._startOffset};
            var cursor = {line: this._lineNumber, ch: this._endOffset};
            var to = {line: this._lineNumber, ch: this._startOffset + replacementText.length};

            var lastChar = this._currentCompletion.charAt(this._currentCompletion.length - 1);
            var isClosing = ")]}".indexOf(lastChar);
            if (isClosing !== -1)
                to.ch -= 1 + this._implicitSuffix.length;

            this._codeMirror.replaceRange(replacementText, from, cursor, WebInspector.CodeMirrorCompletionController.CompletionOrigin);

            // Don't call _removeLastChangeFromHistory here to allow the committed completion to be undone.

            this._codeMirror.setCursor(to);

            this.hideCompletions();
        }

        this._ignoreChange = true;
        this._ignoreNextCursorActivity = true;

        this._codeMirror.operation(update.bind(this));

        delete this._ignoreChange;
    },

    _removeLastChangeFromHistory: function()
    {
        var history = this._codeMirror.getHistory();

        // We don't expect a undone history. But if there is one clear it. If could lead to undefined behavior.
        console.assert(!history.undone.length);
        history.undone = [];

        // Pop the last item from the done history.
        console.assert(history.done.length);
        history.done.pop();

        this._codeMirror.setHistory(history);
    },

    _removeCompletionHint: function(nonatomic, dontRestorePrefix)
    {
        if (!this._completionHintMarker)
            return;

        this._notifyCompletionsHiddenSoon();

        function update()
        {
            var range = this._completionHintMarker.find();
            if (range) {
                this._completionHintMarker.clear();

                this._codeMirror.replaceRange("", range.from, range.to, WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin);
                this._removeLastChangeFromHistory();
            }

            this._completionHintMarker = null;

            if (dontRestorePrefix)
                return;

            console.assert(!isNaN(this._startOffset));
            console.assert(!isNaN(this._endOffset));
            console.assert(!isNaN(this._lineNumber));

            var from = {line: this._lineNumber, ch: this._startOffset};
            var to = {line: this._lineNumber, ch: this._endOffset};

            this._codeMirror.replaceRange(this._prefix, from, to, WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin);
            this._removeLastChangeFromHistory();
        }

        if (nonatomic) {
            update.call(this);
            return;
        }

        this._ignoreChange = true;

        this._codeMirror.operation(update.bind(this));

        delete this._ignoreChange;
    },

    _scanStringForExpression: function(modeName, string, startOffset, direction, allowMiddleAndEmpty, includeStopCharacter, ignoreInitialUnmatchedOpenBracket, stopCharactersRegex)
    {
        console.assert(direction === -1 || direction === 1);

        var stopCharactersRegex = stopCharactersRegex || this._stopCharactersRegex || WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap[modeName] || WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex;

        function isStopCharacter(character)
        {
            return stopCharactersRegex.test(character);
        }

        function isOpenBracketCharacter(character)
        {
            return WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex.test(character);
        }

        function isCloseBracketCharacter(character)
        {
            return WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex.test(character);
        }

        function matchingBracketCharacter(character)
        {
            return WebInspector.CodeMirrorCompletionController.MatchingBrackets[character];
        }

        var endOffset = Math.min(startOffset, string.length);

        var endOfLineOrWord = endOffset === string.length || isStopCharacter(string.charAt(endOffset));

        if (!endOfLineOrWord && !allowMiddleAndEmpty)
            return null;

        var bracketStack = [];
        var bracketOffsetStack = [];
        var lastCloseBracketOffset = NaN;

        var startOffset = endOffset;
        var firstOffset = endOffset + direction;
        for (var i = firstOffset; direction > 0 ? i < string.length : i >= 0; i += direction) {
            var character = string.charAt(i);

            // Ignore stop characters when we are inside brackets.
            if (isStopCharacter(character) && !bracketStack.length)
                break;

            if (isCloseBracketCharacter(character)) {
                bracketStack.push(character);
                bracketOffsetStack.push(i);
            } else if (isOpenBracketCharacter(character)) {
                if ((!ignoreInitialUnmatchedOpenBracket || i !== firstOffset) && (!bracketStack.length || matchingBracketCharacter(character) !== bracketStack.lastValue))
                    break;

                bracketOffsetStack.pop();
                bracketStack.pop();
            }

            startOffset = i + (direction > 0 ? 1 : 0);
        }

        if (bracketOffsetStack.length)
            startOffset = bracketOffsetStack.pop() + 1;

        if (includeStopCharacter && startOffset > 0 && startOffset < string.length)
            startOffset += direction;

        if (direction > 0) {
            var tempEndOffset = endOffset;
            endOffset = startOffset;
            startOffset = tempEndOffset;
        }

        return {string: string.substring(startOffset, endOffset), startOffset: startOffset, endOffset: endOffset};
    },

    _completeAtCurrentPosition: function(force)
    {
        if (this._codeMirror.somethingSelected()) {
            this.hideCompletions();
            return;
        }

        if (this._completionDelayTimeout) {
            clearTimeout(this._completionDelayTimeout);
            delete this._completionDelayTimeout;
        }

        this._removeCompletionHint(true, true);

        var cursor = this._codeMirror.getCursor();
        var token = this._codeMirror.getTokenAt(cursor);

        // Don't try to complete inside comments.
        if (token.type && /\bcomment\b/.test(token.type)) {
            this.hideCompletions();
            return;
        }

        var mode = this._codeMirror.getMode();
        var innerMode = CodeMirror.innerMode(mode, token.state).mode;
        var modeName = innerMode.alternateName || innerMode.name;

        var lineNumber = cursor.line;
        var lineString = this._codeMirror.getLine(lineNumber);

        var backwardScanResult = this._scanStringForExpression(modeName, lineString, cursor.ch, -1, force);
        if (!backwardScanResult) {
            this.hideCompletions();
            return;
        }

        var forwardScanResult = this._scanStringForExpression(modeName, lineString, cursor.ch, 1, true, true);
        var suffix = forwardScanResult.string;

        this._ignoreNextCursorActivity = true;

        this._startOffset = backwardScanResult.startOffset;
        this._endOffset = backwardScanResult.endOffset;
        this._lineNumber = lineNumber;
        this._prefix = backwardScanResult.string;
        this._completions = [];
        this._implicitSuffix = "";
        this._forced = force;

        var baseExpressionStopCharactersRegex = WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap[modeName];
        if (baseExpressionStopCharactersRegex)
            var baseScanResult = this._scanStringForExpression(modeName, lineString, this._startOffset, -1, true, false, true, baseExpressionStopCharactersRegex);

        if (!force && !backwardScanResult.string && (!baseScanResult || !baseScanResult.string)) {
            this.hideCompletions();
            return;
        }

        var defaultCompletions = [];

        switch (modeName) {
        case "css":
            defaultCompletions = this._generateCSSCompletions(token, baseScanResult ? baseScanResult.string : null, suffix);
            break;
        case "javascript":
            defaultCompletions = this._generateJavaScriptCompletions(token, baseScanResult ? baseScanResult.string : null, suffix);
            break;
        }

        var extendedCompletionsProvider = this._extendedCompletionProviders[modeName];
        if (extendedCompletionsProvider) {
            extendedCompletionsProvider.completionControllerCompletionsNeeded(this, defaultCompletions, baseScanResult ? baseScanResult.string : null, this._prefix, suffix, force);
            return;
        }

        if (this._delegate && typeof this._delegate.completionControllerCompletionsNeeded === "function")
            this._delegate.completionControllerCompletionsNeeded(this, this._prefix, defaultCompletions, baseScanResult ? baseScanResult.string : null, suffix, force);
        else
            this.updateCompletions(defaultCompletions);
    },

    _generateCSSCompletions: function(mainToken, base, suffix)
    {
        // We only support completion inside CSS rules.
        if (!mainToken.state || !mainToken.state.stack || !mainToken.state.stack.contains("rule"))
            return [];

        var token = mainToken;
        var lineNumber = this._lineNumber;

        // Scan backwards looking for the current property.
        while (token.state.stack.lastValue === "propertyValue") {
            // Found the beginning of the line. Go to the previous line.
            if (!token.start) {
                --lineNumber;

                // No more lines, stop.
                if (lineNumber < 0)
                    break;
            }

            // Get the previous token.
            token = this._codeMirror.getTokenAt({line: lineNumber, ch: token.start ? token.start : Number.MAX_VALUE});
        }

        // If we have a property token and it's not the main token, then we are working on
        // the value for that property and should complete allowed values.
        if (mainToken !== token && token.type && /\bproperty\b/.test(token.type)) {
            var propertyName = token.string;

            // If there is a suffix and it isn't a semicolon, then we should use a space since
            // the user is editing in the middle.
            this._implicitSuffix = suffix && suffix !== ";" ? " " : ";";

            // Don't use an implicit suffix if it would be the same as the existing suffix.
            if (this._implicitSuffix === suffix)
                this._implicitSuffix = "";

            return WebInspector.CSSKeywordCompletions.forProperty(propertyName).startsWith(this._prefix);
        }

        this._implicitSuffix = suffix !== ":" ? ": " : "";

        // Complete property names.
        return WebInspector.CSSCompletions.cssNameCompletions.startsWith(this._prefix);
    },

    _generateJavaScriptCompletions: function(mainToken, base, suffix)
    {
        // If there is a base expression then we should not attempt to match any keywords or variables.
        // Allow only open bracket characters at the end of the base, otherwise leave completions with
        // a base up to the delegate to figure out.
        if (base && !/[({[]$/.test(base))
            return [];

        var matchingWords = [];

        const prefix = this._prefix;

        const declaringVariable = mainToken.state.lexical.type === "vardef";
        const insideSwitch = mainToken.state.lexical.prev ? mainToken.state.lexical.prev.info === "switch" : false;
        const insideBlock = mainToken.state.lexical.prev ? mainToken.state.lexical.prev.type === "}" : false;
        const insideParenthesis = mainToken.state.lexical.type === ")";
        const insideBrackets = mainToken.state.lexical.type === "]";

        const allKeywords = ["break", "case", "catch", "const", "continue", "debugger", "default", "delete", "do", "else", "false", "finally", "for", "function", "if", "in",
            "Infinity", "instanceof", "NaN", "new", "null", "return", "switch", "this", "throw", "true", "try", "typeof", "undefined", "var", "void", "while", "with"];
        const valueKeywords = ["false", "Infinity", "NaN", "null", "this", "true", "undefined"];

        const allowedKeywordsInsideBlocks = allKeywords.keySet();
        const allowedKeywordsWhenDeclaringVariable = valueKeywords.keySet();
        const allowedKeywordsInsideParenthesis = valueKeywords.concat(["function"]).keySet();
        const allowedKeywordsInsideBrackets = allowedKeywordsInsideParenthesis;
        const allowedKeywordsOnlyInsideSwitch = ["case", "default"].keySet();

        function matchKeywords(keywords)
        {
            matchingWords = matchingWords.concat(keywords.filter(function(word) {
                if (!insideSwitch && word in allowedKeywordsOnlyInsideSwitch)
                    return false;
                if (insideBlock && !(word in allowedKeywordsInsideBlocks))
                    return false;
                if (insideBrackets && !(word in allowedKeywordsInsideBrackets))
                    return false;
                if (insideParenthesis && !(word in allowedKeywordsInsideParenthesis))
                    return false;
                if (declaringVariable && !(word in allowedKeywordsWhenDeclaringVariable))
                    return false;
                return word.startsWith(prefix);
            }));
        }

        function matchVariables()
        {
            function filterVariables(variables)
            {
                for (var variable = variables; variable; variable = variable.next) {
                    // Don't match the variable if this token is in a variable declaration.
                    // Otherwise the currently typed text will always match and that isn't useful.
                    if (declaringVariable && variable.name === prefix)
                        continue;

                    if (variable.name.startsWith(prefix) && !matchingWords.contains(variable.name))
                        matchingWords.push(variable.name);
                }
            }

            var context = mainToken.state.context;
            while (context) {
                filterVariables(context.vars);
                context = context.prev;
            }

            filterVariables(mainToken.state.globalVars);
        }

        switch (suffix.substring(0, 1)) {
        case "":
        case " ":
            matchVariables();
            matchKeywords(allKeywords);
            break;

        case ".":
        case "[":
            matchVariables();
            matchKeywords(["false", "Infinity", "NaN", "this", "true"]);
            break;

        case "(":
            matchVariables();
            matchKeywords(["catch", "else", "for", "function", "if", "return", "switch", "throw", "while", "with"]);
            break;

        case "{":
            matchKeywords(["do", "else", "finally", "return", "try"]);
            break;

        case ":":
            if (insideSwitch)
                matchKeywords(["case", "default"]);
            break;

        case ";":
            matchVariables();
            matchKeywords(valueKeywords);
            matchKeywords(["break", "continue", "debugger", "return", "void"]);
            break;
        }

        return matchingWords;
    },

    _handleUpKey: function(codeMirror)
    {
        if (!this._hasPendingCompletion())
            return CodeMirror.Pass;

        if (!this.isShowingCompletions())
            return;

        this._suggestionsView.selectPrevious();
    },

    _handleDownKey: function(codeMirror)
    {
        if (!this._hasPendingCompletion())
            return CodeMirror.Pass;

        if (!this.isShowingCompletions())
            return;

        this._suggestionsView.selectNext();
    },

    _handleRightOrEnterKey: function(codeMirror)
    {
        if (!this._hasPendingCompletion())
            return CodeMirror.Pass;

        if (!this.isShowingCompletions())
            return;

        this._commitCompletionHint();
    },

    _handleEscapeKey: function(codeMirror)
    {
        var delegateImplementsShouldAllowEscapeCompletion = this._delegate && typeof this._delegate.completionControllerShouldAllowEscapeCompletion === "function";
        if (this._hasPendingCompletion())
            this.hideCompletions();
        else if (this._codeMirror.getOption("readOnly"))
            return CodeMirror.Pass;
        else if (!delegateImplementsShouldAllowEscapeCompletion || this._delegate.completionControllerShouldAllowEscapeCompletion(this))
            this._completeAtCurrentPosition(true);
        else
            return CodeMirror.Pass;
    },

    _handleTabKey: function(codeMirror)
    {
        if (!this._hasPendingCompletion())
            return CodeMirror.Pass;

        if (!this.isShowingCompletions())
            return;

        console.assert(this._completions.length);
        if (!this._completions.length)
            return;

        console.assert(this._currentCompletion);
        if (!this._currentCompletion)
            return;

        // Commit the current completion if there is only one suggestion.
        if (this._completions.length === 1) {
            this._commitCompletionHint();
            return;
        }

        var prefixLength = this._prefix.length;

        var commonPrefix = this._completions[0];
        for (var i = 1; i < this._completions.length; ++i) {
            var completion = this._completions[i];
            var lastIndex = Math.min(commonPrefix.length, completion.length);
            for (var j = prefixLength; j < lastIndex; ++j) {
                if (commonPrefix[j] !== completion[j]) {
                    commonPrefix = commonPrefix.substr(0, j);
                    break;
                }
            }
        }

        // Commit the current completion if there is no common prefix that is longer.
        if (commonPrefix === this._prefix) {
            this._commitCompletionHint();
            return;
        }

        // Set the prefix to the common prefix so _applyCompletionHint will insert the
        // common prefix as commited text. Adjust _endOffset to match the new prefix.
        this._prefix = commonPrefix;
        this._endOffset = this._startOffset + commonPrefix.length;

        this._applyCompletionHint(this._currentCompletion);
    },

    _handleChange: function(codeMirror, change)
    {
        if (this.isCompletionChange(change))
            return;

        this._ignoreNextCursorActivity = true;

        if (!change.origin || change.origin.charAt(0) !== "+") {
            this.hideCompletions();
            return;
        }

        // Only complete on delete if we are showing completions already.
        if (change.origin === "+delete" && !this._hasPendingCompletion())
            return;

        if (this._completionDelayTimeout) {
            clearTimeout(this._completionDelayTimeout);
            delete this._completionDelayTimeout;
        }

        if (this._hasPendingCompletion())
            this._completeAtCurrentPosition(false);
        else
            this._completionDelayTimeout = setTimeout(this._completeAtCurrentPosition.bind(this, false), WebInspector.CodeMirrorCompletionController.CompletionTypingDelay);
    },

    _handleCursorActivity: function(codeMirror)
    {
        if (this._ignoreChange)
            return;

        if (this._ignoreNextCursorActivity) {
            delete this._ignoreNextCursorActivity;
            return;
        }

        this.hideCompletions();
    },

    _handleHideKey: function(codeMirror)
    {
        this.hideCompletions();

        return CodeMirror.Pass;
    },

    _handleHideAction: function(codeMirror)
    {
        // Clicking a suggestion causes the editor to blur. We don't want to hide completions in this case.
        if (this.isHandlingClickEvent())
            return;

        this.hideCompletions();
    }
};

WebInspector.CodeMirrorCompletionController.prototype.__proto__ = WebInspector.Object.prototype;


text:
package org.apereo.cas.web.flow;

import org.apereo.cas.AbstractCentralAuthenticationServiceTests;
import org.apereo.cas.BaseCasCoreTests;
import org.apereo.cas.config.TokenAuthenticationConfiguration;
import org.apereo.cas.services.DefaultRegisteredServiceProperty;
import org.apereo.cas.services.RegisteredServiceProperty;
import org.apereo.cas.services.RegisteredServiceTestUtils;
import org.apereo.cas.services.ReturnAllAttributeReleasePolicy;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.token.TokenConstants;
import org.apereo.cas.util.CollectionUtils;
import org.apereo.cas.util.gen.DefaultRandomStringGenerator;
import org.apereo.cas.util.gen.RandomStringGenerator;
import org.apereo.cas.web.flow.config.TokenAuthenticationWebflowConfiguration;
import org.apereo.cas.web.support.WebUtils;

import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWSAlgorithm;
import lombok.val;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.pac4j.core.profile.CommonProfile;
import org.pac4j.jwt.config.encryption.SecretEncryptionConfiguration;
import org.pac4j.jwt.config.signature.SecretSignatureConfiguration;
import org.pac4j.jwt.profile.JwtGenerator;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.test.MockRequestContext;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is {@link TokenAuthenticationActionTests}.
 *
 * @author Misagh Moayyed
 * @since 5.3.0
 */
@SpringBootTest(classes = {
    BaseCasCoreTests.SharedTestConfiguration.class,
    TokenAuthenticationConfiguration.class,
    TokenAuthenticationWebflowConfiguration.class
})
@Tag("WebflowAuthenticationActions")
public class TokenAuthenticationActionTests extends AbstractCentralAuthenticationServiceTests {
    private static final RandomStringGenerator RANDOM_STRING_GENERATOR = new DefaultRandomStringGenerator();

    private static final String SIGNING_SECRET = RANDOM_STRING_GENERATOR.getNewString(256);

    private static final String ENCRYPTION_SECRET = RANDOM_STRING_GENERATOR.getNewString(48);

    @Autowired
    @Qualifier("tokenAuthenticationAction")
    private ObjectProvider<Action> action;

    @Autowired
    @Qualifier("servicesManager")
    private ObjectProvider<ServicesManager> servicesManager;

    @BeforeEach
    public void before() {
        val svc = RegisteredServiceTestUtils.getRegisteredService("https://example.token.org");
        svc.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
        val prop = new DefaultRegisteredServiceProperty();
        prop.addValue(SIGNING_SECRET);
        svc.getProperties().put(RegisteredServiceProperty.RegisteredServiceProperties.TOKEN_SECRET_SIGNING.getPropertyName(), prop);

        val prop2 = new DefaultRegisteredServiceProperty();
        prop2.addValue(ENCRYPTION_SECRET);
        svc.getProperties().put(RegisteredServiceProperty.RegisteredServiceProperties.TOKEN_SECRET_ENCRYPTION.getPropertyName(), prop2);
        this.servicesManager.getObject().save(svc);
    }

    @Test
    public void verifyAction() throws Exception {
        val g = new JwtGenerator();

        g.setSignatureConfiguration(new SecretSignatureConfiguration(SIGNING_SECRET, JWSAlgorithm.HS256));
        g.setEncryptionConfiguration(new SecretEncryptionConfiguration(ENCRYPTION_SECRET, JWEAlgorithm.DIR, EncryptionMethod.A192CBC_HS384));

        val profile = new CommonProfile();
        profile.setId("casuser");
        profile.addAttribute("uid", "uid");
        profile.addAttribute("givenName", "CASUser");
        profile.addAttribute("memberOf", CollectionUtils.wrapSet("system", "cas", "admin"));
        val token = g.generate(profile);

        val request = new MockHttpServletRequest();
        request.addHeader(TokenConstants.PARAMETER_NAME_TOKEN, token);
        val context = new MockRequestContext();
        context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
        WebUtils.putServiceIntoFlowScope(context, RegisteredServiceTestUtils.getService("https://example.token.org"));
        assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, this.action.getObject().execute(context).getId());
    }
}


text: Tooli


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';

//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------

function test()
{
  enterFunc ('test');
  printBugNumber(BUGNUMBER);
  printStatus (summary);

// ------- Comment #75 From Jesse Ruderman

  (function p(){ p = 3; });
  (function p(){ p = 3; return p; })()
// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2980

    reportCompare(expect, actual, summary);

  exitFunc ('test');
}


text:
largura = int(input("digite a largura: "))
altura = int(input("digite a altura: "))

while altura > 0:
    for i in range(largura):
        print("#", end = '')
    print()
    altura -= 1


text:
package test;

import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.CacheManagerBuilder;
import org.ehcache.config.CacheConfigurationBuilder;

/**
 * Created by Administrator on 2015/11/24.
 */
public class TestEhcache {
    public static void main(String[] args){
        CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
                .withCache("preConfigured",
                        CacheConfigurationBuilder.newCacheConfigurationBuilder().buildConfig(Long.class, String.class))
                .build(true);

        Cache<Long, String> preConfigured
                = cacheManager.getCache("preConfigured", Long.class, String.class);

        Cache<Long, TestData> myCache = cacheManager.createCache("myCache",
                CacheConfigurationBuilder.newCacheConfigurationBuilder().buildConfig(Long.class, TestData.class));
        Cache<Long, TestData2> myCache2 = cacheManager.createCache("myCache2",
                CacheConfigurationBuilder.newCacheConfigurationBuilder().buildConfig(Long.class, TestData2.class));

        TestData data=new TestData();
        myCache.put(1L, data);
        myCache.put(1L, data);
        myCache.put(1L,new TestData());
        myCache.put(1L, data);
        myCache2.put(2l,data.testData2);
        data.a=30;
        data.testData2.a=50;
        TestData value = myCache.get(1L);

        System.out.println(value);

        cacheManager.close();
    }
    public static class TestData{
        public int a=10;
        public int b=20;
        TestData2 testData2=new TestData2();
        public String toString(){
            return "a:"+a+",b:"+b+",testData2:"+testData2;
        }
    }
    public static class TestData2{
        public int a=10;
        public int b=20;
        public String toString(){
            return "a:"+a+",b:"+b;
        }
    }
}


text:
using ExtendedXmlSerializer.Configuration;
using ExtendedXmlSerializer.ContentModel;
using ExtendedXmlSerializer.ContentModel.Format;
using ExtendedXmlSerializer.ContentModel.Identification;
using ExtendedXmlSerializer.Tests.ReportedIssues.Support;
using FluentAssertions;
using Xunit;

// ReSharper disable UnusedVariable

namespace ExtendedXmlSerializer.Tests.ReportedIssues
{
	public sealed class Issue346Tests_Custom
	{
		[Fact]
		void Verify()
		{
			var serializer = new ConfigurationContainer().Type<RootClass>()
			                                             .Register()
			                                             .Serializer()
			                                             .Composer()
			                                             .ByCalling(x => new Serializer(x))
			                                             .Member(x => x.SomeAttributeProperty)
			                                             .Attribute()
			                                             .Create()
			                                             .ForTesting();
			var instance = new RootClass
			{
				SomeAttributeProperty = "Hello World!", ManyToOneReference = new A {Name = "A"},
				OneToManyReference    = new B {Name                                      = "B"}
			};

			serializer.Assert(instance,
			                  @"<?xml version=""1.0"" encoding=""utf-8""?><Issue346Tests_Custom-RootClass Name=""A"" SomeAttributeProperty=""Hello World!"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests.ReportedIssues""><ManyToOneReference><Name>A</Name></ManyToOneReference><OneToManyReference><Name>B</Name></OneToManyReference></Issue346Tests_Custom-RootClass>");

			serializer.Cycle(instance)
			          .Should()
			          .BeEquivalentTo(instance);
		}

		[Fact]
		void VerifyWithAutoFormatting()
		{
			var serializer = new ConfigurationContainer().UseAutoFormatting()
			                                             .Type<RootClass>()
			                                             .Register()
			                                             .Serializer()
			                                             .Composer()
			                                             .ByCalling(x => new Serializer(x))
			                                             .Create()
			                                             .ForTesting();
			var instance = new RootClass
			{
				SomeAttributeProperty = "Hello World!", ManyToOneReference = new A {Name = "A"},
				OneToManyReference    = new B {Name                                      = "B"}
			};

			serializer.Assert(instance,
			                  @"<?xml version=""1.0"" encoding=""utf-8""?><Issue346Tests_Custom-RootClass Name=""A"" SomeAttributeProperty=""Hello World!"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests.ReportedIssues""><ManyToOneReference Name=""A"" /><OneToManyReference Name=""B"" /></Issue346Tests_Custom-RootClass>");

			serializer.Cycle(instance)
			          .Should()
			          .BeEquivalentTo(instance);
		}

		sealed class Serializer : ISerializer<RootClass>
		{
			readonly ISerializer<RootClass> _serializer;
			readonly IIdentity              _name;

			public Serializer(ISerializer<RootClass> serializer) : this(serializer, NameIdentity.Default) {}

			public Serializer(ISerializer<RootClass> serializer, IIdentity name)
			{
				_serializer = serializer;
				_name       = name;
			}

			public RootClass Get(IFormatReader parameter)
			{
				System.Xml.XmlReader native = parameter.Get().AsValid<System.Xml.XmlReader>(); // if you need it.
				return _serializer.Get(parameter);
			}

			public void Write(IFormatWriter writer, RootClass instance)
			{
				System.Xml.XmlWriter native = writer.Get().AsValid<System.Xml.XmlWriter>(); // if you need it.

				writer.Content(_name, instance.ManyToOneReference.Name);
				_serializer.Write(writer, instance);
			}

			sealed class NameIdentity : IIdentity
			{
				public static NameIdentity Default { get; } = new NameIdentity();

				NameIdentity() : this("Name", string.Empty) {}

				public NameIdentity(string name, string identifier)
				{
					Name       = name;
					Identifier = identifier;
				}

				public string Name { get; }

				public string Identifier { get; }
			}
		}

		public class RootClass
		{
			public string SomeAttributeProperty { get; set; }

			public A ManyToOneReference { get; set; }

			public B OneToManyReference { get; set; }
		}

		public class A
		{
			public string Name { get; set; }
		}

		public class B
		{
			public string Name { get; set; }
		}
	}
}


text:
#pragma once

#include <chrono>
#include <condition_variable>
#include <functional>
#include <list>
#include <map>
#include <mutex>
#include <set>
#include <thread>
#include <stdint.h>

namespace sysdig
{

/**
 * Base class for classes that need to collect values asynchronously from some
 * value source.  Subclasses will override the the run_impl() method and
 * implement the concrete value lookup behavior.  In that method, subclasses
 * will use use dequeue_next_key() method to get the key that it will use to
 * collect the value(s), collect the appropriate value(s), and call the
 * store_value() method to save the value.  The run_impl() method should
 * continue to dequeue and process values while the dequeue_next_key() method
 * returns true.
 *
 * The constructor for this class accepts a maximum wait time; this specifies
 * how long client code is willing to wait for a synchronous response (i.e.,
 * how long the lookup() method will block waiting for the requested value).
 * If the async_key_value_source is able to collect the requested value
 * within that time period, then the lookup() method will return them.
 *
 * If the lookup() method is unable to collect the requested value within
 * the requested time period, then one of two things will happen.
 *
 *

 *
If the client supplied a callback handler in the call to lookup(), then
 *     that callback handler will be invoked by the async_key_value_source once
 *     the value has been collected.  Note that the callback handler will be
 *     invoked in the context of the asynchronous thread associated with the
 *     async_key_value_source.

 *
If the client did not supply a handler, then the value will be stored,
 *     and the next call to the lookup() method with the same key will return
 *     the previously collected value.  If lookup() is not called with the
 *     specified ttl time, then this compoment will prune the stored value.

 *

 *
 * @tparam key_type   The type of the keys for which concrete subclasses will
 *                    query.  This type must have a valid operator==().
 * @tparam value_type The type of value that concrete subclasses will
 *                    receive from a query.  This type must have a valid
 *                    operator=().
 */
template<typename key_type, typename value_type>
class async_key_value_source
{
public:
	/**
	 * If provided to the constructor as max_wait_ms, then lookup will
	 * not wait for a response.
	 */
	const static uint64_t NO_WAIT_LOOKUP = 0;

	/**
	 * A callback handler will take a key and a output reference to the
	 * value.
	 */
        typedef std::function<void(const key_type& key,
			           const value_type& value)> callback_handler;

	/**
	 * Initialize this new async_key_value_source, which will block
	 * synchronously for the given max_wait_ms for value collection.
	 *
	 * @param[in] max_wait_ms The maximum amount of time that client code
	 *                        is willing to wait for lookup() to collect
	 *                        a value before falling back to an async
	 *                        return.
	 * @param[in] ttl_ms      The time, in milliseconds, that a cached
	 *                        value will live before being considered
	 *                        "too old" and being pruned.
	 */
	async_key_value_source(uint64_t max_wait_ms, uint64_t ttl_ms);

	async_key_value_source(const async_key_value_source&) = delete;
	async_key_value_source(async_key_value_source&&) = delete;
	async_key_value_source& operator=(const async_key_value_source&) = delete;

	virtual ~async_key_value_source();

	/**
	 * Returns the maximum amount of time, in milliseconds, that a call to
	 * lookup() will block synchronously before returning.
	 */
	uint64_t get_max_wait() const;

	/**
	 * Returns the maximum amount of time, in milliseconds, that a cached
	 * value will live before being pruned.
	 */
	uint64_t get_ttl() const;

	/**
	 * Lookup value(s) based on the given key.  This method will block
	 * the caller for up the max_wait_ms time specified at construction
	 * for the desired value(s) to be available.
	 *
	 * @param[in] key       The key to the value for which the client
	 *                      wishs to query.
	 * @param[out] value    If this method is able to fetch the desired
	 *                      value within the max_wait_ms specified at
	 *                      construction time, then this output parameter
	 *                      will contain the collected value.  The value
	 *                      of this parameter is defined only if this method
	 *                      returns true.
	 * @param[in] handler   If this method is unable to collect the requested
	 *                      value(s) before the timeout, and if this parameter
	 *                      is a valid, non-empty, function, then this class
	 *                      will invoke the given handler from the async
	 *                      thread immediately after the collected values
	 *                      are available.  If this handler is empty, then
	 *                      this async_key_value_source will store the
	 *                      values until either the next call to lookup()
	 *                      or until its ttl expires, whichever comes first.
	 *                      The handler is responsible for any thread-safety
	 *                      guarantees.
	 *
	 * @returns true if this method was able to lookup and return the
	 *          value synchronously; false otherwise.
	 */
	bool lookup(const key_type& key,
                    value_type& value,
                    const callback_handler& handler = callback_handler());

	/**
	 * Determines if the async thread assocaited with this
	 * async_key_value_source is running.
	 *
	 * Note: This API is for information only.  Clients should
	 * not use this to implement any sort of complex behavior.  Such
	 * use will lead to race conditions.  For example, is_running() and
	 * lookup() could potentially race, causing is_running() to return
	 * false after lookup() has started the thread.
	 *
	 * @returns true if the async thread is running, false otherwise.
	 */
	bool is_running() const;

protected:
	/**
	 * Stops the thread assocaited with this async_key_value_source, if
	 * it is running; otherwise, does nothing.  The only use for this is
	 * in a destructor to ensure that the async thread stops when the
	 * object is destroyed.
	 */
	void stop();

	/**
	 * Dequeues an entry from the request queue and returns it in the given
	 * key.  Concrete subclasses will call this method to get the next key
	 * for which to collect values.
	 *
	 * @returns true if there was a key to dequeue, false otherwise.
	 */
	bool dequeue_next_key(key_type& key);

	/**
	 * Get the (potentially partial) value for the given key.
	 *
	 * @param[in] key The key whose value is needed.
	 *
	 * @returns the value associated with the given key.
	 */
	value_type get_value(const key_type& key);

	/**
	 * Stores a value for the given key.  Concrete subclasses will call
	 * this method from their run_impl() method to save (or otherwise
	 * notifiy the client about) an available value.
	 *
	 * @param[in] key   The key for which the client asked for the value.
	 * @param[in] value The collected value.
	 */
	void store_value(const key_type& key, const value_type& value);

	/**
	 * Concrete subclasses must override this method to perform the
	 * asynchronous value lookup.  The implementation should:
	 *
	 *

	 *
Loop while dequeue_next_key() is true.

	 *
Get any existing value for that key using get_value()

	 *
Do whatever work is necessary to lookup the value associated
	 *     with that key.

	 *
Call store_value to store the updated value, and to
	 *     notify any client code waiting on that data.

	 *

	 */
	virtual void run_impl() = 0;

private:
	/**
	 * Holds information associated with a single lookup() request.
	 */
	struct lookup_request
	{
		lookup_request():
			m_available(false),
			m_value(),
			m_available_condition(),
			m_callback(),
			m_start_time(std::chrono::steady_clock::now())
		{ }

		/** Is the value here available? */
		bool m_available;

		/** The value for a key. */
		value_type m_value;

		/** Block in lookup() waiting for a sync response. */
		std::condition_variable m_available_condition;

		/**
		 * A optional client-specified callback handler for async
		 * response notification.
		 */
		callback_handler m_callback;

		/** The time at which this request was made. */
		std::chrono::time_point<std::chrono::steady_clock> m_start_time;
	};

	typedef std::map<key_type, lookup_request> value_map;

	/**
	 * The entry point of the async thread, which blocks waiting for work
	 * and dispatches work to run_impl().
	 */
	void run();

	/**
	 * Remove any entries that are older than the time-to-live.
	 */
	void prune_stale_requests();

	uint64_t m_max_wait_ms;
	uint64_t m_ttl_ms;
	std::thread m_thread;
	bool m_running;
	bool m_terminate;

	/**
	 * Protects the state of instances of this class.  This protected does
	 * not extend to subclasses (i.e., this mutex should not be held when
	 * dispatching to overridden methbods).
	 */
	mutable std::mutex m_mutex;

	/**
	 * Enables run() to block waiting for the m_request_queue to become
	 * non-empty.
	 */
	std::condition_variable m_queue_not_empty_condition;
	std::list<key_type> m_request_queue;
	std::set<key_type> m_request_set;
	value_map m_value_map;
};

} // end namespace sysdig

#include "async_key_value_source.tpp"


text:
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interactivity;

namespace FAManagementStudio.Views.Behaviors
{
    public class GetFocusWhenMovedTabKeyBehavior : Behavior<FrameworkElement>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
            this.AssociatedObject.IsKeyboardFocusWithinChanged += AssociatedObject_IsKeyboardFocusWithinChanged;
        }

        private void AssociatedObject_IsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var listbox = AssociatedObject as ListBox;
            if (listbox == null) return;
            if (listbox.IsKeyboardFocusWithin && listbox.SelectedItem == null)
            {
                listbox.SelectedIndex = 0;
            }
        }

        protected override void OnDetaching()
        {
            this.AssociatedObject.IsKeyboardFocusWithinChanged -= AssociatedObject_IsKeyboardFocusWithinChanged;
            base.OnDetaching();
        }
    }
}


text:
{-# LANGUAGE DataKinds     #-}
{-# LANGUAGE TypeOperators #-}

module Qwu.Api.Server where

import           Qwu.DB.Manipulation
import           Qwu.DB.Query (runPostByAccountId)
import qualified Qwu.DB.Table.Post as P
import           Qwu.Html.Post

import Control.Lens                         (set, view)
import Control.Monad.Trans                  (liftIO)
import Control.Monad.Trans.Either           (EitherT)
import Data.Default
import Data.UUID as U
import Data.Text (Text)
import Network.Wai                          (Application)
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
import Servant
import Servant.HTML.Lucid                   (HTML)

type MyApi = "posts" :> Get '[JSON, HTML] [P.Post]
        -- Accept POST [(Text, Text)] (FormUrlEncoded), returns [Post] as JSON or HTML.
        :<|> "newpost" :> ReqBody '[FormUrlEncoded] [(Text, Text)] :> Post '[JSON, HTML] [P.Post]

myApi :: Proxy MyApi
myApi = Proxy

server :: Server MyApi
server = posts
    :<|> newpost
  where
    posts :: EitherT ServantErr IO [P.Post]
    posts = liftIO runPostByAccountId
    newpost :: [(Text, Text)] -> EitherT ServantErr IO [P.Post]
    newpost [(_, fieldData)] = do
      liftIO (createPost (set P.body fieldData (def :: P.Post)) U.nil)
      liftIO runPostByAccountId

app :: Application
app = logStdoutDev (serve myApi server)


text:
<?xml version="1.0" encoding="UTF-8"?>
<Policy
      xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
        access_control-xacml-2.0-policy-schema-os.xsd"
      PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIG005:policy"
      RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
    <Description>
        Policy for Conformance Test IIIG005.
    </Description>
    <PolicyDefaults>
        <XPathVersion>http://www.w3.org/TR/1999/Rec-xpath-19991116</XPathVersion>
    </PolicyDefaults>
    <Target/>
    <Rule
          RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIG005:rule"
          Effect="Permit">
        <Condition>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:xpath-node-match">
            <AttributeValue
                  DataType="http://www.w3.org/2001/XMLSchema#string">//*[local-name()='Resource'][namespace-uri()='urn:oasis:names:tc:xacml:2.0:context:schema:os']</AttributeValue>
            <AttributeValue
                  DataType="http://www.w3.org/2001/XMLSchema#string">//*[local-name()='Subject'][namespace-uri()='urn:oasis:names:tc:xacml:2.0:context:schema:os']/*[local-name()='Attribute'][namespace-uri()='urn:oasis:names:tc:xacml:2.0:context:schema:os']</AttributeValue>
            </Apply>
        </Condition>
    </Rule>
</Policy>


text:
PART A - Prepare image and adjust build scripts
===============================================

Install the support scripts, either by downloading the latest code directly from GitHub http://github.com/renggli/builder/zipball/master or by cloning the Git repository:

	git clone git://github.com/newapplesho/builder.git

You should get a directory structure with several empty directories, this readme file and several shell scripts.

1. Get a distribution image from http://www.pharo-project.org/pharo-download and unzip the image in the "images" directory. You can also script that in your initial build-step and fetch the official stable images from http://pharo-project.org/pharo-download/stable-core or http://pharo-project.org/pharo-download/stable.

2. Review or create your own build scripts in the directory "scripts". Use whatever loader you want: Gofer, Metacello, Mason, ... There are two special scripts, "before.st" is run prior to any build and "after.st" is run after any build. Make sure that the last action of the "after.st" script saves and quits the image. The other scripts load stuff and set settings. The sample builds scripts are a good starting point for creating your own build scripts for your own projects.

3. The "cache" directory contains the package cache of the builds. It is initially empty.

4. The "builds" directory is only used when the build script is called from the command-line. When used from Jenkins it remains empty.

5. The "sources" directory contains the .sources files that your images might need. Available sources files are linked to the build directory if present.

6. The "oneclick" directory contains a template for building oneclick images. "oneclick-icons" contains a collection of icons to be used with the oneclick images.

The generic build script build.sh works on this directory structure. Also the other shell scripts expect the structure like this. Preferably these scripts are called from Jenkins, but you can also call it from the command line. build.sh takes 3 kinds of arguments, an input image name, an output image name, and a series of scripts to load into that image. See the help for details.

Similary build-oneclick.sh takes and input image and builds a one-click image from it. Run the script without any arguments to get a listing of supported settings.

PART B - Integrate with Jenkins
===============================

- download "jenkins.war" from http://jenkins-ci.org/
- start the Jenkins server
- add build.sh to your path, so that can be easily called from within Jenkins
- run Jenkins with something like:

        WARFILE=$HOME/apps/jenkins/jenkins.war
        LOGFILE=jenkins.log
        nohup java -jar $WARFILE --httpPort=9090 > $LOGFILE 2>&1 &
- port 9090 is used to avoid conflict with Seaside on 8080
- goto the Jenkins dashboard at http://localhost:9090/

Add new Jenkins job
-------------------
- from Jenkins dashboard, select "New Job"
- fill in a job name, e.g. "Pharo"
- choose the "Build as free-style software project" radio button
- click on OK

Configure the new job
---------------------
- you should be sent to the job configuration screen, after the previous step
- in the "Build" section, click "Add build step", select "Execute shell" from dropdown menu
- in the command textarea that appears, type the build specification:

        build.sh -i PharoCore-1.0-10505rc1 -s omnibrowser -o omnibrowser
        build.sh -i omnibrowser -s buildtools -s omnibrowser-tests -o omnibrowser-tests

- in the "Post-build Actions" section, enable "Publish JUnit test result report"
- enter "**/*-Test.xml" into the text input labelled "Test report XMLs" that appears.
- in the "Post-build Actions" section, enable "Publish Checkstyle analysis results" (requires the Checkstyle plugin to be installed)

Run the build job
-----------------
- after saving the new job, you should already be in the new job's control screen. If not, you can navigate there from the dashboard.
- start a build by clicking on the "Build Now" link

DEBUGGING
=========

1. Test your build scripts in a headful image beforehand.

2. In case of problems study the "Console Output" of the failed build.

3. In most cases builds fail because of an error within the image. Click on "Workspace" and check "PharoDebug.log".

4. If the build stalls abort it and study the "Console Output" to figure out what went wrong.

JENKINS PLUGINS
===============

- The "URL Change Trigger" plugin is useful to automatically trigger builds when the Monticello repository changes.

- The "Checkstyle Plug-in" reports lint errors in Jenkins.

- The "Jenkins Emma plugin" reports test coverage in Jenkins.

- The "Green Balls" plugin makes the Jenkins GUI look slightly better.

- The "Google Analytics Plugin" tracks users of Jenkins.


text:
'use strict';

/**
 * @ngdoc object
 * @name adf.dashboardProvider
 * @description
 *
 * The dashboardProvider can be used to register structures and widgets.
 */
angular.module('adf.provider', ['adf.locale'])
  .provider('dashboard', function(adfLocale){

      var activeLocale = adfLocale.defaultLocale;
      var locales = adfLocale.frameworkLocales;

      function getLocales() {
          return locales;
      }

      function getActiveLocale() {
          return activeLocale;
      }

      function translate(label) {
          var translation = locales[activeLocale][label];
          return translation ? translation : label;
      }

      this.setLocale = function(locale){
          if(locales[locale]) {
              activeLocale = locale;
          } else {
              throw new Error('Cannot set locale: ' + locale + '. Locale is not defined.');
          }

          return this;
      };
      this.addLocale = function(locale, translations){
          if(!angular.isString(locale)) {
              throw new Error('locale must be an string');
          }

          if(!angular.isObject(translations)) {
              throw new Error('translations must be an object');
          }

          locales[locale] = translations;
          return this;
      };

      var customWidgetTemplatePath = null;

      /**
       * @ngdoc method
       * @name adf.dashboardProvider#customWidgetTemplatePath
       * @propertyOf adf.dashboardProvider
       * @description
       *
       * Changes the container template for the widgets
       *
       * @param {string} path to the custom widget template
       *
       * @returns {Object} self
       */
      this.customWidgetTemplatePath = function(templatePath) {
          customWidgetTemplatePath = templatePath;
          return this;
      };

    var widgets = {};
    var widgetsPath = '';
    var structures = {};
    var messageTemplate = '
{}
';
    var loadingTemplate = '\

\n\

\n\
          loading ...\n\

\n\

';

   /**
    * @ngdoc method
    * @name adf.dashboardProvider#widget
    * @methodOf adf.dashboardProvider
    * @description
    *
    * Registers a new widget.
    *
    * @param {string} name of the widget
    * @param {object} widget to be registered.
    *
    *   Object properties:
    *
    *   - `title` - `{string=}` - The title of the widget.
    *   - `description` - `{string=}` - Description of the widget.
    *   - `config` - `{object}` - Predefined widget configuration.
    *   - `controller` - `{string=|function()=}` - Controller fn that should be
    *      associated with newly created scope of the widget or the name of a
    *      {@link http://docs.angularjs.org/api/angular.Module#controller registered controller}
    *      if passed as a string.
    *   - `controllerAs` - `{string=}` - A controller alias name. If present the controller will be
    *      published to scope under the `controllerAs` name.
    *   - `template` - `{string=|function()=}` - html template as a string.
    *   - `templateUrl` - `{string=}` - path to an html template.
    *   - `reload` - `{boolean=}` - true if the widget could be reloaded. The default is false.
    *   - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
    *      be injected into the controller. If any of these dependencies are promises, the widget
    *      will wait for them all to be resolved or one to be rejected before the controller is
    *      instantiated.
    *      If all the promises are resolved successfully, the values of the resolved promises are
    *      injected.
    *
    *      The map object is:
    *      - `key` – `{string}`: a name of a dependency to be injected into the controller.
    *      - `factory` - `{string|function}`: If `string` then it is an alias for a service.
    *        Otherwise if function, then it is {@link http://docs.angularjs.org/api/AUTO.$injector#invoke injected}
    *        and the return value is treated as the dependency. If the result is a promise, it is
    *        resolved before its value is injected into the controller.
    *   - `edit` - `{object}` - Edit modus of the widget.
    *      - `controller` - `{string=|function()=}` - Same as above, but for the edit mode of the widget.
    *      - `template` - `{string=|function()=}` - Same as above, but for the edit mode of the widget.
    *      - `templateUrl` - `{string=}` - Same as above, but for the edit mode of the widget.
    *      - `resolve` - `{Object.<string, function>=}` - Same as above, but for the edit mode of the widget.
    *      - `reload` - {boolean} - true if the widget should be reloaded, after the edit mode is closed.
    *        Default is true.
    *
    * @returns {Object} self
    */
    this.widget = function(name, widget){
      var w = angular.extend({reload: false}, widget);
      if ( w.edit ){
        var edit = {reload: true};
        angular.extend(edit, w.edit);
        w.edit = edit;
      }
      widgets[name] = w;
      return this;
    };

    /**
     * @ngdoc method
     * @name adf.dashboardProvider#widgetsPath
     * @methodOf adf.dashboardProvider
     * @description
     *
     * Sets the path to the directory which contains the widgets. The widgets
     * path is used for widgets with a templateUrl which contains the
     * placeholder {widgetsPath}. The placeholder is replaced with the
     * configured value, before the template is loaded, but the template is
     * cached with the unmodified templateUrl (e.g.: {widgetPath}/src/widgets).
     * The default value of widgetPaths is ''.
     *
     *
     * @param {string} path to the directory which contains the widgets
     *
     * @returns {Object} self
     */
    this.widgetsPath = function(path){
      widgetsPath = path;
      return this;
    };

   /**
    * @ngdoc method
    * @name adf.dashboardProvider#structure
    * @methodOf adf.dashboardProvider
    * @description
    *
    * Registers a new structure.
    *
    * @param {string} name of the structure
    * @param {object} structure to be registered.
    *
    *   Object properties:
    *
    *   - `rows` - `{Array.<Object>}` - Rows of the dashboard structure.
    *     - `styleClass` - `{string}` - CSS Class of the row.
    *     - `columns` - `{Array.<Object>}` - Columns of the row.
    *       - `styleClass` - `{string}` - CSS Class of the column.
    *
    * @returns {Object} self
    */
    this.structure = function(name, structure){
      structures[name] = structure;
      return this;
    };

   /**
    * @ngdoc method
    * @name adf.dashboardProvider#messageTemplate
    * @methodOf adf.dashboardProvider
    * @description
    *
    * Changes the template for messages.
    *
    * @param {string} template for messages.
    *
    * @returns {Object} self
    */
    this.messageTemplate = function(template){
      messageTemplate = template;
      return this;
    };

   /**
    * @ngdoc method
    * @name adf.dashboardProvider#loadingTemplate
    * @methodOf adf.dashboardProvider
    * @description
    *
    * Changes the template which is displayed as
    * long as the widget resources are not resolved.
    *
    * @param {string} loading template
    *
    * @returns {Object} self
    */
    this.loadingTemplate = function(template){
      loadingTemplate = template;
      return this;
    };

   /**
    * @ngdoc service
    * @name adf.dashboard
    * @description
    *
    * The dashboard holds all options, structures and widgets.
    *
    * @property {Array.<Object>} widgets Array of registered widgets.
    * @property {string} widgetsPath Default path for widgets.
    * @property {Array.<Object>} structures Array of registered structures.
    * @property {string} messageTemplate Template for messages.
    * @property {string} loadingTemplate Template for widget loading.
    *
    * @returns {Object} self
    */
    this.$get = function(){
      var cid = 0;

      return {
        widgets: widgets,
        widgetsPath: widgetsPath,
        structures: structures,
        messageTemplate: messageTemplate,
        loadingTemplate: loadingTemplate,
          setLocale: this.setLocale,
          locales: getLocales,
          activeLocale: getActiveLocale,
          translate: translate,
          customWidgetTemplatePath: customWidgetTemplatePath,

        /**
         * @ngdoc method
         * @name adf.dashboard#id
         * @methodOf adf.dashboard
         * @description
         *
         * Creates an ongoing numeric id. The method is used to create ids for
         * columns and widgets in the dashboard.
         */
        id: function(){
          return ++cid;
        }
      };
    };

  });


text:
package p1;

public class MyException {

}