text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Enquêtes ouvertes</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <link href="/css/bootstrap.min.css" rel="stylesheet">
  <link href="/css/hc.css" rel="stylesheet">
  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">

 journocamp

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            Toggle navigation

          </button>

Le #journocamp ?

Ils soutiennent #journocamp

Contactez-nous

Les décodeurs @lemonde

Investigation & France

Premier pas sur GitHub

Enquêtes ouvertes

Les newsgames

Reportage et vidéo légère

racontr & les longs formats

MOOC sur le journalisme

Crowdfunding

Q&A autour de Google+

Le #journocamp ?

Ils soutiennent #journocamp

Contactez-nous

Les compte-rendus / ateliers

. Les décodeurs @lemonde

. Investigation & France

. Premier pas sur GitHub

. Enquêtes ouvertes

. Les newsgames

. Reportage et vidéo légère

. racontr & les longs formats

. MOOC sur le journalisme

. Crowdfunding

. Q&A autour de Google+

Téléchargez l'Intégrale en pdf

  @twitter

  google+

  facebook

  github

Enquêtes ouvertes

  01 May 2014

Initiateur : Tatiana Kalougine

Rapporteur : Cédric Motte

Editeur : Cédric Motte

Une enquête ouverte, qu'est-ce donc ? (un peu de contexte hors atelier)
Une enquête ouverte est une enquête dont les avancées sont publiées en ligne au fur et à mesure, au lieu d'attendre d'être arrivé à un "produit fini".
Cela signifie que le sujet de l'enquête est public, que les lecteurs sont appelés à participer via du crowdsourcing pour ceux qui ont des infos, et via du crowdfunding pour ceux qui ont (un peu) de brouzouf.

Ce qui s'est dit pendant l'atelier

1-. Ultra nécessaire de lancer des enquêtes "concernantes" pour avoir des retours.

Laissez tomber les grands sujets politiques ou économiques : si cela ne touche pas directement le quotidien des gens ou d'une population précise de personnes ayant un vécu commun, alors vous n'aurez pas de retour.

Intéressante remarque de Jonathan Parienté : les décodeurs ont lancé un grand sujet de crowdsourcing sur les programmes des maires élus commune par commune : peu de retours car, et oui, les élections municipales n'excitent pas les foules.

2-. Difficulté de mener des enquêtes quand on est un média professionnel où ce sont les lecteurs qui sont les acteurs des enquêtes.

Benjamin Mazon de la Gazette explique qu'en tant que média pro, lancer des enquêtes n'est pas toujours évident car vos lecteurs sont vos acheteurs, vos annonceurs, vos pourvoyeurs d'infos… Mais il ajoute par contre qu'un média pro peut se faire l'écho d'enquêtes ouvertes menées à l'extérieur.

3-. Quelle crédibilité vis-à-vis des lecteurs, de ceux qui détiennent l'information et des autres médias quand on est une jeune plateforme comme enquêtes ouvertes ?

Tatiana explique que la collecte de fonds lance le mouvement en annonçant le sujet et la façon dont il va être traité. L'étape crowdfunding est une sorte d'étude de marché : est-ce que le sujet intéresse ? Et surtout, intéresse-t-il au point que des personnes sont prêtes à payer ?
Tatiana ajoute qu'un sujet qui touche des victimes - d'une erreur de l'Etat, de filoux de la finance, de malfaisants immobiliers, peu importe - déjà organisées en groupe / association simplifie évidemment considérablement le processus d'intérêt / funding.

Une fois l'enquête "validée" par l'appel de fond, il faut - au sens "il faut vraiment c'est très très important" -  publier régulièrement de nouveaux éléments pour que les lecteurs gagnent peu à peu la confiance. Nouveaux éléments qui seront nettoyés de toute personnalisation bien entendu.

4-.  Tenter une sorte d'industrialisation du fonctionnement collaboratif mis en place pour wikileaks avec la constitution d'un réseau d'enquêteurs et de distribution au niveau national et international.

Mark Lee Hunter précise que ce type de fonctionnement rejoint celui du GIJN - Global Investigative Journalism Network. Le principe : les médias / journalistes indépendant doivent travailler en groupe, hors des murs des médias et hors des frontières, pour contrer et pouvoir enquêter sur des entreprises qui ont une dimension mondiale.

Il annonce la création du JEFA, l'assocation des Journalistes Enquêteurs Francophones Associés, branche francophone du GIJN.

[Réflexion perso : me demande si les décodeurs n'auraient pas intérêt à faire un partenariat avec les journaux de PQR pour récupérer / travailler sur les programmes des maires]

5-. Pour le moment enquête ouverte est un projet qui porte ses propres enquêtes, mais  à terme enquête ouverte pourrait devenir une agence / start-up qui va aider des journalistes confirmés à lancer une enquête en leur apporter des compétences crowdsourcing / crowdfounding.

La "poubelle" des notes en vrac.

Journalistes enquêteurs francophones associés
- Mutualisation réseau journalistes sur investigation
- Cooptation pour entrer dans le réseau des journalistes

Enquêtes ouvertes sur le tourisme
- Financement des data ---- entreprises indépendantes sur l'enquête construisent tous des bases de données qui permettent de sortir des produits dérivés : livres, séminaires, etc sur les droits.

Après une bonne enquête, le journaliste devient plus expert que chacune de ses sources.

Et intégrer les experts dans les équipes.

Achat dans résidence de tourisme pour défiscalisation mais en fait le gestionnaire est parti avec l'argent…

D'où l'idée d'un site pour que les gens peuvent contacter un journaliste pour en savoir plus.

KKBB 7 500 euros.

Enquête en cours, récupération de documents via la strongbox

Au final, création d'un média hyper spécialisé sur le tourisme.

Et le mois prochain on lance une enquête sur les décharges publiques.

Le Monde crowdenquête sur les programmes des maires élus : mais peu de retours

 Tweet

← Older

Newer →

    Please enable JavaScript to view the comments powered by Disqus.
    comments powered by Disqus

Ce premier #journocamp est soutenu par Eyrolles Samsa CFI Wan Ifra racontr France Medias Monde metronews tuto.com ESJ Pro ulule La Fonderie

CC/by  ·  #journocamp  - Un projet porté par Cédric Motte / newsresources.


text:
using Castle.DynamicProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CastleProxyDemo
{
    public class MixinDemo
    {
        public static void Test()
        {
            ProxyGenerator generator = new ProxyGenerator();
            var options = new ProxyGenerationOptions();
            options.AddMixinInstance(new ClassA());
            MixClass mixclass = generator.CreateClassProxy<MixClass>(options, new TestInterceptor1());

            mixclass.run("A");

            IClassBase objA = mixclass as IClassBase;
            objA.Execute("CA");
            Console.ReadKey();
        }

        public class MixClass
        {
            public void run(string msg)
            {
                Console.WriteLine("MixClass-run-"+ msg);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
NSString *const kZHFailedErrorsMessage = @"message";
NSString *const kZHFailedErrorsType = @"type";

@interface ZHFailedErrors ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation ZHFailedErrors

@synthesize message = _message;
@synthesize type = _type;

+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];

    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.message = [self objectOrNilForKey:kZHFailedErrorsMessage fromDictionary:dict];
            self.type = [self objectOrNilForKey:kZHFailedErrorsType fromDictionary:dict];

    }

    return self;

}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:self.message forKey:kZHFailedErrorsMessage];
    [mutableDict setValue:self.type forKey:kZHFailedErrorsType];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}

#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.message = [aDecoder decodeObjectForKey:kZHFailedErrorsMessage];
    self.type = [aDecoder decodeObjectForKey:kZHFailedErrorsType];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeObject:_message forKey:kZHFailedErrorsMessage];
    [aCoder encodeObject:_type forKey:kZHFailedErrorsType];
}

- (id)copyWithZone:(NSZone *)zone
{
    ZHFailedErrors *copy = [[ZHFailedErrors alloc] init];

    if (copy) {

        copy.message = [self.message copyWithZone:zone];
        copy.type = [self.type copyWithZone:zone];
    }

    return copy;
}

@end


text:
from django.conf.urls import url
from . import views

app_name = 'manage_music'
urlpatterns = [
    url(r'^$', views.HomePageView.as_view(), name='index'),
    url(r'^about/$', views.AboutPageView.as_view(), name='about'),
    url(r'^tracks/add/$', views.MusicDatabaseView.as_view(), name='add_track'),
    url(r'^tracks/refresh/$', views.MusicDatabaseView.as_view(), name='refresh_tracks'),

]


text:
package io.ray.streaming.api.stream;

import com.google.common.base.Preconditions;
import io.ray.streaming.api.Language;
import io.ray.streaming.api.context.StreamingContext;
import io.ray.streaming.api.partition.Partition;
import io.ray.streaming.api.partition.impl.ForwardPartition;
import io.ray.streaming.operator.ChainStrategy;
import io.ray.streaming.operator.Operator;
import io.ray.streaming.operator.StreamOperator;
import io.ray.streaming.python.PythonPartition;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Abstract base class of all stream types.
 *
 * @param <S> Type of stream class
 * @param <T> Type of the data in the stream.
 */
public abstract class Stream<S extends Stream<S, T>, T> implements Serializable {

  private final int id;
  private final StreamingContext streamingContext;
  private final Stream inputStream;
  private final StreamOperator operator;
  private int parallelism = 1;
  private Map<String, String> config = new HashMap<>();
  private Partition<T> partition;
  private Stream originalStream;

  public Stream(StreamingContext streamingContext, StreamOperator streamOperator) {
    this(streamingContext, null, streamOperator, getForwardPartition(streamOperator));
  }

  public Stream(
      StreamingContext streamingContext, StreamOperator streamOperator, Partition<T> partition) {
    this(streamingContext, null, streamOperator, partition);
  }

  public Stream(Stream inputStream, StreamOperator streamOperator) {
    this(
        inputStream.getStreamingContext(),
        inputStream,
        streamOperator,
        getForwardPartition(streamOperator));
  }

  public Stream(Stream inputStream, StreamOperator streamOperator, Partition<T> partition) {
    this(inputStream.getStreamingContext(), inputStream, streamOperator, partition);
  }

  protected Stream(
      StreamingContext streamingContext,
      Stream inputStream,
      StreamOperator streamOperator,
      Partition<T> partition) {
    this.streamingContext = streamingContext;
    this.inputStream = inputStream;
    this.operator = streamOperator;
    this.partition = partition;
    this.id = streamingContext.generateId();
    if (inputStream != null) {
      this.parallelism = inputStream.getParallelism();
    }
  }

  /**
   * Create a proxy stream of original stream. Changes in new stream will be reflected in original
   * stream and vice versa
   */
  protected Stream(Stream originalStream) {
    this.originalStream = originalStream;
    this.id = originalStream.getId();
    this.streamingContext = originalStream.getStreamingContext();
    this.inputStream = originalStream.getInputStream();
    this.operator = originalStream.getOperator();
    Preconditions.checkNotNull(operator);
  }

  @SuppressWarnings("unchecked")
  private static <T> Partition<T> getForwardPartition(Operator operator) {
    switch (operator.getLanguage()) {
      case PYTHON:
        return (Partition<T>) PythonPartition.ForwardPartition;
      case JAVA:
        return new ForwardPartition<>();
      default:
        throw new UnsupportedOperationException("Unsupported language " + operator.getLanguage());
    }
  }

  public int getId() {
    return id;
  }

  public StreamingContext getStreamingContext() {
    return streamingContext;
  }

  public Stream getInputStream() {
    return inputStream;
  }

  public StreamOperator getOperator() {
    return operator;
  }

  @SuppressWarnings("unchecked")
  private S self() {
    return (S) this;
  }

  public int getParallelism() {
    return originalStream != null ? originalStream.getParallelism() : parallelism;
  }

  public S setParallelism(int parallelism) {
    if (originalStream != null) {
      originalStream.setParallelism(parallelism);
    } else {
      this.parallelism = parallelism;
    }
    return self();
  }

  @SuppressWarnings("unchecked")
  public Partition<T> getPartition() {
    return originalStream != null ? originalStream.getPartition() : partition;
  }

  @SuppressWarnings("unchecked")
  protected S setPartition(Partition<T> partition) {
    if (originalStream != null) {
      originalStream.setPartition(partition);
    } else {
      this.partition = partition;
    }
    return self();
  }

  public S withConfig(Map<String, String> config) {
    config.forEach(this::withConfig);
    return self();
  }

  public S withConfig(String key, String value) {
    if (isProxyStream()) {
      originalStream.withConfig(key, value);
    } else {
      this.config.put(key, value);
    }
    return self();
  }

  @SuppressWarnings("unchecked")
  public Map<String, String> getConfig() {
    return isProxyStream() ? originalStream.getConfig() : config;
  }

  public boolean isProxyStream() {
    return originalStream != null;
  }

  public Stream getOriginalStream() {
    Preconditions.checkArgument(isProxyStream());
    return originalStream;
  }

  /** Set chain strategy for this stream */
  public S withChainStrategy(ChainStrategy chainStrategy) {
    Preconditions.checkArgument(!isProxyStream());
    operator.setChainStrategy(chainStrategy);
    return self();
  }

  /** Disable chain for this stream */
  public S disableChain() {
    return withChainStrategy(ChainStrategy.NEVER);
  }

  /**
   * Set the partition function of this {@link Stream} so that output elements are forwarded to next
   * operator locally.
   */
  public S forward() {
    return setPartition(getForwardPartition(operator));
  }

  public abstract Language getLanguage();
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _express = require('express');

var _express2 = _interopRequireDefault(_express);

var _expressValidation = require('express-validation');

var _expressValidation2 = _interopRequireDefault(_expressValidation);

var _userValidation = require('../config/user-validation');

var _userValidation2 = _interopRequireDefault(_userValidation);

var _controllers = require('../controllers');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var router = _express2.default.Router(); // eslint-disable-line new-cap

router.route('/')
/** GET /api/organizations - Get list of organizations */
.get(function (req, res, next) {
  return _controllers.OrganizationCtrl.list(req, res, next).then(function (organizations) {
    return res.json(organizations);
  });
})

/** POST /api/organizations - Create new organization */
.post(function (req, res, next) {
  return _controllers.OrganizationCtrl.create(req, res, next).then(function (organization) {
    return res.json(organization);
  });
});
//.post(AuthCtrl.verifyToken,OrganizationCtrl.create);
// .post(validate(paramValidation.createUser), OrganizationCtrl.create);

router.route('/:id')
/** GET /api/organizations/:id - Get organization */
.get(_controllers.AuthCtrl.verifyToken, function (req, res, next) {
  return res.json(_controllers.OrganizationCtrl.get(req, res, next));
})

/** PUT /api/organizations/:id - Update organization */
.put(function (req, res, next) {
  return _controllers.OrganizationCtrl.update(req, res, next).then(function (organization) {
    return res.json(organization);
  });
})

/** DELETE /api/organizations/:id - Delete organization */
.delete(_controllers.AuthCtrl.verifyToken, function (req, res, next) {
  return _controllers.OrganizationCtrl.remove(req, res, next).then(function (organization) {
    return res.json(organization);
  });
});

/** Load user when API with userId route parameter is hit */
router.param('id', _controllers.OrganizationCtrl.load);

exports.default = router;
//# sourceMappingURL=organization-routes.js.map


text:
import collections
import os
import sys

import benchexec.util

sys.dont_write_bytecode = True  # prevent creation of .pyc files

def parse_vcloud_run_result(values):
    result_values = collections.OrderedDict()

    def parse_time_value(s):
        if s[-1] != "s":
            raise ValueError(f'Cannot parse "{s}" as a time value.')
        return float(s[:-1])

    def set_exitcode(new):
        if "exitcode" in result_values:
            old = result_values["exitcode"]
            assert (
                old == new
            ), f"Inconsistent exit codes {old} and {new} from VerifierCloud"
        else:
            result_values["exitcode"] = new

    for key, value in values:
        value = value.strip()
        if key in ["cputime", "walltime"]:
            result_values[key] = parse_time_value(value)
        elif key == "memory":
            result_values["memory"] = int(value.strip("B"))
        elif key == "exitcode":
            set_exitcode(benchexec.util.ProcessExitCode.from_raw(int(value)))
        elif key == "returnvalue":
            set_exitcode(benchexec.util.ProcessExitCode.create(value=int(value)))
        elif key == "exitsignal":
            set_exitcode(benchexec.util.ProcessExitCode.create(signal=int(value)))
        elif (
            key in ["host", "terminationreason", "cpuCores", "memoryNodes", "starttime"]
            or key.startswith("blkio-")
            or key.startswith("cpuenergy")
            or key.startswith("energy-")
            or key.startswith("cputime-cpu")
        ):
            result_values[key] = value
        elif key not in ["command", "timeLimit", "coreLimit", "memoryLimit"]:
            result_values["vcloud-" + key] = value

    return result_values

def parse_frequency_value(s):
    # Contrary to benchexec.util.parse_frequency_value, this handles float values.
    if not s:
        return s
    s = s.strip()
    pos = len(s)
    while pos and not s[pos - 1].isdigit():
        pos -= 1
    number = float(s[:pos])
    unit = s[pos:].strip()
    if not unit or unit == "Hz":
        return int(number)
    elif unit == "kHz":
        return int(number * 1000)
    elif unit == "MHz":
        return int(number * 1000 * 1000)
    elif unit == "GHz":
        return int(number * 1000 * 1000 * 1000)
    else:
        raise ValueError(f"unknown unit: {unit} (allowed are Hz, kHz, MHz, and GHz)")

def is_windows():
    return os.name == "nt"

def force_linux_path(path):
    if is_windows():
        return path.replace("\\", "/")
    return path


text:
from .._events import *
from .._state import *
from .._connection import *

def get_all_events(conn):
    got_events = []
    while True:
        event = conn.next_event()
        if event in (NEED_DATA, PAUSED):
            break
        got_events.append(event)
        if type(event) is ConnectionClosed:
            break
    return got_events

def receive_and_get(conn, data):
    conn.receive_data(data)
    return get_all_events(conn)

# Merges adjacent Data events, converts payloads to bytestrings, and removes
# chunk boundaries.
def normalize_data_events(in_events):
    out_events = []
    for event in in_events:
        if type(event) is Data:
            event.data = bytes(event.data)
            event.chunk_start = False
            event.chunk_end = False
        if out_events and type(out_events[-1]) is type(event) is Data:
            out_events[-1].data += event.data
        else:
            out_events.append(event)
    return out_events

# Given that we want to write tests that push some events through a Connection
# and check that its state updates appropriately... we might as make a habit
# of pushing them through two Connections with a fake network link in
# between.
class ConnectionPair:
    def __init__(self):
        self.conn = {CLIENT: Connection(CLIENT), SERVER: Connection(SERVER)}
        self.other = {CLIENT: SERVER, SERVER: CLIENT}

    @property
    def conns(self):
        return self.conn.values()

    # expect="match" if expect=send_events; expect=[...] to say what expected
    def send(self, role, send_events, expect="match"):
        if not isinstance(send_events, list):
            send_events = [send_events]
        data = b""
        closed = False
        for send_event in send_events:
            new_data = self.conn[role].send(send_event)
            if new_data is None:
                closed = True
            else:
                data += new_data
        # send uses b"" to mean b"", and None to mean closed
        # receive uses b"" to mean closed, and None to mean "try again"
        # so we have to translate between the two conventions
        if data:
            self.conn[self.other[role]].receive_data(data)
        if closed:
            self.conn[self.other[role]].receive_data(b"")
        got_events = get_all_events(self.conn[self.other[role]])
        if expect == "match":
            expect = send_events
        if not isinstance(expect, list):
            expect = [expect]
        assert got_events == expect
        return data


text:
package mf.org.w3c.dom.svg;

public interface SVGFontFaceSrcElement extends
               SVGElement {
}


text:
import unittest
from conans.test.utils.tools import TestClient
from conans.test.utils.python_test_files import py_hello_conan_files
import platform

class PythonDiamondTest(unittest.TestCase):

    def setUp(self):
        self.client = TestClient()

    def _export_upload(self, name, version=None, deps=None):
        files = py_hello_conan_files(name, version, deps)
        self.client.save(files, clean_first=True)
        self.client.run("export lasote/stable")

    def reuse_test(self):
        self._export_upload("Hello0", "0.1")
        self._export_upload("Hello1", "0.1", ["Hello0/0.1@lasote/stable"])
        self._export_upload("Hello2", "0.1", ["Hello0/0.1@lasote/stable"])
        self._export_upload("Hello3", "0.1", ["Hello1/0.1@lasote/stable",
                                              "Hello2/0.1@lasote/stable"])

        files3 = py_hello_conan_files("Hello4", "0.1", ["Hello3/0.1@lasote/stable"])
        self.client.save(files3, clean_first=True)

        self.client.run("install .")
        self.assertIn("Hello1/0.1@lasote/stable: Build stuff Hello0", self.client.user_io.out)
        self.assertIn("Hello2/0.1@lasote/stable: Build stuff Hello0", self.client.user_io.out)

        self.assertIn(" ".join(["Hello3/0.1@lasote/stable: Build stuff Hello1",
                                "Hello3/0.1@lasote/stable: Build stuff Hello0",
                                "Hello3/0.1@lasote/stable: Build stuff Hello2",
                                "Hello3/0.1@lasote/stable: Build stuff Hello0"]),
                      " ".join(str(self.client.user_io.out).splitlines()))
        self.assertNotIn("Project: Build stuff Hello3", self.client.user_io.out)

        self.client.run("build")
        self.assertIn("Project: Build stuff Hello3", self.client.user_io.out)

        if platform.system() == "Windows":
            command = "activate && python main.py"
        else:
            command = 'bash -c "source activate.sh && python main.py"'
        self.client.runner(command, cwd=self.client.current_folder)
        self.assertEqual(['Hello Hello4', 'Hello Hello3', 'Hello Hello1', 'Hello Hello0',
                          'Hello Hello2', 'Hello Hello0'],
                         str(self.client.user_io.out).splitlines()[-6:])


text:
<!DOCTYPE html>
<title>Chained identity url() filters with 'linearRGB' color-interpolation-filters</title>
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#FilterProperty">
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#propdef-color-interpolation-filters">
<link rel="match" href="reference/green-100x100.html">

<svg height="0">
  <filter id="identity">
    <feColorMatrix type="identity"/>
  </filter>
</svg>


text:
import React, { PropTypes, Component } from 'react'

export default class Obstacle extends Component {

    static get defaultProps() {
        return {
            data: {}
        };
    }

    static get propTypes() {
        return {
            data: PropTypes.object
        };
    }

    render() {
        const { data } = this.props;
        const styles = {
            left: data.x,
            top: data.y,
            width: data.width,
            height: data.height,
            backgroundImage: `url(${data.sprite})`
        };

        return (
            <div
                ref='obstacle'
                className='obstacle'
                style={ styles } />
        );
    }

}


text:
package net.redwarp.android.app.githubcount;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;

public class ProjectDetailActivity extends ActionBarActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    if (savedInstanceState == null) {
      String user = getIntent().getStringExtra("user");
      String repository = getIntent().getStringExtra("repository");

      ProjectDetailFragment fragment = ProjectDetailFragment.newInstance(user, repository);
      getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
    }
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
      finish();
      return true;
    } else {
      return super.onOptionsItemSelected(item);
    }
  }
}


text:
const CHUNK_INTERVAL = 1000;
const DELAY = 10 * 1000;

const screen = document.getElementById('screen');

const getWebcamStream = () => {
  const options = {
    video: true,
    permissions: {
      description: 'Please?!'
    }
  }
  //return navigator.mediaDevices.getUserMedia(options);
  //return MediaDevices.getUserMedia(options);
  return new Promise((resolve, reject) => {
    navigator.webkitGetUserMedia(options, resolve, reject);
  });
};

const recordAndPlay = (mediaRecorder) => {
  const blobs = [];
  let stopped = false;

  mediaRecorder.start(CHUNK_INTERVAL);
  mediaRecorder.ondataavailable = (event) => {
    blobs.push(event.data);
    if (stopped === true) {
      let megaBlob = new Blob(blobs, {type: 'video/webm'});
      screen.src = window.URL.createObjectURL(megaBlob);
      recordAndPlay(mediaRecorder);
    }
  };

  setTimeout(() => {
    mediaRecorder.stop();
    stopped = true;
  }, DELAY);
};

const handleVideo = (mediaStream) => {
  const opts = {mimeType: 'video/webm', bitsPerSecond: 100000}
  const mediaRecorder = new MediaRecorder(mediaStream, opts);

  recordAndPlay(mediaRecorder);
};

const handleError = (error) => {
  console.log("error:", error);
};

getWebcamStream().then(handleVideo, handleError);

document.getElementById('filter').addEventListener('change', (event) => {
  screen.style.webkitFilter = `url(#${event.target.value})`;
});


text:
package datadog

import (
	"log"

	"github.com/zorkian/go-datadog-api"
)

// Config holds API and APP keys to authenticate to Datadog.
type Config struct {
	APIKey string
	APPKey string
}

// Client returns a new Datadog client.
func (c *Config) Client() (*datadog.Client, error) {

	client := datadog.NewClient(c.APIKey, c.APPKey)

	log.Printf("[INFO] Datadog Client configured ")

	return client, nil
}


text:
package br.com.preventsenior.reclamacao.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="tipo_reclamacao")
@NamedQuery(name="TipoReclamacao.findAll", query="SELECT t FROM TipoReclamacao t")
public class TipoReclamacao {

	@Id
	@Column(name="ID")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	@Column(name="TIPO_DESCRICAO")
	private String tipoDescricao;

	@Column(name="TIPO_NOME")
	private String tipoNome;

	//bi-directional many-to-one association to Reclamacao
	@OneToMany(mappedBy="tipoReclamacao")
	private List<Reclamacao> reclamacaos;

	@Column(name="IC_ATIVO")
	private boolean ativo;

	public TipoReclamacao() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTipoDescricao() {
		return this.tipoDescricao;
	}

	public void setTipoDescricao(String tipoDescricao) {
		this.tipoDescricao = tipoDescricao;
	}

	public String getTipoNome() {
		return this.tipoNome;
	}

	public void setTipoNome(String tipoNome) {
		this.tipoNome = tipoNome;
	}

	public List<Reclamacao> getReclamacaos() {
		return this.reclamacaos;
	}

	public void setReclamacaos(List<Reclamacao> reclamacaos) {
		this.reclamacaos = reclamacaos;
	}

	public boolean isAtivo() {
		return ativo;
	}

	public void setAtivo(boolean ativo) {
		this.ativo = ativo;
	}
}


text:
<keymap version="1" name="Egan_Default" parent="$default">
  <action id="$Redo">
    <keyboard-shortcut first-keystroke="shift ctrl z" />
    <keyboard-shortcut first-keystroke="shift alt back_space" />
    <keyboard-shortcut first-keystroke="ctrl y" />
  </action>
  <action id="Editor Redo">
    <keyboard-shortcut first-keystroke="ctrl y" />
  </action>
  <action id="EditorDeleteLine">
    <keyboard-shortcut first-keystroke="alt l" />
  </action>
</keymap>


text:
package org.elassandra.action.admin.indices.rebuild;

import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.support.broadcast.BroadcastRequest;

/**
 * Re-index on all nodes from the underlying Cassandra tables.
 *
 * @see org.elasticsearch.client.Requests#rebuildRequest(String...)
 * @see org.elasticsearch.client.IndicesAdminClient#rebuild(RebuildRequest, ActionListener)
 * @see RebuildResponse
 */
public class RebuildRequest extends BroadcastRequest<RebuildRequest> {

    int numThreads = 1;

    public RebuildRequest() {
    }

    /**
     * Copy constructor that creates a new refresh request that is a copy of the one provided as an argument.
     * The new request will inherit though headers and context from the original request that caused it.
     */
    public RebuildRequest(ActionRequest originalRequest) {
        super(originalRequest);
    }

    public RebuildRequest(String... indices) {
        super(indices);
    }

    public int numThreads() {
        return numThreads;
    }

    public void numThreads(int numThreads) {
        this.numThreads = numThreads;
    }

}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MetroFramework.Forms;

namespace Nullify
{
    public partial class License : MetroForm
    {
        public License()
        {
            InitializeComponent();
        }

        private void License_Load(object sender, EventArgs e)
        {
            // nothing
        }

        private void metroLink1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.apache.org/licenses/LICENSE-2.0");
        }
    }
}


text:
package consequences

import "log"

type ExecuteShell struct {
}

func (s ExecuteShell) Execute(config map[string]interface{}) {
	log.Println("Consequence: Execute Shell")
}


text:
@interface PCAngularActivityIndicatorView ()

@property (nonatomic, strong) CAShapeLayer *shapeLayer;
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, assign) CGFloat duration;

@end

@implementation PCAngularActivityIndicatorView

- (id)init
{
    return [self initWithActivityIndicatorStyle:PCAngularActivityIndicatorViewStyleDefault];
}

- (id)initWithActivityIndicatorStyle:(PCAngularActivityIndicatorViewStyle)style
{
    CGRect frame;
    CGFloat lineWidth;
    CGFloat duration;

    switch (style) {
        case PCAngularActivityIndicatorViewStyleSmall:
            frame = CGRectMake(0, 0, 20, 20);
            lineWidth = 2.0;
            duration = 0.8;
            break;
        case PCAngularActivityIndicatorViewStyleDefault:
            frame = CGRectMake(0, 0, 30, 30);
            lineWidth = 4.0;
            duration = 0.8;
            break;
        case PCAngularActivityIndicatorViewStyleLarge:
            frame = CGRectMake(0, 0, 60, 60);
            lineWidth = 8.0;
            duration = 1.0;
            break;
        default:
            break;
    }

    if (self = [super initWithFrame:frame]) {

        self.contentView = [[UIView alloc] initWithFrame:self.bounds];
        [self addSubview:self.contentView];

        CGFloat radius = frame.size.width / 2;

        self.shapeLayer = [CAShapeLayer layer];
        self.shapeLayer.frame = self.bounds;
        self.shapeLayer.lineWidth = lineWidth;
        self.shapeLayer.fillColor = [[UIColor clearColor] CGColor];
        self.shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0 * radius, 2.0 * radius) cornerRadius:radius].CGPath;
        self.shapeLayer.lineCap = kCALineJoinRound;
        self.shapeLayer.hidden = YES;
        [self.contentView.layer insertSublayer:self.shapeLayer atIndex:0];

        // Defaults
        self.hidesWhenStopped = YES;
        self.duration = duration;
        self.color = [UIColor lightGrayColor];
    }

    return self;
}

- (void)startAnimating
{
    if (self.isAnimating) {
        return;
    }

    _animating = YES;

    CAKeyframeAnimation *inAnimation = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"];
    inAnimation.duration = self.duration;
    inAnimation.values = @[@(0), @(1)];

    CAKeyframeAnimation *outAnimation = [CAKeyframeAnimation animationWithKeyPath:@"strokeStart"];
    outAnimation.duration = self.duration;
    outAnimation.values = @[@(0), @(0.8), @(1)];
    outAnimation.beginTime = self.duration / 1.5;

    CAAnimationGroup *groupAnimation = [CAAnimationGroup animation];
    groupAnimation.animations = @[inAnimation, outAnimation];
    groupAnimation.duration = self.duration + outAnimation.beginTime;
    groupAnimation.repeatCount = INFINITY;
    groupAnimation.delegate = self;

    CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.fromValue = @(0);
    rotationAnimation.toValue = @(M_PI * 2);
    rotationAnimation.duration = self.duration * 1.5;
    rotationAnimation.repeatCount = INFINITY;

    [self.shapeLayer addAnimation:rotationAnimation forKey:nil];
    [self.shapeLayer addAnimation:groupAnimation forKey:nil];

    self.shapeLayer.hidden = NO;
}

- (void)stopAnimating
{
    [UIView animateWithDuration:0.5 animations:^{

        // Nice fade and ride
        self.contentView.transform = CGAffineTransformMakeScale(1.2, 1.2);
        self.contentView.alpha = 0.0;

    } completion:^(BOOL finished) {

        _animating = NO;

        /// ...and reset back
        self.contentView.transform = CGAffineTransformMakeScale(1.0, 1.0);
        self.contentView.alpha = 1.0;

        self.shapeLayer.hidden = self.hidesWhenStopped;
        [self.shapeLayer removeAllAnimations];
    }];
}

- (void)setColor:(UIColor *)color
{
    [self willChangeValueForKey:@"color"];

    _color = color;
    self.shapeLayer.strokeColor = [color CGColor];

    [self didChangeValueForKey:@"color"];
}

@end


text:
#ifndef SIMHASH_CYCLIC_H
#define SIMHASH_CYCLIC_H

#include <vector>

namespace Simhash {
    /* Keep a cyclic hash */
    template<typename Int>
    class Cyclic {
    public:
        /* An easy typedef */
        typedef Int hash_type;

        /* Useful elsewhere */
        static const size_t bits = sizeof(hash_type) * 8;

        Cyclic(size_t l=4): length(l), current(0), counter(0), tokens() {
            /* Initialize all of these to 0 */
            tokens.resize(length);
            for (size_t i = 0; i < l; ++i) {
                tokens[i] = 0;
            }
        }

        Cyclic(const Cyclic<hash_type>& o):
            length(o.length), current(o.current), counter(o.counter),
            tokens(o.tokens) {}

        const Cyclic<hash_type>& operator=(const Cyclic<hash_type>& o) {
            length  = o.length;
            current = o.current;
            counter = o.counter;
            tokens  = o.tokens;
            return *this;
        }

        /* Push a new hash onto the stack and get the return value */
        hash_type push(hash_type val) {
            /* Increment the counter. That's the index of the value we have to
             * pop off, and the index that we'll replace */
            current = rotate(current) ^ rotate(tokens[counter], length) ^ val;
            tokens[counter] = val;
            counter = (counter + 1) % length;
            return current;
        }

        /* Rotation shift by 1 */
        static inline hash_type rotate(hash_type v) {
            return (v << 1) | (v >> (bits - 1));
        }

        static inline hash_type rotate(hash_type v, size_t count) {
            count = count % bits;
            return (v << count) | (v >> ((bits - count) % bits));
        }
    private:
        size_t    length;  // How many pieces of data to store
        hash_type current; // Our current value
        size_t    counter; // Where we are in our tokens array

        std::vector<hash_type> tokens;  // Array holding our tokens
    };
}

#endif


text:
package org.apache.directory.api.ldap.codec;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

import org.apache.directory.api.asn1.DecoderException;
import org.apache.directory.api.asn1.ber.Asn1Container;
import org.apache.directory.api.asn1.ber.Asn1Decoder;
import org.apache.directory.api.asn1.ber.tlv.TLVStateEnum;
import org.apache.directory.api.ldap.codec.api.LdapDecoder;
import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
import org.apache.directory.api.ldap.codec.api.MessageDecorator;
import org.apache.directory.api.ldap.codec.api.ResponseCarryingException;
import org.apache.directory.api.ldap.codec.decorators.BindRequestDecorator;
import org.apache.directory.api.ldap.codec.osgi.AbstractCodecServiceTest;
import org.apache.directory.api.ldap.model.exception.ResponseCarryingMessageException;
import org.apache.directory.api.ldap.model.message.BindRequest;
import org.apache.directory.api.ldap.model.message.Message;
import org.apache.directory.api.util.Strings;
import org.apache.mina.core.session.DummySession;
import org.apache.mina.core.session.IoSession;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.mycila.junit.concurrent.Concurrency;
import com.mycila.junit.concurrent.ConcurrentJunitRunner;

/**
 * A global Ldap Decoder test
 *
 * @author Apache Directory Project
 */
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
public class LdapDecoderTest extends AbstractCodecServiceTest
{
    /** The ASN 1 decoder instance */
    private static Asn1Decoder asn1Decoder;

    @BeforeClass
    public static void init()
    {
        asn1Decoder = new Asn1Decoder();
    }

    /**
     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many
     * LDAP messages, which will be stored into the array the caller has created.
     *
     * @param buffer The incoming byte buffer
     * @param messageContainer The LdapMessageContainer which will be used to store the
     * message being decoded. If the message is not fully decoded, the ucrrent state
     * is stored into this container
     * @param decodedMessages The list of decoded messages
     * @throws Exception If the decoding failed
     */
    private void decode( ByteBuffer buffer, LdapMessageContainer<MessageDecorator<? extends Message>> messageContainer,
        List<Message> decodedMessages ) throws DecoderException
    {
        buffer.mark();

        while ( buffer.hasRemaining() )
        {
            try
            {
                asn1Decoder.decode( buffer, messageContainer );

                if ( messageContainer.getState() == TLVStateEnum.PDU_DECODED )
                {
                    Message message = messageContainer.getMessage();

                    decodedMessages.add( message );

                    messageContainer.clean();
                }
            }
            catch ( DecoderException de )
            {
                buffer.clear();
                messageContainer.clean();

                if ( de instanceof ResponseCarryingException )
                {
                    // Transform the DecoderException message to a MessageException
                    ResponseCarryingMessageException rcme = new ResponseCarryingMessageException( de.getMessage() );
                    rcme.setResponse( ( ( ResponseCarryingException ) de ).getResponse() );

                    throw rcme;
                }
                else
                {
                    // TODO : This is certainly not the way we should handle such an exception !
                    throw new ResponseCarryingException( de.getMessage() );
                }
            }
        }
    }

    /**
     * Test the decoding of a full PDU
     */
    @Test
    public void testDecodeFull()
    {
        Asn1Decoder ldapDecoder = new Asn1Decoder();
        LdapMessageContainer<MessageDecorator<? extends Message>> container =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        ByteBuffer stream = ByteBuffer.allocate( 0x35 );
        stream.put( new byte[]
            {
                0x30, 0x33, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                      // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication
                      // AuthenticationChoice
                      // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                      // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd'
        } );

        stream.flip();

        // Decode a BindRequest PDU
        try
        {
            ldapDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( TLVStateEnum.PDU_DECODED, container.getState() );

        // Check the decoded PDU
        BindRequest bindRequest = ( BindRequest ) container.getMessage();

        assertEquals( 1, bindRequest.getMessageId() );
        assertTrue( bindRequest.isVersion3() );
        assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
        assertTrue( bindRequest.isSimple() );
        assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
    }

    /**
     * Test the decoding of two messages in a PDU
     */
    @Test
    public void testDecode2Messages() throws Exception
    {
        LdapMessageContainer<MessageDecorator<? extends Message>> container =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        IoSession dummySession = new DummySession();
        dummySession.setAttribute( LdapDecoder.MESSAGE_CONTAINER_ATTR, container );

        ByteBuffer stream = ByteBuffer.allocate( 0x6A );
        stream.put( new byte[]
            {
                0x30, 0x33, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                      // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication
                      // AuthenticationChoice
                      // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                      // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd',
                0x30,
                0x33, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x02, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                      // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication
                      // AuthenticationChoice
                      // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                      // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd'
        } );

        stream.flip();

        List<Message> result = new ArrayList<Message>();

        // Decode a BindRequest PDU
        try
        {
            decode( stream, container, result );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        // Check the decoded PDU
        BindRequest bindRequest = ( BindRequest ) ( result.get( 0 ) );

        assertEquals( 1, bindRequest.getMessageId() );
        assertTrue( bindRequest.isVersion3() );
        assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
        assertTrue( bindRequest.isSimple() );
        assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );

        // The second message
        bindRequest = ( BindRequest ) ( result.get( 1 ) );

        assertEquals( 2, bindRequest.getMessageId() );
        assertTrue( bindRequest.isVersion3() );
        assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
        assertTrue( bindRequest.isSimple() );
        assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
    }

    /**
     * Test the decoding of a partial PDU
     */
    @Test
    public void testDecodePartial()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 16 );
        stream.put( new byte[]
            { 0x30, 0x33, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=' } );

        stream.flip();

        // Allocate a LdapMessage Container
        LdapMessageContainer<BindRequestDecorator> container = new LdapMessageContainer<BindRequestDecorator>( codec );

        // Decode a BindRequest PDU
        try
        {
            ldapDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( TLVStateEnum.VALUE_STATE_PENDING, container.getState() );

        // Check the decoded PDU
        BindRequest bindRequest = container.getMessage();

        assertEquals( 1, bindRequest.getMessageId() );
        assertTrue( bindRequest.isVersion3() );
        assertEquals( null, bindRequest.getName() );
        assertTrue( bindRequest.isSimple() );
    }

    /**
     * Test the decoding of a splitted PDU
     */
    @Test
    public void testDecodeSplittedPDU()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 16 );
        stream.put( new byte[]
            { 0x30, 0x33, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=' } );

        stream.flip();

        // Allocate a LdapMessage Container
        LdapMessageContainer<BindRequestDecorator> container = new LdapMessageContainer<BindRequestDecorator>( codec );

        // Decode a BindRequest PDU first block of data
        try
        {
            ldapDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( TLVStateEnum.VALUE_STATE_PENDING, container.getState() );

        // Second block of data
        stream = ByteBuffer.allocate( 37 );
        stream.put( new byte[]
            { 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',',
                'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0x80, 0x08, // authentication
                // AuthenticationChoice
                // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd' } );

        stream.flip();

        // Decode a BindRequest PDU second block of data
        try
        {
            ldapDecoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( container.getState(), TLVStateEnum.PDU_DECODED );

        // Check the decoded PDU
        BindRequest bindRequest = container.getMessage();

        assertEquals( 1, bindRequest.getMessageId() );
        assertTrue( bindRequest.isVersion3() );
        assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
        assertTrue( bindRequest.isSimple() );
        assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
    }

    /**
     * Test the decoding of a PDU with a bad Length. The first TLV has a length
     * of 0x32 when the PDU is 0x33 bytes long.
     */
    @Test
    public void testDecodeBadLengthTooSmall()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x35 );
        stream.put( new byte[]
            {
                // Length should be 0x33...
                0x30,
                0x32, // LDAPMessage ::=SEQUENCE {
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication
                // AuthenticationChoice
                // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd' } );

        stream.flip();

        // Allocate a LdapMessage Container
        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        // Decode a BindRequest PDU
        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            assertEquals(
                "ERR_00008_VALUE_LENGTH_ABOVE_EXPECTED_LENGTH The current Value length 48 is above the expected length 47",
                de.getMessage() );
            return;
        }

        fail( "Should never reach this point.." );
    }

    /**
     * Test the decoding of a PDU with a bad primitive Length. The second TLV
     * has a length of 0x02 when the PDU is 0x01 bytes long.
     */
    @Test
    public void testDecodeBadPrimitiveLengthTooBig()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x35 );
        stream.put( new byte[]
            { 0x30,
                0x33, // LDAPMessage ::=SEQUENCE {
                // Length should be 0x01...
                0x02,
                0x02,
                0x01, // messageID MessageID
                0x60,
                0x2E, // CHOICE { ..., bindRequest BindRequest, ...
                // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication AuthenticationChoice
                // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r' } );

        stream.flip();

        // Allocate a LdapMessage Container
        Asn1Container ldapMessageContainer =
            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        // Decode a BindRequest PDU
        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            assertEquals( "ERR_00001_BAD_TRANSITION_FROM_STATE Bad transition from state MESSAGE_ID_STATE, tag 0x2E",
                de.getMessage() );
            return;
        }

        fail( "Should never reach this point." );
    }

    /**
     * Test the decoding of a PDU with a bad primitive Length. The second TLV
     * has a length of 0x02 when the PDU is 0x01 bytes long.
     */
    @Test
    public void testDecodeBadTagTransition()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 0x35 );
        stream.put( new byte[]
            { 0x30,
                0x33, // LDAPMessage ::=SEQUENCE {
                // Length should be 0x01...
                0x02,
                0x01,
                0x01, // messageID MessageID
                0x2D,
                0x2D, // CHOICE { ..., bindRequest BindRequest, ...
                // BindRequest ::= APPLICATION[0] SEQUENCE {
                0x02,
                0x01,
                0x03, // version INTEGER (1..127),
                0x04,
                0x1F, // name LDAPDN,
                'u',
                'i',
                'd',
                '=',
                'a',
                'k',
                'a',
                'r',
                'a',
                's',
                'u',
                'l',
                'u',
                ',',
                'd',
                'c',
                '=',
                'e',
                'x',
                'a',
                'm',
                'p',
                'l',
                'e',
                ',',
                'd',
                'c',
                '=',
                'c',
                'o',
                'm',
                ( byte ) 0x80,
                0x08, // authentication
                // AuthenticationChoice
                // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                // ...
                'p',
                'a',
                's',
                's',
                'w',
                'o',
                'r',
                'd' } );

        stream.flip();

        // Allocate a LdapMessage Container
        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        // Decode a BindRequest PDU
        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            assertEquals( "ERR_00001_BAD_TRANSITION_FROM_STATE Bad transition from state MESSAGE_ID_STATE, tag 0x2D",
                de.getMessage() );
            return;
        }

        fail( "Should never reach this point." );
    }

    /**
     * Test the decoding of a split Length.
     *
     * The length is 3 bytes long, but the PDU has been split
     * just after the first byte
     */
    @Test
    public void testDecodeSplittedLength()
    {

        Asn1Decoder ldapDecoder = new Asn1Decoder();

        ByteBuffer stream = ByteBuffer.allocate( 3 );
        stream.put( new byte[]
            { 0x30, ( byte ) 0x82, 0x01,// LDAPMessage ::=SEQUENCE {
            } );

        stream.flip();

        // Allocate a LdapMessage Container
        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );

        // Decode a BindRequest PDU first block of data
        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( TLVStateEnum.LENGTH_STATE_PENDING, ldapMessageContainer.getState() );

        // Second block of data
        stream = ByteBuffer.allocate( 1 );
        stream.put( new byte[]
            { ( byte ) 0x80 // End of the length
        } );

        stream.flip();

        // Decode a BindRequest PDU second block of data
        try
        {
            ldapDecoder.decode( stream, ldapMessageContainer );
        }
        catch ( DecoderException de )
        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        assertEquals( TLVStateEnum.TAG_STATE_START, ldapMessageContainer.getState() );

        // Check the decoded length
        assertEquals( 384, ldapMessageContainer.getCurrentTLV().getLength() );
    }
}


text:
package club.baidu.hust.edu.cn.csapp.util;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;

import club.baidu.hust.edu.cn.csapp.R;
import club.baidu.hust.edu.cn.csapp.activity.MainActivity;
import club.baidu.hust.edu.cn.csapp.model.ActivityCollector;

/**
 * Created by jiadong on 2015/7/16.
 */
public class DialogUtil {

    public static void showDialog(final Context context, String msg, boolean goHome) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context)
                .setMessage(msg).setCancelable(false);
        if (goHome) {
            builder.setPositiveButton(R.string.sure, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Intent intent = new Intent(context, MainActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    context.startActivity(intent);
                }
            });
        } else {
            builder.setPositiveButton(R.string.sure, null);
        }

        builder.create().show();
    }

    public static void showDialog(Context context, View view) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context)
                .setCancelable(false)
                .setView(view)
                .setPositiveButton(R.string.sure, null);
        builder.create().show();
    }

    public static void showDialog(final Context context, String msg) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setMessage(msg)
                .setCancelable(false)
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCollector.finishAll();
                    }
                })
                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
        builder.create().show();
    }
}


text:
/***** includes *****/
#include "lfds720_queue_umm_internal.h"

/****************************************************************************/
void lfds720_queue_umm_enqueue( struct lfds720_queue_umm_state *qummhps,
                                      struct lfds720_queue_umm_element *qummhpe,
                                      struct lfds720_smrhp_per_thread_state *smrhpts )
{
  char unsigned
    result = 0;

  enum lfds720_misc_flag
    finished_flag = LFDS720_MISC_FLAG_LOWERED;

  lfds720_pal_uint_t
    backoff_iteration = LFDS720_BACKOFF_INITIAL_VALUE;

  struct lfds720_queue_umm_element LFDS720_PAL_ALIGN(LFDS720_PAL_DOUBLE_POINTER_LENGTH_IN_BYTES)
    *volatile enqueue,
    *new_enqueue,
    *volatile next;

  LFDS720_PAL_ASSERT( qummhps != NULL );
  LFDS720_PAL_ASSERT( qummhpe != NULL );
  LFDS720_PAL_ASSERT( (lfds720_pal_uint_t) qummhpe->next % LFDS720_PAL_SINGLE_POINTER_LENGTH_IN_BYTES == 0 );
  LFDS720_PAL_ASSERT( smrhpts != NULL );

  qummhpe->next = NULL;
  LFDS720_MISC_BARRIER_STORE;

  new_enqueue = qummhpe;

  LFDS720_MISC_BARRIER_LOAD;

  do
  {
    /* TRD : note here the deviation from the white paper
             in the white paper, next is loaded from enqueue, not from qummhps->enqueue
             what concerns me is that between the load of enqueue and the load of
             enqueue->next, the element can be dequeued by another thread *and freed*

             by ordering the loads (load barriers), and loading both from qummhps,
             the following if(), which checks enqueue is still the same as qummhps->enqueue
             still continues to ensure next belongs to enqueue, while avoiding the
             problem with free
    */

    LFDS720_SMRHP_MAKE_ALLOCATION_UNRECLAIMABLE( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_POINTER, qummhps->enqueue );

    enqueue = LFDS720_SMRHP_GET_HAZARD_POINTER( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_POINTER );

    LFDS720_MISC_BARRIER_LOAD;

    LFDS720_SMRHP_MAKE_ALLOCATION_UNRECLAIMABLE( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_NEXT_POINTER, enqueue->next );

    next = LFDS720_SMRHP_GET_HAZARD_POINTER( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_NEXT_POINTER );

    LFDS720_MISC_BARRIER_LOAD;

    if( qummhps->enqueue == enqueue )
    {
      if( next == NULL )
      {
        LFDS720_PAL_ATOMIC_CAS( enqueue->next, next, new_enqueue, LFDS720_MISC_CAS_STRENGTH_WEAK, result );
        if( result == 1 )
          finished_flag = LFDS720_MISC_FLAG_RAISED;
      }
      else
      {
        // TRD : strictly, this is a weak CAS, but we do an extra iteration of the main loop on a fake failure, so we set it to be strong
        LFDS720_PAL_ATOMIC_CAS( qummhps->enqueue, enqueue, next, LFDS720_MISC_CAS_STRENGTH_STRONG, result );
      }
    }
    else
      result = 0;

    LFDS720_SMRHP_MAKE_ALLOCATION_RECLAIMABLE( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_NEXT_POINTER );

    LFDS720_SMRHP_MAKE_ALLOCATION_RECLAIMABLE( *smrhpts, LFDS720_QUEUE_UMM_HAZARD_POINTER_INDEX_ENQUEUE_POINTER );

    if( result == 0 )
      LFDS720_BACKOFF_EXPONENTIAL_BACKOFF( qummhps->enqueue_backoff, backoff_iteration );
  }
  while( finished_flag == LFDS720_MISC_FLAG_LOWERED );

  // TRD : move enqueue along; only a weak CAS as the dequeue will solve this if it's out of place
  LFDS720_PAL_ATOMIC_CAS( qummhps->enqueue, enqueue, new_enqueue, LFDS720_MISC_CAS_STRENGTH_WEAK, result );

  if( result == 0 )
    LFDS720_BACKOFF_EXPONENTIAL_BACKOFF( qummhps->enqueue_backoff, backoff_iteration );

  LFDS720_BACKOFF_AUTOTUNE( qummhps->enqueue_backoff, backoff_iteration );

  return;
}


text:
package org.apache.flink.api.java.summarize.aggregation;

import org.apache.flink.annotation.Internal;

/**
 * Generic interface for aggregation
 *
 * @param <T> the type to be aggregated
 * @param <R> the result type of the aggregation
 */
@Internal
public interface Aggregator<T,R> extends java.io.Serializable {

	/** Add a value to the current aggregation */
	void aggregate(T value);

	/**
	 * Combine two aggregations of the same type.
	 *
	 * (Implementations will need to do an unchecked cast).
	 */
	void combine(Aggregator<T,R> otherSameType);

	/** Provide the final result of the aggregation */
	R result();
}