text:
package com.google.errorprone.bugpatterns;

import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
import static com.google.errorprone.matchers.Matchers.allOf;
import static com.google.errorprone.matchers.Matchers.anyOf;
import static com.google.errorprone.matchers.Matchers.isSubtypeOf;
import static com.google.errorprone.matchers.Matchers.not;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
import static com.google.errorprone.util.ASTHelpers.hasAnnotation;
import static com.google.errorprone.util.ASTHelpers.streamSuperMethods;

import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.matchers.Description;
import com.google.errorprone.matchers.Matcher;
import com.google.errorprone.matchers.Matchers;
import com.google.errorprone.suppliers.Supplier;
import com.google.errorprone.util.ASTHelpers;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.MemberReferenceTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.Tree.Kind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.code.Type;

/** A {@link BugChecker}; see the associated {@link BugPattern} for details. */
@BugPattern(
    summary =
        "Returned Rx objects must be checked. Ignoring a returned Rx value means it is never "
            + "scheduled for execution",
    explanation =
        "Methods that return an ignored [Observable | Single | Flowable | Maybe ] generally "
            + "indicate errors.\n\nIf you don't check the return value of these methods, the "
            + "observables may never execute. It also means the error case is not being handled",
    severity = WARNING)
public final class RxReturnValueIgnored extends AbstractReturnValueIgnored {
  private static boolean hasCirvAnnotation(ExpressionTree tree, VisitorState state) {
    Symbol untypedSymbol = getSymbol(tree);
    if (!(untypedSymbol instanceof MethodSymbol)) {
      return false;
    }

    MethodSymbol sym = (MethodSymbol) untypedSymbol;
    // Directly has @CanIgnoreReturnValue
    if (ASTHelpers.hasAnnotation(sym, CanIgnoreReturnValue.class, state)) {
      return true;
    }

    // If a super-class's method is annotated with @CanIgnoreReturnValue, we only honor that
    // if the super-type returned the exact same type. This lets us catch issues where a
    // superclass was annotated with @CanIgnoreReturnValue but the parent did not intend to
    // return an Rx type
    return streamSuperMethods(sym, state.getTypes())
        .anyMatch(
            superSym ->
                hasAnnotation(superSym, CanIgnoreReturnValue.class, state)
                    && superSym.getReturnType().tsym.equals(sym.getReturnType().tsym));
  }

  private static boolean isExemptedMethod(ExpressionTree tree, VisitorState state) {
    Symbol sym = getSymbol(tree);
    if (!(sym instanceof MethodSymbol)) {
      return false;
    }

    // Currently the only exempted method is Map.put().
    return ASTHelpers.isSubtype(sym.owner.type, JAVA_UTIL_MAP.get(state), state)
        && sym.name.contentEquals("put");
  }

  private static final Matcher<ExpressionTree> MATCHER =
      allOf(
          Matchers.kindIs(Kind.METHOD_INVOCATION),
          anyOf(
              // RxJava2
              isSubtypeOf("io.reactivex.Observable"),
              isSubtypeOf("io.reactivex.Flowable"),
              isSubtypeOf("io.reactivex.Single"),
              isSubtypeOf("io.reactivex.Maybe"),
              isSubtypeOf("io.reactivex.Completable"),
              // RxJava1
              isSubtypeOf("rx.Observable"),
              isSubtypeOf("rx.Single"),
              isSubtypeOf("rx.Completable")),
          not(
              anyOf(
                  RxReturnValueIgnored::hasCirvAnnotation,
                  RxReturnValueIgnored::isExemptedMethod)));

  @Override
  public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
    Description description = super.matchMethodInvocation(tree, state);
    return description.equals(Description.NO_MATCH) ? Description.NO_MATCH : describeMatch(tree);
  }

  @Override
  public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) {
    Description description = super.matchMemberReference(tree, state);
    return description.equals(Description.NO_MATCH) ? Description.NO_MATCH : describeMatch(tree);
  }

  @Override
  public Matcher<? super ExpressionTree> specializedMatcher() {
    return MATCHER;
  }

  private static final Supplier<Type> JAVA_UTIL_MAP =
      VisitorState.memoize(state -> state.getTypeFromString("java.util.Map"));
}


text:
<?php

final class DiffusionGitRequest extends DiffusionRequest {

  public function supportsBranches() {
    return true;
  }

  protected function isStableCommit($symbol) {
    return preg_match('/^[a-f0-9]{40}\z/', $symbol);
  }

  public function getBranch() {
    if ($this->branch) {
      return $this->branch;
    }
    if ($this->repository) {
      return $this->repository->getDefaultBranch();
    }
    throw new Exception(pht('Unable to determine branch!'));
  }

}

redpajama_set_name: RedPajamaGithub


text:
node-gallery
============

node-gallery is a photo gallery created in Node that uses the file system
instead of an additional database.

Getting started
---------------

1. Install [Node](http://nodejs.org/) and [npm](http://npmjs.org/).
2. Install ImageMagick (Ubuntu: `sudo apt-get install imagemagick`).
3. Run `npm install ejs express imagemagick` within the node-gallery dir.
4. In the node-gallery dir, create a subdirectory called *albums* containing
   the directories *public*, *private*, *hidden* and *protected*.
5. Run `node server.js` (and restart each time an album has changed).

Creating albums
---------------

A photo album is a directory within a subdirectory of *albums*. Its name is
displayed as the album title.

Public and protected albums are visible on the homepage.

Private and protected albums require a password. Put the password in the
*meta/password* file the album directory.


text:
from tkinter import *
from tkinter.messagebox import showinfo

class MyGui(Frame):
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        button = Button(self, text='Hit me', command=self.reply)
        button.pack()
    def reply(self):
        showinfo(title='Pop up', message='Button hit!')

if __name__ == '__main__':
    window = MyGui()
    window.pack()
    window.mainloop()


text:
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Options;

namespace Cql.Core.AspNetCore
{
    public static class RequireSslExtensions
    {
        public static IApplicationBuilder UseRequireSslRedirect(this IApplicationBuilder app, RequireSslOptions options = null)
        {
            if (options == null)
            {
                options = RequireSslOptions.Default();
            }

            return app.UseMiddleware<RequireSslMiddleware>(Options.Create(options));
        }
    }
}


text:
"""rebuilder that checks for permissions and locations in the datbase,
moves files from one places to the other and installs packages if needed"""
import mercurial
import logging
import os
import sys
import pwd
import grp
import shutil

from subprocess     import call
from time           import strftime

from pacha          import database
from pacha.hg       import update
from pacha.util     import get_db_dir

rebuild_log = logging.getLogger('pacha.rebuild')
DB_DIR = get_db_dir()

class Rebuild(object):
    """Does all the rebuilding work when a host needs to be reconstructed
    with Pacha. Minimal configurations come from pacha.conf and more complex
    executions come from the sh folder.
    All executions should be done with Super User powers.
    """

    def __init__(self,
            server = None,
            port = 22,
            destination = '/tmp',
            source = None,
            hostname = None,
            directory = None
            ):
        self.server = server
        self.port = int(port)
        self.destination = destination
        self.source = source
        self.directory = directory
        self.hostname = hostname

    def retrieve_files(self):
        """scp all the files we need to /tmp"""
        os.chdir('/') # avoids being in a dir that will no longer exist
        if os.path.exists('/tmp/%s' % self.hostname):
            shutil.move('/tmp/%s' % self.hostname, '/tmp/%s.%s' % (self.hostname, strftime('%H%M%s')))

        if not self.directory:
            rebuild_log.debug("Getting all files (not single dir)")
            command = "scp -r -P %d %s:%s/%s %s" % (self.port, self.server,
                    self.source, self.hostname, self.destination)
            rebuild_log.debug(command)
        else:
            if self.destination == '/tmp':
                os.makedirs('/tmp/%s' % (self.hostname))
                self.destination = '/tmp/%s/%s' % (self.hostname, self.directory)
            rebuild_log.debug("Getting a single dir")
            command = "scp -r -P %d %s:%s/%s/%s %s" % (self.port, self.server,
                    self.source, self.hostname, self.directory, self.destination)
            rebuild_log.debug(command)
        call(command, shell=True)
        # if for some reason the above failed let me know:
        host_copy = '/tmp/%s' % self.hostname
        if os.path.isdir(host_copy):
            # update everything making sure we have the latest rev:
            try:
                update(host_copy)
            except mercurial.error.RepoError:
                pass

            # run pre-hooks
            self.pre_hooks()

        else:
            print """
Pacha was not able to retrieve the files from the SSH server provided.
Check your configuration file settings and try again."""
            sys.exit(1)

    def upgrade_database(self):
        db_location = '/tmp/%s/db/pacha.db' % self.hostname
        db_dir_location = os.path.dirname(db_location)
        db_to_replace = DB_DIR
        if os.path.exists(db_location):
            # move initial db out
            shutil.move(db_to_replace, '/tmp/pacha.db.%s' % strftime('%H%M%s'))
            # get old db in
            shutil.copytree(db_dir_location, db_to_replace)

    def replace_manager(self):
        """Depending on the database information for each path, you may or
        may not have specific files you want to override. This manager method
        dispatches correctly after verifying if you were tracking a single
        file or a directory"""

        db_location = '/tmp/%s/db/pacha.db' % self.hostname
        if os.path.exists(db_location):
            # connect to the DB:
            db = database.Worker(db=db_location)
            for path in db.get_repos():
                for dirname in self.tracked():
                    if path[3] == 'dir': # dir so do default replace
                        rebuild_log.debug("dirname in self.tracked: %s" % dirname)
                        self.default_replace(dirname, path[1])
                    if path[3] == 'single': # a single file tracking
                        rebuild_log.debug('single file in self.tracked: %s' % dirname)
                        self.single_tracking(path[1])
            # run post hooks
            self.post_hooks()
        else:
            print "Could not find DB at /tmp/%s/db/pacha.db" % self.hostname
            sys.exit(1)

    def single_tracking(self, path):
        """You can have specific files to be rebuilt to avoid replacing
        whole directories."""
        #repos_path = self.repos()
        rebuild_log.debug('single repo path: %s' % path)
        tmp_dir = '/tmp/%s/' % self.hostname
        rebuild_log.debug('tmp_dir: /tmp/%s' % self.hostname)
        # get list of directories in tmp and do a double loop
        #for path in repos_path:
        base = os.path.basename(path) #gets us the file name
        dir_path = os.path.dirname(path)
        # finally a dir name from the path
        directory = os.path.basename(dir_path)
        tmp_subdir = tmp_dir+directory
        rebuild_log.debug(module='rebuild.single_tracking',
                line= 'base file: %s' % base)
        for filen in os.listdir(tmp_subdir):
            if filen == base: # we have a winner
                rebuild_log.debug('found path with matching file: %s %s' % (path,
                    base))
                if os.path.exists(path):
                    # get it out of the way
                    shutil.move(path,'/tmp/%s.%s' % (base, strftime('%H%M%s')))
                    rebuild_log.debug('moving %s to /tmp' % path)
                shutil.copyfile(tmp_subdir+'/'+filen, path)
                rebuild_log.debug('moving %s to %s' % (tmp_subdir+'/'+filen, path))
                # get permissions right without walking the tree
                self.chmod(path)
                self.chown(path)

    def default_replace(self, dirname, path):
        """Usually you will replace the configs you were backing up. Here
        the directory gets pushed if not specified in the database"""
        temp_bucket = '/tmp/pacha_bucket'
        if os.path.exists(temp_bucket):
            shutil.rmtree(temp_bucket)
        os.makedirs(temp_bucket)
        rebuild_log.debug('repos path: %s' % path)
        tmp_dir = '/tmp/%s/' % self.hostname
        rebuild_log.debug('tmp_dir: %s' % tmp_dir)
        # get list of directories in tmp and do a double loop
        base = os.path.basename(path)
        rebuild_log.debug('base dir: %s' % base)
        if dirname == base: # we have a winner
            rebuild_log.debug('found path with matching dir: %s %s' % (dirname,
                base))
            if os.path.exists(path):
                shutil.move(path,'/tmp/pacha_bucket/%s.%s' % (base,
                    strftime('%H%M%s'))) # get it out of the way
                rebuild_log.debug(
                        'moving %s to /tmp/pacha_bucket/%s.%s' % (
                            path, base, strftime('%H%M%s')))
            try:
                shutil.copytree(tmp_dir+dirname, path)
                rebuild_log.debug('moving %s to %s' % (tmp_dir+dirname, path))
                # get ownership and permissions right walking the tree
                self.walk(path)
                # we also need to set permissions for the directory
                self.chown(path)
                self.chmod(path)

            except OSError, error:
                rebuild_log.error(error)
                pass

    def walk(self, path):
        """If we are replacing whole directories we need to make sure
        we get the permissions in each file within the tree"""
        for root, dirs, files in os.walk(path):
            for f in files:
                absolute = os.path.join(root, f)
                self.chown(absolute)
                self.chmod(absolute)

    def tracked(self):
        """There needs to be a comparison between the copied files and the
        files that are in the database.
        """
        list_files = os.listdir('/tmp/%s' % self.hostname)
        return list_files

    def repos(self):
        """Returns a list of all repo paths Pacha has been tracking"""
        db_file = '/tmp/%s/db/pacha.db' % self.hostname
        if os.path.exists(db_file):
            db = database.Worker(db_file)
            repos_list = []
            for repo in db.get_repos():
                repos_list.append(repo[1])
            return repos_list
        else:
            print "Aborting the --rebuild operation"
            print """The Pacha database from host %s could not be
found.""" % self.hostname
            print """Make sure that the db directory is being tracked
at /opt/pacha/hosts/%s/ in the Pacha server"""  % self.hostname
            sys.exit(1)

    def chmod(self, path):
        """Set permissions right by checking what is on the database"""
        info = self.permission_lookup(path)
        try:
            permissions = int(str(info[4]), 8) # convert back correct mode
            os.chmod(path, permissions)
        except TypeError, e:
            print """Could not find matching permissions info for
path: %s""" % path

    def permission_lookup(self, path):
        """find the matching file in the database and return the
        metadata we need"""
        db_file = '/tmp/%s/db/pacha.db' % self.hostname
        if os.path.isfile(db_file):
            db = database.Worker(db_file)
            for info in db.get_meta(path):
                meta = list(info)
                return meta
        else:
            print "No permissions information was found in the database"

    def chown(self, path):
        """Change the group and owner of a single file or directory"""
        info = self.permission_lookup(path)
        try:
            owner = pwd.getpwnam(info[2])
            group = grp.getgrnam(info[3])
            os.chown(path, owner[3], group[2])
        except TypeError, e:
            print "Could not find matching ownership info for path: %s" % path

        except KeyError, e:
            print "Could not find matching ownership info for path: %s" % path

    def pre_hooks(self):
        """Anything that we find in the pacha_pre directory gets executed"""
        pre_dir = '/tmp/%s/pacha_pre' % self.hostname
        if os.path.exists(pre_dir):
            for hook in os.listdir(pre_dir):
                abspath = '%s/%s' % (pre_dir, hook)
                # make sure it is executable
                rebuild_log.debug("chmod on %s" % abspath)
                os.chmod(abspath, 0755)
                # now execute it!
                call(abspath, shell=True)

    def post_hooks(self):
        """Anything in the pacha_post directory gets executed"""
        post_dir = '/tmp/%s/pacha_post' % self.hostname
        if os.path.exists(post_dir):
            for hook in os.listdir(post_dir):
                abspath = '%s/%s' % (post_dir, hook)
                rebuild_log.debug("chmod on %s" % abspath)
                # make sure it is executable
                os.chmod(abspath, 0755)
                # now execute it!
                call(abspath, shell=True)


text:
<include file="Public/header" title="更新字段" />

    <form method="post" action="{:U('setting/update')}">

            字段名
            <input type="text" name="key" class="form-control" id="aa" value="{$model.key}" placeholder="key">

            字段值
            <textarea name="value" id="bb" class="form-control"  cols="30" rows="10" placeholder="value">{$model.value}</textarea>

            字段描述
            <input type="text" name="description" class="form-control" id="cc" value="{$model.description}" placeholder="描述信息" >

            <input type="hidden" name="id" value="{$model.id}">
            <button type="submit" class="btn btn-default">提交</button>

    </form>

<include file="Public/footer" />


text:
require_relative '../config'

class CreateStudents < ActiveRecord::Migration
    def change
        create_table :students do |t|
            t.string :first_name, limit: 32
            t.string :last_name, limit: 32
            t.string :gender, limit: 8
            t.date :birthday, limit: 10
            t.string :email, limit: 100
            t.string :phone, limit: 32
            t.timestamps null: false
        end
    end
end


text:
Screen Recorders for Capturing Mac OS X

# QuickTime Player (free)
http://www.makeuseof.com/tag/5-best-screen-recorders-capturing-mac-os-x/

# QuickCast
http://quickcast.io/


text:
package my.utils;

import java.security.NoSuchAlgorithmException;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

/**
 * 基于HMAC的消息摘要算法
 * @author taxo
 */
public class HMACUtils {

	/**
     * 生成签名数据
     * @param data 待加密的数据
     * @param key  加密使用的key
     * @return 生成MD5编码的字符串
     * @throws InvalidKeyException
     * @throws NoSuchAlgorithmException
     */
    public static String getSignature(byte[] datas, byte[] key) throws Exception{
    	SecretKeySpec secretKeySpec = new SecretKeySpec(key,"AES");
        Mac mac = Mac.getInstance("HmacSHA1");
        mac.init(secretKeySpec);
        byte[] rawHmac = mac.doFinal(datas);
        return toHEX(rawHmac);
    }

    /**
     * 转换成16进制
     * @param datas
     * @return
     */
    public static String toHEX(byte[] datas){
    	StringBuilder sb = new StringBuilder();
    	for(int i = 0; i < datas.length; i++) {
    		byte data = datas[i];
    		int h = (data>>4) & 0x0f;
    		int l = data & 0x0f;
    		sb.append(h>9? (char)((h-10)+'a'): (char)(h + '0'));
    		sb.append(l>9? (char)((l-10)+'a'): (char)(l + '0'));
		}
    	return sb.toString();
    }

    public static String toHEX2(byte[] datas){
    	StringBuilder sb = new StringBuilder();
    	for(int i = 0; i < datas.length; i++) {
    		byte data = datas[i];
    		sb.append(Integer.toHexString(data));
		}
    	return sb.toString();
    }

    public static void main(String[] args) throws Exception {
    	byte[] datas = new String("1").getBytes();
    	byte[] key = new String("33332222232323").getBytes();
    	String out = HMACUtils.getSignature(datas, key);
    	System.out.println(out);
	}

}


text:
.class public Lcom/android/internal/view/CheckableLinearLayout;
.super Landroid/widget/LinearLayout;
.source "CheckableLinearLayout.java"

# interfaces
.implements Landroid/widget/Checkable;

# instance fields
.field private mCheckBox:Landroid/widget/CheckBox;

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 31
    invoke-direct {p0, p1}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;)V

    .line 33
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 36
    invoke-direct {p0, p1, p2}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 38
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 41
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 43
    return-void
.end method

# virtual methods
.method public isChecked()Z
    .locals 1

    .prologue
    .line 58
    iget-object v0, p0, Lcom/android/internal/view/CheckableLinearLayout;->mCheckBox:Landroid/widget/CheckBox;

    invoke-virtual {v0}, Landroid/widget/CheckBox;->isChecked()Z

    move-result v0

    return v0
.end method

.method protected onFinishInflate()V
    .locals 1

    .prologue
    .line 47
    invoke-super {p0}, Landroid/widget/LinearLayout;->onFinishInflate()V

    .line 48
    const v0, 0x102039e

    invoke-virtual {p0, v0}, Lcom/android/internal/view/CheckableLinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/CheckBox;

    iput-object v0, p0, Lcom/android/internal/view/CheckableLinearLayout;->mCheckBox:Landroid/widget/CheckBox;

    .line 49
    return-void
.end method

.method public setChecked(Z)V
    .locals 1
    .parameter "checked"

    .prologue
    .line 53
    iget-object v0, p0, Lcom/android/internal/view/CheckableLinearLayout;->mCheckBox:Landroid/widget/CheckBox;

    invoke-virtual {v0, p1}, Landroid/widget/CheckBox;->setChecked(Z)V

    .line 54
    return-void
.end method

.method public toggle()V
    .locals 1

    .prologue
    .line 63
    iget-object v0, p0, Lcom/android/internal/view/CheckableLinearLayout;->mCheckBox:Landroid/widget/CheckBox;

    invoke-virtual {v0}, Landroid/widget/CheckBox;->toggle()V

    .line 64
    return-void
.end method


text:
require 'spec_helper'

describe "Caching" do
  before do
    @klass = Class.new do
      extend MongoMapper::Plugins
      plugin MongoMapper::Plugins::Caching
    end
    allow(@klass).to receive(:name).and_return('Post')
    allow_any_instance_of(@klass).to receive(:persisted?).and_return(true)
    allow_any_instance_of(@klass).to receive(:[]).and_return(nil)
    allow_any_instance_of(@klass).to receive(:[]=).and_return(nil)
  end

  context "new" do
    before do
      @doc = @klass.new
      allow(@doc).to receive(:persisted?).and_return(false)
    end

    it "should be class/new" do
      @doc.cache_key.should == 'Post/new'
    end

    it "should work with suffix" do
      @doc.cache_key(:foo).
        should == 'Post/new/foo'

      @doc.cache_key(:foo, :bar).
        should == 'Post/new/foo/bar'
    end
  end

  context "not new" do
    before do
      @object_id = BSON::ObjectId.new
      @doc = @klass.new
      allow(@doc).to receive(:persisted).and_return(true)
      allow(@doc).to receive(:id).and_return(@object_id)
    end

    context "with updated_at" do
      before do
        time = Time.utc(2010, 6, 20, 8, 10, 7)
        allow(@doc).to receive(:[]).with(:updated_at).and_return(time)
      end

      it "should be class/id-timestamp" do
        @doc.cache_key.should == "Post/#{@object_id}-20100620081007"
      end

      it "should work with suffix" do
        @doc.cache_key(:foo).
          should == "Post/#{@object_id}-20100620081007/foo"

        @doc.cache_key(:foo, :bar).
          should == "Post/#{@object_id}-20100620081007/foo/bar"
      end
    end

    context "without updated_at" do
      it "should be class/id" do
        @doc.cache_key.should == "Post/#{@object_id}"
      end

      it "should work with suffix" do
        @doc.cache_key(:foo).
          should == "Post/#{@object_id}/foo"

        @doc.cache_key(:foo, :bar, :baz).
          should == "Post/#{@object_id}/foo/bar/baz"
      end
    end
  end
end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Ceropegia tenuis N.E.Br.

### Remarks
null


text:
<?php

final class PhamePostMailReceiver
  extends PhabricatorObjectMailReceiver {

  public function isEnabled() {
    return PhabricatorApplication::isClassInstalled(
      'PhabricatorPhameApplication');
  }

  protected function getObjectPattern() {
    return 'J[1-9]\d*';
  }

  protected function loadObject($pattern, PhabricatorUser $viewer) {
    $id = (int)substr($pattern, 4);

    return id(new PhamePostQuery())
      ->setViewer($viewer)
      ->withIDs(array($id))
      ->executeOne();
  }

  protected function getTransactionReplyHandler() {
    return new PhamePostReplyHandler();
  }

}


text:
package com.asakusafw.compiler.flow;

import java.io.DataInput;
import java.io.DataOutput;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

import com.asakusafw.compiler.common.Precondition;
import com.asakusafw.utils.java.model.syntax.Expression;
import com.asakusafw.utils.java.model.syntax.ModelFactory;
import com.asakusafw.utils.java.model.syntax.Statement;
import com.asakusafw.utils.java.model.syntax.Type;
import com.asakusafw.utils.java.model.util.CommentEmitTrait;
import com.asakusafw.utils.java.model.util.Models;

/**
 * An abstract super interface of resolved data types.
 */
public interface DataClass {

    /**
     * Returns the representation of this data type as a Java class.
     * @return the representation of this data type as a Java class
     */
    java.lang.reflect.Type getType();

    /**
     * Returns the all available properties in this data type.
     * @return the all available properties
     */
    Collection<? extends Property> getProperties();

    /**
     * Returns a property in this data type.
     * @param propertyName the target property name
     * @return the target property, or {@code null} if this data type does not contain such a property
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Property findProperty(String propertyName);

    /**
     * Returns an expression that creates a new instance of this type.
     * @param type a DOM for this data type
     * @return the created expression
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Expression createNewInstance(Type type);

    /**
     * Returns a statement that assigns a value of this data type.
     * @param target the assign target
     * @param source the assign value
     * @return the created statement
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Statement assign(Expression target, Expression source);

    /**
     * Returns a statement that resets a value of this data type.
     * @param object the expression of the target value
     * @return the created statement
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Statement reset(Expression object);

    /**
     * Returns a statement that writes a value of this data type into {@link DataOutput}.
     * @param object the expression of target value
     * @param dataOutput the expression of the target {@link DataOutput}
     * @return the created statement
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Statement createWriter(Expression object, Expression dataOutput);

    /**
     * Returns a statement that reads a contents of this data type from {@link DataInput}.
     * @param object the expression of the target value
     * @param dataInput the expression of the source {@link DataInput}
     * @return the created statement
     * @throws IllegalArgumentException if the parameter is {@code null}
     */
    Statement createReader(Expression object, Expression dataInput);

    /**
     * Represents an unresolved {@link DataClass}.
     */
    class Unresolved implements DataClass {

        private final ModelFactory factory;

        private final java.lang.reflect.Type runtimeType;

        /**
         * Creates a new instance.
         * @param factory the Java DOM factory
         * @param runtimeType the target runtime type
         * @throws IllegalArgumentException if the parameter is {@code null}
         */
        public Unresolved(ModelFactory factory, java.lang.reflect.Type runtimeType) {
            Precondition.checkMustNotBeNull(factory, "factory"); //$NON-NLS-1$
            Precondition.checkMustNotBeNull(runtimeType, "runtimeType"); //$NON-NLS-1$
            this.factory = factory;
            this.runtimeType = runtimeType;
        }

        @Override
        public java.lang.reflect.Type getType() {
            return runtimeType;
        }

        @Override
        public Collection<? extends Property> getProperties() {
            return Collections.emptySet();
        }

        @Override
        public Property findProperty(String propertyName) {
            return null;
        }

        @Override
        public Statement reset(Expression object) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"reset\": {0}", //$NON-NLS-1$
                            runtimeType)
            )));
            return statement;
        }

        @Override
        public Expression createNewInstance(Type type) {
            Expression expression = Models.toNullLiteral(factory);
            expression.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"createNewInstance\": {0}", //$NON-NLS-1$
                            runtimeType)
            )));
            return expression;
        }

        @Override
        public Statement assign(Expression target, Expression source) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"assign\": {0}", //$NON-NLS-1$
                            runtimeType)
            )));
            return statement;
        }

        @Override
        public Statement createWriter(Expression object, Expression dataOutput) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"createWriter\": {0}", //$NON-NLS-1$
                            runtimeType)
            )));
            return statement;
        }

        @Override
        public Statement createReader(Expression object, Expression dataInput) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"createReader\": {0}", //$NON-NLS-1$
                            runtimeType)
            )));
            return statement;
        }
    }

    /**
     * Represents a property in {@link DataClass}.
     */
    interface Property {

        /**
         * Returns the name of this property.
         * @return the property name
         */
        String getName();

        /**
         * Returns the type of this property as a Java class.
         * @return the representation of this property type as a Java class
         */
        java.lang.reflect.Type getType();

        /**
         * Returns whether this property is nullable or not.
         * @return {@code true} if this property is nullable, otherwise {@code false}
         */
        boolean canNull();

        /**
         * Returns an expression that creates a new value object for this property.
         * @param target the target data type
         * @return the created expression
         * @throws IllegalArgumentException if the parameter is {@code null}
         */
        Expression createNewInstance(Type target);

        /**
         * Returns an expression that returns whether this property is {@code null} or not.
         * @param object the target object
         * @return the created expression
         * @throws IllegalArgumentException if the parameter is {@code null}
         */
        Expression createIsNull(Expression object);

        /**
         * Returns an expression that returns this property from the target object.
         * @param object the target object
         * @return the created expression
         * @throws IllegalArgumentException if the parameter is {@code null}
         */
        Expression createGetter(Expression object);

        /**
         * Returns a statement that assigns a value into this property.
         * @param target the target property ({@link #createGetter(Expression)})
         * @param source the value to be assigned
         * @return the created statement
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Statement assign(Expression target, Expression source);

        /**
         * Returns a statement that copies a value of this property into the other value object.
         * @param object the property owner
         * @param target the target value object
         * @return the created statement
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Statement createGetter(Expression object, Expression target);

        /**
         * Returns a statement that assigns a value into the property of the target object.
         * @param object the property owner
         * @param value the value to be assigned
         * @return the created statement
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Statement createSetter(Expression object, Expression value);

        /**
         * Returns a statement that writes the property of the target object into {@link DataOutput}.
         * @param object the property owner
         * @param dataOutput the target {@code java.io.DataOutput}
         * @return the created statement
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Statement createWriter(Expression object, Expression dataOutput);

        /**
         * Returns a statement that reads the property of the target object from {@link DataInput}.
         * @param object the property owner
         * @param dataInput the source {@code java.io.DataInput}
         * @return the created statement
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Statement createReader(Expression object, Expression dataInput);

        /**
         * Returns an expression that returns the hash code of the property.
         * @param object the property owner
         * @return the created expression
         * @throws IllegalArgumentException if the parameter is {@code null}
         */
        Expression createHashCode(Expression object);

        /**
         * Returns an expression that returns the serialized length of the target value.
         * @param bytes expression of the serialized bytes
         * @param start expression of the start offset index in the serialized bytes
         * @param length expression of the limit length in the serialized bytes
         * @return the created expression
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Expression createBytesSize(Expression bytes, Expression start, Expression length);

        /**
         * Returns an expression that compares two serialized bytes.
         * @param bytes1 expression of the first serialized bytes
         * @param start1 expression of the start offset in {@code bytes1}
         * @param length1 expression of the limit length in {@code bytes1}
         * @param bytes2 expression of the second serialized bytes
         * @param start2 expression of the start offset in {@code bytes2}
         * @param length2 expression of the limit length in {@code bytes2}
         * @return the created expression
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Expression createBytesDiff(
                Expression bytes1, Expression start1, Expression length1,
                Expression bytes2, Expression start2, Expression length2);

        /**
         * Returns an expression that compares two values.
         * @param value1 expression of the first value
         * @param value2 expression of the second value
         * @return the created expression
         * @throws IllegalArgumentException if the parameters are {@code null}
         */
        Expression createValueDiff(Expression value1, Expression value2);
    }
}


text:
import DebugSession from './debug_session';
export declare enum DebuggerType {
    GDB = 0,
    LLDB = 1,
}
/**
 * Starts a new debugging session and spawns the debbuger process.
 *
 * Once the debug session has outlived its usefulness call [[DebugSession.end]] to ensure proper
 * cleanup.
 *
 * @param debuggerFilename Full path to debugger executable, defaults to either `lldb-mi` or `gdb`
 *                         (based on [[debuggerType]]).
 * @returns A new debug session, or null if a new session couldn't be started.
 */
export declare function startDebugSession(debuggerType: DebuggerType, debuggerFilename?: string): DebugSession;


text:
[bliss](https://github.com/cstivers78/bliss) support for [JSTransformers](http://github.com/jstransformers).

[![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-bliss/master.svg)](https://travis-ci.org/jstransformers/jstransformer-bliss)
[![Coverage Status](https://img.shields.io/codecov/c/github/jstransformers/jstransformer-bliss/master.svg)](https://codecov.io/gh/jstransformers/jstransformer-bliss)
[![Dependency Status](https://img.shields.io/david/jstransformers/jstransformer-bliss/master.svg)](http://david-dm.org/jstransformers/jstransformer-bliss)
[![NPM version](https://img.shields.io/npm/v/jstransformer-bliss.svg)](https://www.npmjs.org/package/jstransformer-bliss)

## Installation

    npm install jstransformer-bliss

## API

> For more use-cases see the **tests** in [test folder](./test) or see the [JSTransformer API](http://github.com/jstransformers/jstransformer#api) for more details.

```js
var bliss = require('jstransformer')(require('jstransformer-bliss'))

bliss.render('<p>Hello @place !!</p>', {context: {place: 'world'}}).body
//=> '<p>Hello world !!</p>'
```

## License

MIT


text:
package com.gochinatv.cdn.api.controller;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gochinatv.cdn.api.commons.HttpClientTools;
import com.gochinatv.cdn.api.entity.Validation;
import com.gochinatv.cdn.api.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StreamUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gochinatv.cdn.api.controller.base.BaseHandler;
import com.gochinatv.cdn.api.entity.User;
import com.gochinatv.cdn.api.service.CdnEncryptionService;
import com.gochinatv.cdn.api.service.impl.LocalCacheImpl;

@Controller
@RequestMapping("")
//@Scope("singleton")
//@Scope("prototype")
//@Scope("request")
//@Scope("session")
public class IndexController extends BaseHandler{

	private int number = 0;

	//测试service中的scope的作用域
	@Autowired
	private CdnEncryptionService cdnEncryptionService1;

	//测试service中的scope的作用域
	@Autowired
	private CdnEncryptionService cdnEncryptionService2;

	@Autowired
	private ReloadableResourceBundleMessageSource messageSource;

	@Value("#{'${CDN_KEY}'.split(',')}")
	private List<String> CDN_KEY;

	@Value("#{PropertySplitter.map('${address}')}")
	private Map<String, String> userMap;

	@Autowired
	private LocalCacheImpl localCacheImpl;

	@Autowired
	private RedisService redisServiceImpl;

	/**
	 * <mvc:redirect-view-controller redirect-url="/index" path="/"/>
	 * 表示项目直接访问根目录直接跳转至  /index.jsp
	 * @return
	 */

	@RequestMapping("/index")
	public /*synchronized*/ String index() {
		number++;

		System.out.println("=============number===========:"+number);
		cdnEncryptionService1.testScope();
		cdnEncryptionService2.testScope();

		try {
			//String result = HttpClientTools.Get("https://www.douban.com/");
			//System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}

		try {
			//String result = HttpClientTools.Get("https://www.baidu.com");
			//System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}

		return "index";
	}

	/**
	 * 必须添加 validation-api.jar和具体的实现(这里使用的是hibernte-validate的jar)
	 * @param validation
	 * @param result
     * @return
     */
	@RequestMapping("/validate")
	public String validate(@Validated Validation validation, BindingResult result) {
		if(result.hasErrors()){
			List<ObjectError> allErrors = result.getAllErrors();
			System.out.println(allErrors.size()+"");
			for (ObjectError error : allErrors) {
				System.out.println(error.getCode()+" "+error.getDefaultMessage());
			}

			for (FieldError fieldError:result.getFieldErrors()) {
				System.out.println(fieldError.getField()+"   "+ fieldError.getRejectedValue());
			}

		}
		return "index";
	}

	@RequestMapping("/value_support")
	public String value_support() {
		System.out.println("==========CDN_KEY:==="+CDN_KEY.get(0)+"========"+CDN_KEY.get(1));
		System.out.println(userMap.get("name1")+"====="+userMap.get("name2"));
		return "index";
	}

	@RequestMapping("/local_value/{id}")
	public /*synchronized*/ String getValue(@PathVariable int id) {
		System.out.println(localCacheImpl.getValue(id));
		return "index";
	}

	@RequestMapping("/output_format")
    @ResponseBody
	public User json_output() {
		User user = null;
		try {
			user = new User(1, "tomcat", 29, "834812348134");
		}catch(Exception e){
		    e.printStackTrace();
		}
		return user;
	}

	@RequestMapping("/ajax_result")
	public String ajax_result(HttpServletRequest request,HttpServletResponse response) {
		request.setAttribute("name", "zhangsan");
		return "ajax_result";
	}

	/**
	 * 消息国际化,但是此方法是多余的方法,只需要在jsp中通过js修改客户端cookie的名称即可
	 * 切换国际化
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/change")
	public String change(HttpServletRequest request,HttpServletResponse response) {
		String language = request.getParameter("language");

		//*********************后台业务代码的方式获取国际化资源文件*************************
		//Locale currentLocale = new Locale("zh", "CN");//设置默认语言
	    //MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource,currentLocale);
		MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource);
		String name = messageSourceAccessor.getMessage("index.user.name");
		System.out.println("*******:"+name);

		//*******************************************************

		//Cookie cookie = new Cookie("language", language);
		//response.addCookie(cookie);
		return "index";
	}

	/**
	 * nginx 获取post 参数
	 * @param data1
	 * @param data2
     * @return
     */
	@RequestMapping(value = "/postdata",method = RequestMethod.POST)
	public String postdata(String data1,String data2,String data3) {
		System.out.println("data1:"+data1);
		System.out.println("data2:"+data1);
		System.out.println("data3:"+data1);
		System.out.println("data4:"+data1);
		return "index";
	}

	public static void main(String[] args) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		//TimeZone zone = TimeZone.getTimeZone("GMT+08:00");
		//TimeZone zone = TimeZone.getDefault();
		//TimeZone zone = TimeZone.getTimeZone("Asia/Chongqing");
		TimeZone zone = TimeZone.getTimeZone("America/Dawson");
		String americaId = zone.getID();
		System.out.println(americaId);
		System.out.println(TimeZone.getDefault().getRawOffset()/(3600*1000));

		Calendar cl = Calendar.getInstance(zone);
		System.out.println(sdf.format(cl.getTime()));
	}

}


text:
namespace content {

presentation::PresentationErrorType PresentationErrorTypeToMojo(
    content::PresentationErrorType input) {
  switch (input) {
    case content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS:
      return presentation::PRESENTATION_ERROR_TYPE_NO_AVAILABLE_SCREENS;
    case content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED:
      return presentation::PRESENTATION_ERROR_TYPE_SESSION_REQUEST_CANCELLED;
    case content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND:
      return presentation::PRESENTATION_ERROR_TYPE_NO_PRESENTATION_FOUND;
    case content::PRESENTATION_ERROR_UNKNOWN:
      return presentation::PRESENTATION_ERROR_TYPE_UNKNOWN;
  }
  NOTREACHED();
  return presentation::PRESENTATION_ERROR_TYPE_UNKNOWN;
}

presentation::PresentationConnectionState PresentationConnectionStateToMojo(
    content::PresentationConnectionState state) {
  switch (state) {
    case content::PRESENTATION_CONNECTION_STATE_CONNECTED:
      return presentation::PRESENTATION_CONNECTION_STATE_CONNECTED;
    case content::PRESENTATION_CONNECTION_STATE_CLOSED:
      return presentation::PRESENTATION_CONNECTION_STATE_CLOSED;
    case content::PRESENTATION_CONNECTION_STATE_TERMINATED:
      return presentation::PRESENTATION_CONNECTION_STATE_TERMINATED;
  }
  NOTREACHED();
  return presentation::PRESENTATION_CONNECTION_STATE_TERMINATED;
}

}  // namespace content


text:
__author__ = 'zephaniahgrunschlag'

"""
Snagged from: http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python
"""

import sys

class RedirectStdout:
    def __init__(self, target):
         self.stdout = sys.stdout
         self.target = target

    def __enter__(self):
        sys.stdout = self.target

    def __exit__(self, type, value, tb):
        sys.stdout = self.stdout


text:
Installation
============

Prerequisites
-------------

- 64-bit Linux
- 64-bit Matlab
- The GCC C compiler
- A working MEX setup that uses GCC to compile the MEX files

Download
--------
Clone the repository.
::

$ git clone --recursive https://github.com/kloewe/conan.git

Build
-----
Change to the root directory of the cloned repository and build the MEX files.

::

$ cd conan
$ make

Set up
------
Add the relevant directories to Matlab's search path and save it.
::

$ make install

Alternatively, you can manually add the relevant directories to Matlab's search
path and optionally save it.
::

>> addpath('<conan-dir>/mod/corr-m')
>> addpath('<conan-dir>/mod/cpuinfo-m')
>> addpath('<conan-dir>/mod/fconn-m')
>> addpath('<conan-dir>/mod/util-m')
>> savepath


text:
package org.tenwell.identity.agent.bean;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

import org.opensaml.saml2.core.Assertion;
import org.opensaml.saml2.core.Response;
import org.tenwell.identity.agent.exception.SSOAgentException;
import org.tenwell.identity.agent.util.SSOAgentUtils;

import javax.xml.bind.annotation.XmlAttribute;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;

public class AgentSessionBean implements Serializable {

    private static final long serialVersionUID = 7762835859870143767L;

    private SAML2SSO saml2SSO;

    public SAML2SSO getSAML2SSO() {
        return saml2SSO;
    }

    public void setSAML2SSO(SAML2SSO saml2SSO) {
        this.saml2SSO = saml2SSO;
    }

    public static class AccessTokenResponseBean implements Serializable{

        @XmlAttribute(name="access_token")
        @SerializedName("access_token")
        private String accessToken;

        @XmlAttribute(name="refresh_token")
        @SerializedName("refresh_token")
        private String refreshToken;

        @XmlAttribute(name="token_type")
        @SerializedName("token_type")
        private String tokenType;

        @XmlAttribute(name="expires_in")
        @SerializedName("expires_in")
        private String expiresIn;

        public String getAccessToken() {
            return accessToken;
        }

        public void setAccessToken(String accessToken) {
            this.accessToken = accessToken;
        }

        public String getRefreshToken() {
            return refreshToken;
        }

        public void setRefreshToken(String refreshToken) {
            this.refreshToken = refreshToken;
        }

        public String getTokenType() {
            return tokenType;
        }

        public void setTokenType(String tokenType) {
            this.tokenType = tokenType;
        }

        public String getExpiresIn() {
            return expiresIn;
        }

        public void setExpiresIn(String expiresIn) {
            this.expiresIn = expiresIn;
        }

        @Override
        public String toString() {
            Gson gson = new Gson();
            return gson.toJson(this);
        }

        public AccessTokenResponseBean deSerialize(String accessTokenResponseBeanString) {
            Gson gson = new Gson();
            return gson.fromJson(accessTokenResponseBeanString, AccessTokenResponseBean.class);
        }
    }

    public class SAML2SSO implements Serializable{

        public static final String EMPTY_STRING = "";
        private String subjectId;

        private Response response;

        private String responseString;

        private Assertion assertion;

        private String assertionString;

        private AccessTokenResponseBean accessTokenResponseBean;

        private String sessionIndex;

        private Map<String, String> subjectAttributes;

        private void writeObject(java.io.ObjectOutputStream stream)
                throws IOException {

            stream.writeObject(subjectId);

            stream.writeObject(responseString);

            stream.writeObject(assertionString);

            stream.writeObject(sessionIndex);
            if (accessTokenResponseBean != null) {
                stream.writeObject(accessTokenResponseBean.toString());
            } else {
                stream.writeObject(EMPTY_STRING);
            }
            stream.writeObject(subjectAttributes);
        }

        private void readObject(java.io.ObjectInputStream stream)
                throws IOException, ClassNotFoundException, SSOAgentException {

            subjectId = (String) stream.readObject();

            responseString = (String) stream.readObject();
            if (responseString != null && !EMPTY_STRING.equals(responseString)) {
                response = (Response) SSOAgentUtils.unmarshall(responseString);
            }

            assertionString = (String) stream.readObject();
            if (responseString != null && !EMPTY_STRING.equals(assertionString)) {
                assertion = (Assertion) SSOAgentUtils.unmarshall(assertionString);
            }

            sessionIndex = (String) stream.readObject();
            String accessTokenResponseBeanString = (String) stream.readObject();
            if (!EMPTY_STRING.equals(accessTokenResponseBeanString)) {
                accessTokenResponseBean = accessTokenResponseBean.deSerialize(accessTokenResponseBeanString);
            } else {
                accessTokenResponseBean = null;
            }
            subjectAttributes = (Map) stream.readObject();
        }

        public String getSubjectId() {
            return subjectId;
        }

        public void setSubjectId(String subjectId) {
            this.subjectId = subjectId;
        }

        public Map<String, String> getSubjectAttributes() {
            return subjectAttributes;
        }

        public void setSubjectAttributes(Map<String, String> samlSSOAttributes) {
            this.subjectAttributes = samlSSOAttributes;
        }

        public String getSessionIndex() {
            return sessionIndex;
        }

        public void setSessionIndex(String sessionIndex) {
            this.sessionIndex = sessionIndex;
        }

        public Response getSAMLResponse() {
            return response;
        }

        public void setSAMLResponse(Response samlResponse) {
            this.response = samlResponse;
        }

        public String getResponseString() {
            return responseString;
        }

        public void setResponseString(String responseString) {
            this.responseString = responseString;
        }

        public Assertion getAssertion() {
            return assertion;
        }

        public void setAssertion(Assertion samlAssertion) {
            this.assertion = samlAssertion;
        }

        public String getAssertionString() {
            return assertionString;
        }

        public void setAssertionString(String samlAssertionString) {
            this.assertionString = samlAssertionString;
        }

        public AccessTokenResponseBean getAccessTokenResponseBean() {
            return accessTokenResponseBean;
        }

        public void setAccessTokenResponseBean(AccessTokenResponseBean accessTokenResponseBean) {
            this.accessTokenResponseBean = accessTokenResponseBean;
        }
    }
}


text:
package com.springcryptoutils.core.mac;

import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;

/**
 * Default implementation for Message Authentication Codes.
 *
 * @author Mirko Caserta (mirko.caserta@gmail.com)
 */
public class MacImpl implements Mac {

	private Key secretKey;

	private String algorithm = "HmacSHA1";

	private String provider;

	/**
	 * The secret key for digesting the message.
	 *
	 * @param secretKey the secret key
	 */
	public void setSecretKey(Key secretKey) {
		this.secretKey = secretKey;
	}

	/**
	 * The algorithm. The default is HmacSHA1.
	 *
	 * @param algorithm the signature algorithm
	 */
	public void setAlgorithm(String algorithm) {
		this.algorithm = algorithm;
	}

	/**
	 * Sets the provider name of the specific implementation requested (e.g.,
	 * "BC" for BouncyCastle, "SunJCE" for the default Sun JCE provider).
	 *
	 * @param provider the provider to set
	 */
	public void setProvider(String provider) {
		this.provider = provider;
	}

	public byte[] digest(byte[] message) {
		try {
			final javax.crypto.Mac mac = (((provider == null) || (provider.length() == 0)) ? javax.crypto.Mac
					.getInstance(algorithm) : javax.crypto.Mac.getInstance(algorithm, provider));
			mac.init(secretKey);
			return mac.doFinal(message);
		} catch (NoSuchAlgorithmException e) {
			throw new MacException("no such algorithm: " + secretKey.getAlgorithm(), e);
		} catch (InvalidKeyException e) {
			throw new MacException("invalid key", e);
		} catch (NoSuchProviderException e) {
			throw new MacException("no such provider: " + provider, e);
		}
	}

}


text:
{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-}

{-# LANGUAGE CPP #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FunctionalDependencies #-}

#if __GLASGOW_HASKELL__ < 710
{-# LANGUAGE OverlappingInstances #-}
#endif

-- | See "Control.Monad.Reader.Class".

module Control.Monad.Ether.Reader.Class
    ( MonadReader(..)
    , asks
    ) where

import Control.Monad.Trans.Ether.Reader hiding (reader, ask, local)
import qualified Control.Monad.Trans.Ether.Reader as R
import qualified Control.Monad.Trans.Lift.Local as Lift
import qualified Control.Ether.Util as Util

-- | See 'Control.Monad.Reader.MonadReader'.
class Monad m => MonadReader tag r m | m tag -> r where

    {-# MINIMAL (ask | reader), local #-}

    -- | Retrieves the monad environment.
    ask :: proxy tag -> m r
    ask t = reader t id

    -- | Executes a computation in a modified environment.
    local
        :: proxy tag
        -> (r -> r)
        -- ^ The function to modify the environment.
        -> m a
        -- ^ @Reader@ to run in the modified environment.
        -> m a

    -- | Retrieves a function of the current environment.
    reader
        :: proxy tag
        -> (r -> a)
        -- ^ The selector function to apply to the environment.
        -> m a
    reader t f = Util.fmap f (ask t)

-- | Retrieves a function of the current environment.
asks
    :: MonadReader tag r m
    => proxy tag
    -> (r -> a)
    -- ^ The selector function to apply to the environment.
    -> m a
asks = reader

instance {-# OVERLAPPING #-} Monad m => MonadReader tag r (ReaderT tag r m) where
    ask = R.ask
    local = R.local
    reader = R.reader

instance ( Lift.LiftLocal t
         , Monad (t m)
         , MonadReader tag r m
         ) => MonadReader tag r (t m) where
    ask t = Lift.lift (ask t)
    local t = Lift.liftLocal (ask t) (local t)


text:
require 'cgi'
require 'rubygems'
#require 'sqlite3-ruby'
require 'sqlite3'
#require 'xmpp4r/roster.'
#require 'xmpp4r'
#require 'xmpp4r-simple'
#require 'xml/libxml'
require 'arrayfields'
require 'thread'
require 'digest/md5'
#require "libs/unicodefix.rb"

require_relative 'libs/jabber/xmpp4r-simple.rb'
require_relative 'libs/tserver.rb'
require_relative 'libs/tgserver.rb'
require_relative 'libs/jabber/bot.rb'
require_relative 'libs/db.rb'
require_relative 'libs/players.rb'
require_relative 'libs/locations.rb'
require_relative 'libs/descriptions.rb'
require_relative 'libs/objects.rb'
require_relative 'libs/game.rb'

require_relative "libs/cmdsettings.rb"
require_relative "libs/cmdbase.rb"
require_relative "libs/cmdcommon.rb"
require_relative 'libs/cmdbuild.rb'
require_relative "libs/cmdsocials.rb"
require_relative "libs/cmdadm.rb"

GC.enable

# Settings
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
USER_NAME_REGEX = '[[:alnum:]|[:blank:]]{3,30}'

CFG_FILE = './config.rb'
if File.exist?(CFG_FILE)
  load CFG_FILE
else
  print "Ошибка! Нет файла конфигурации #{CFG_FILE}\nЗапустите ./setup.sh\n"
end

RETURN_LOCATION = @return_location
START_LOCATION = @start_location

$show_must_go_on = true

#Jabber::debug = false

#if ARGV[0] == '--disable-jabber'
#  @jabber_enable = false
#end

$DreamInDream = Array.new(0)

game = Game.new
$gg = game

# Configure a public bot
config = {
    :name => 'MUDBot',
    :jabber_id => @bot_jid + "/fdream",
    :password => @bot_jpass,
    :master => game.admins,
    :is_public => true,
    :status => 'play?',
    :presence => :chat,
    :priority => 10,
    :tgkey => @tgkey,
    :game => game
}

# Create a new bot
bot = Jabber::Bot.new(config)
LoadSettingsCmd(bot, game, "настройки")
LoadBaseCmd(bot, game, "базовые")
LoadCommonCmd(bot, game, "основные")
LoadAdmCmd(bot, game, "администраторские")
LoadBuildCmd(bot, game, "строительство")
LoadSocCmd(bot, game, "социалы")

#reconnecttime = 6000
#bot.add_command(
#  :syntax      => 'интервал_переподключения',
#  :description => game.descr['reconnecttime'],
#  :regex       => /^интервал_переподключения\s[0-9]{3,5}$/i,
#  :is_public   => false
#) do |sender, message|
#    if game.check(sender)
#		reconnecttime = message.to_i
#		"установлен интервал автоматического переподключения сервера в #{message} секунд"
#	end
#end

#bot.add_command(
#  :syntax      => 'allow following | разрешить следовать за мной | разрешить следовать',
#  :description => "разрешает другим игрокам следовать за вами",
#  :regex       => /^(([Рр]азрешить следовать за мной)|([Рр]азрешить следовать)|(allow following))$/i,
#  :is_public   => false
#) do |sender, message|
# 	game.AllowFollowing(sender,message) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'prohibit following | нельзя больше следовать за мной | запретить следовать | нельзя следовать',
#  :description => "запрещает другим игрокам следовать за вами",
#  :regex       => /^(([Нн]ельзя больше следовать за мной)|([Зз]апретить следовать)|([Нн]ельзя следовать)|(prohibit following))$/i,
#  :is_public   => false
#) do |sender, message|
# 	game.ProhibitFollowing(sender,message) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'follow | fol | следовать за| след за <имя>',
#  :description => "следовать за игроком - то есть вы будите автоматически двигаться за ним куда бы он не направился",
#  :regex       => /^(([Сс]лед)|([Сс]ледовать)|([Сс]лед за)|([Сс]ледовать за)|(fol)|(follow))\s(#{USER_NAME_REGEX})$/i,
#  :is_public   => false
#) do |sender, message|
# 	game.Follow(sender,message.sub(/^за\s/,'')) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'перестать следовать',
#  :description => "перестать следовать за игроком",
#  :regex       => /^[Пп]ерестать следовать$/i,
#  :is_public   => false
#) do |sender, message|
# 	game.StopFollow(sender) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'список',
#  :description => 'показывает список литературы на терминале в библиотеке',
#  :regex       => /^[Сс]писок$/i,
#  :is_public   => true
#) do |sender, message|
#    game.BooksList(sender,message) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'выбрать <номер книги>',
#  :description => 'показывает книгу на терминале в библиотеке',
#  :regex       => /^[Вв]ыбрать\s[0-9]{1,3}$/i,
#  :is_public   => true
#) do |sender, message|
#    game.SelectBook(sender,message) if game.check(sender)
#end

#bot.add_command(
#  :syntax      => 'добавить_книгу <название>)><(<текст>',
#  :description => 'добавляет книгу в библиотеку',
#  :regex       => /^добавить_книгу\s[\.\,\"a-zЁёА-Яа-яA-Z0-9\s]{1,99}\)><\(.+$/m,
#  :is_public   => false
#) do |sender, message|
#    game.AddBook(sender,message) if game.check(sender)
#end

bot.notcommand { |addr, txt|
  if game.check(addr)
#		game.ParseCommands(addr,txt)
    mess = game.say(addr, txt)
#		bot.deliver(addr,mess)unless mess.nil?
    bot.sendstack.push([addr, mess]) unless mess.nil?
  else
    mess = game.start(addr)
    bot.sendstack.push([addr, mess]) unless mess.nil?
  end
}

repeat_thread = Thread.new do
  oldstatus = ''
  loop {

#require 'ruby-debug'
#debugger
# FIXME: переделать время на системный таймер
#    game.DoTime
    bot.masters = game.admins if bot.masters != game.admins
    if oldstatus != game.status
      bot.status = game.status
      oldstatus = game.status
    end
#    nstat = `netstat -4|grep 'xmpp-client ESTABLISHED'`
#    unless nstat.length > 0
    sleep 9
#    unless bot.jabber.connected?
#      bot.jabber.disconnect
#      sleep 1
#      bot.jabber.connect
#      bot.status = game.status
#      oldstatus = game.status
#    end
#   sleep 27
    if !$show_must_go_on
      sleep 3
      exit
    end
  }
end

game.send { |addr, txt|
  bot.sendstack.push([addr, txt])
}
bot.repeatcalls
GC.start

#if @jabber_enable
#  bot.connect
#else
  print "Disabled jabber mode.\nWait enter for exit...\n"
  print STDIN.gets.chomp
  print "Shutdown...\n"
#end


text:
@interface EmployeeFormViewController ()
@property (nonatomic, strong) Employee *employee;
@end

@implementation EmployeeFormViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)reloadFromAppLinkRefresh {
    [super reloadFromAppLinkRefresh];

    EmployeeForm *form = [EmployeeForm new];

    NSString *employeeID = self.appLinkRoutingParameters[@"employeeID"];

    if (self.appLinkRoutingParameters[@"employeeID"]) {
        NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id  _Nonnull evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
            return [[(Employee *)evaluatedObject employeeID] isEqualToString:employeeID];
        }];
        Employee *e = [[[Employee MR_findAll] filteredArrayUsingPredicate:predicate] firstObject];
        if (e) {
            self.employee = e;

            form.firstName       = e.firstName;
            form.lastName        = e.lastName;
            form.birthDate       = e.birthdate;
            form.jobTitle        = e.jobTitle;
            form.avatarImageName = e.avatarImageName;
        }
    }

    self.formController = [[FXFormController alloc] init];
    self.formController.tableView = self.tableView;
    self.formController.delegate = self;
    self.formController.form = form;
    [self.tableView reloadData];

    UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save"
                                                                   style:UIBarButtonItemStylePlain
                                                                  target:self
                                                                  action:@selector(save)];
    if (self.employee) {
        UIBarButtonItem *deleteButton = [[UIBarButtonItem alloc] initWithTitle:@"Delete"
                                                                       style:UIBarButtonItemStylePlain
                                                                      target:self
                                                                      action:@selector(delete)];
        self.navigationItem.rightBarButtonItems = @[deleteButton, saveButton];
    }
    else {
        self.navigationItem.rightBarButtonItem = saveButton;
    }
}

- (void)save {
    EmployeeForm *form = (EmployeeForm *)self.formController.form;

    if (self.employee) {
        self.employee.firstName       = form.firstName;
        self.employee.lastName        = form.lastName;
        self.employee.birthdate       = form.birthDate;
        self.employee.jobTitle        = form.jobTitle;
        self.employee.avatarImageName = form.avatarImageName;

        [self.employee.managedObjectContext MR_saveOnlySelfAndWait];
    }
    else {
        Employee *e       = [Employee MR_createEntity];
        e.firstName       = form.firstName;
        e.lastName        = form.lastName;
        e.birthdate       = form.birthDate;
        e.jobTitle        = form.jobTitle;
        e.avatarImageName = form.avatarImageName;

        Company *currentCompany = [Company MR_findFirstByAttribute:@"name" withValue:self.appLinkRoutingParameters[@"companyName"]];
        e.company = currentCompany;

        [e.managedObjectContext MR_saveOnlySelfAndWait];
    }

    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)delete {
    [self.employee MR_deleteEntity];
    [[NSManagedObjectContext MR_defaultContext] MR_saveOnlySelfAndWait];
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end


text:
require  File.expand_path(File.dirname(__FILE__)) + "/../../../../../spec/spec_helper"

require  File.expand_path(File.dirname(__FILE__)) + '/../forum_test_helper'

describe ForumTopic do

  include ForumTestHelper

  reset_domain_tables :forum_forums,:forum_posts,:forum_categories,:forum_topics,:end_users

  it 'Initial test data validation' do
    @user = create_end_user
    @user.save.should be_true
    @cat = create_forum_category
    @cat.save.should be_true
    @forum = create_forum_forum @cat
    @forum.save.should be_true
  end

  describe 'Detailed forum topic testing' do

    before(:each) do
      @user = create_end_user
      @user.save
      @cat = create_forum_category
      @cat.save
      @forum = create_forum_forum @cat
      @forum.save
    end

    it "should require a subject, posted_by and forum_forum_id" do
      @topic = ForumTopic.new()

      @topic.valid?

      @topic.should have(1).errors_on(:subject)
      @topic.should have(1).errors_on(:posted_by)
      @topic.should have(1).errors_on(:forum_forum_id)
    end

    it "should set posted_by to end_user.username" do
      @topic = @forum.forum_topics.build :subject => 'test subject', :end_user => @user
      @topic.save.should be_true
      @topic.posted_by.should == (@user.first_name + ' ' + @user.last_name)
    end

    it "should increment forum_topics_count" do
      @topic = @forum.forum_topics.build :subject => 'test subject', :posted_by => 'Test User'
      @topic.save.should be_true
      @forum.reload
      @forum.forum_topics.size.should == 1

      @topic = @forum.forum_topics.build :subject => 'test subject', :end_user => @user
      @topic.save.should be_true
      @forum.reload
      @forum.forum_topics.size.should == 2
    end

    it "should be able to set a topic as sticky" do
      @topic = @forum.forum_topics.build :subject => 'test subject', :end_user => @user, :sticky => 1
      @topic.save.should be_true
      @forum.forum_topics.sticky_topics.count.should == 1
    end

    it "should be able to connect to a sperate piece of content" do
      @topic = @forum.forum_topics.build :subject => 'test subject', :end_user => @user, :sticky => 1, :content => @user
      @topic.save.should be_true
      @forum.forum_topics.sticky_topics.count.should == 1
      @topic.content_type.should == 'EndUser'
      @topic.content_id.should == @user.id
    end
  end
end


text:
package jkind.translation.tuples;

import java.util.ArrayList;
import java.util.List;

import jkind.lustre.BinaryOp;
import jkind.lustre.Expr;
import jkind.lustre.IfThenElseExpr;
import jkind.lustre.TupleExpr;
import jkind.lustre.UnaryExpr;
import jkind.lustre.UnaryOp;
import jkind.translation.compound.CompoundUtil;

public class TupleUtil {
	public static TupleExpr mapBinary(BinaryOp op, TupleExpr expr1, TupleExpr expr2) {
		return new TupleExpr(CompoundUtil.mapBinary(op, expr1.elements, expr2.elements));
	}

	public static TupleExpr mapIf(Expr cond, TupleExpr expr1, TupleExpr expr2) {
		return new TupleExpr(mapIf(cond, expr1.elements, expr2.elements));
	}

	private static List<Expr> mapIf(Expr cond, List<Expr> exprs1, List<Expr> exprs2) {
		List<Expr> result = new ArrayList<>();
		for (int i = 0; i < exprs1.size(); i++) {
			result.add(new IfThenElseExpr(cond, exprs1.get(i), exprs2.get(i)));
		}
		return result;
	}

	public static TupleExpr mapUnary(UnaryOp op, TupleExpr expr) {
		return new TupleExpr(mapUnary(op, expr.elements));
	}

	public static List<Expr> mapUnary(UnaryOp op, List<Expr> exprs) {
		List<Expr> result = new ArrayList<>();
		for (int i = 0; i < exprs.size(); i++) {
			result.add(new UnaryExpr(op, exprs.get(i)));
		}
		return result;
	}
}


text:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { OverlayscrollbarsModule } from 'overlayscrollbars-ngx';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, OverlayscrollbarsModule],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}


text:
/**
 * `compileAssets`
 *
 * ---------------------------------------------------------------
 *
 * This Grunt tasklist is not designed to be used directly-- rather
 * it is a helper called by the `default`, `prod`, `build`, and
 * `buildProd` tasklists.
 *
 * For more information see:
 *   http://sailsjs.org/documentation/anatomy/my-app/tasks/register/compile-assets-js
 *
 */
module.exports = function(grunt) {
  grunt.registerTask('compileAssets', [
    'clean:dev',
    'jst:dev',
    'less:dev',
    'copy:dev',
    'includes:dev',
    'coffee:dev'
  ]);
};


text:
package com.app.action.item;

import com.app.action.BaseAction;
import com.app.domain.output.BaseOutput;
import com.app.service.BaseService;
import com.app.service.ServiceBeanNames;
import com.app.service.TestService;
import com.app.service.impl.TestServiceImpl;

public abstract class ItemAction<T extends BaseOutput> extends BaseAction<T> {
    public static TestService testService = BaseService.getService(ServiceBeanNames.TEST_SERVICE, TestServiceImpl.class);
}


text:
import { Attribute } from './Attribute';
import { IAttribute } from './IAttribute';
import { IStringificationParams } from './IStringificationParams';
import { Node } from './Node';
import { SelfClosingNode } from './SelfClosingNode';
import { VoidNode } from './VoidNode';
import { TextNode } from './TextNode';
import { CommentNode } from './CommentNode';
import { CDataSectionNode } from './CDataSectionNode';
import { DeclarationOpenerNode } from './DeclarationOpenerNode';
import { ProcessingInstructionNode } from './ProcessingInstructionNode';
import { ContainerNode } from './ContainerNode';
import { DocumentNode } from './DocumentNode';
export { Attribute, IAttribute, IStringificationParams, Node, SelfClosingNode, VoidNode, TextNode, CommentNode, CDataSectionNode, DeclarationOpenerNode, ProcessingInstructionNode, ContainerNode, DocumentNode };


text:
<?php
namespace Chamilo\Core\Repository\Implementation\GoogleDocs\Component;

use Chamilo\Core\Repository\Implementation\GoogleDocs\Form\ExternalObjectForm;
use Chamilo\Core\Repository\Implementation\GoogleDocs\Manager;
use Chamilo\Libraries\Architecture\Application\Application;
use Chamilo\Libraries\File\Redirect;
use Chamilo\Libraries\Platform\Session\Request;
use Chamilo\Libraries\Translation\Translation;
use Chamilo\Libraries\Utilities\StringUtilities;

class UploaderComponent extends Manager
{

    public function run()
    {
        $form = new ExternalObjectForm(ExternalObjectForm::TYPE_CREATE, $this->get_url(), $this);

        if ($form->validate())
        {
            $id = $form->upload_file($this->set_folder_from_values($form->exportValues()));

            if (! is_null($id))
            {
                $parameters = $this->get_parameters();
                $parameters[Manager::PARAM_ACTION] = Manager::ACTION_VIEW_EXTERNAL_REPOSITORY;
                $parameters[Manager::PARAM_EXTERNAL_REPOSITORY_ID] = $id;

                $redirect = new Redirect($parameters);
                $redirect->toUrl();
            }
            else
            {
                Request::set_get(Application::PARAM_ERROR_MESSAGE, Translation::get('GoogleDocsUploadProblem'));

                $html = array();

                $html[] = $this->render_header();
                $html[] = $form->toHtml();
                $html[] = $this->render_footer();

                return implode(PHP_EOL, $html);
            }
        }
        else
        {
            $html = array();

            $html[] = $this->render_header();
            $html[] = $form->toHtml();
            $html[] = $this->render_footer();

            return implode(PHP_EOL, $html);
        }
    }

    public function set_folder_from_values($values)
    {
        $parent_id = $values[ExternalObjectForm::PARENT_ID];
        $new_folder_name = $values[ExternalObjectForm::NEW_FOLDER];

        if (! StringUtilities::getInstance()->isNullOrEmpty($new_folder_name, true))
        {
            $new_folder = $this->create_new_folder($new_folder_name, $parent_id);
            if ($new_folder)
            {
                return $new_folder;
            }
        }
        return $parent_id;
    }

    public function create_new_folder($category_name, $parent_id)
    {
        return $this->get_external_repository_manager_connector()->create_external_repository_object(
            $category_name,
            $parent_id);
    }
}


text:
namespace media {

// This is a CdmAllocator that creates buffers using mojo shared memory.
class MEDIA_MOJO_EXPORT MojoCdmAllocator final : public CdmAllocator {
 public:
  MojoCdmAllocator();

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

  ~MojoCdmAllocator() final;

  // CdmAllocator implementation.
  cdm::Buffer* CreateCdmBuffer(size_t capacity) final;
  std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() final;

 private:
  friend class MojoCdmAllocatorTest;

  // Map of available buffers. Done as a mapping of capacity to shmem regions to
  // make it efficient to find an available buffer of a particular size.
  // Regions in the map are unmapped.
  using AvailableRegionMap =
      std::multimap<size_t, std::unique_ptr<base::MappedReadOnlyRegion>>;

  // Allocates a shmem region of at least |capacity| bytes.
  std::unique_ptr<base::MappedReadOnlyRegion> AllocateNewRegion(
      size_t capacity);

  // Returns |region| to the map of available buffers, ready to be used the
  // next time CreateCdmBuffer() is called.
  void AddRegionToAvailableMap(
      std::unique_ptr<base::MappedReadOnlyRegion> region);

  // Returns the base::MappedReadOnlyRegion for a cdm::Buffer allocated by this
  // class.
  const base::MappedReadOnlyRegion& GetRegionForTesting(
      cdm::Buffer* buffer) const;

  // Returns the number of buffers in |available_regions_|.
  size_t GetAvailableRegionCountForTesting();

  // Map of available, already allocated buffers.
  AvailableRegionMap available_regions_;

  // Confirms single-threaded access.
  base::ThreadChecker thread_checker_;

  // NOTE: Weak pointers must be invalidated before all other member variables.
  base::WeakPtrFactory<MojoCdmAllocator> weak_ptr_factory_{this};
};

}  // namespace media

#endif  // MEDIA_MOJO_SERVICES_MOJO_CDM_ALLOCATOR_H_


text:
@namespace oxy "http://www.oxygenxml.com/extensions/author";

/* EXM-22130 If a table refers other table, its display is block */
*[class~="topic/table"][conref]:not([conaction]),
*[class~="topic/table"][conkeyref]:not([conaction]){
    display : block;
}

/* EXM-17012 Avoid layout messages in tables with conref */
*[class~="topic/simpletable"][conref]:not([conaction]),
*[class~="topic/simpletable"][conkeyref]:not([conaction]){
    display : block;
}
/*No margins and static content to elements with conref.
The content will we present on the conreffed element.*/
*[conref]:not([conaction]) > *,
*[conkeyref]:not([conaction]) > *{
    background-color:inherit;
    margin:0;
    padding:0;
    border:none;
}
/*EXM-20282 Remove static text, no margins*/
*[conref]:not([conaction]):before,
*[conkeyref]:not([conaction]):before{
    content:"" !important;
    display:inline;
    margin:0px;
}
/*EXM-33149 We might also have an after content.*/
*[conref]:not([conaction]):after,
*[conkeyref]:not([conaction]):after{
    content:"" !important;
    display:inline;
    margin:0px;
}
/* start conref/conkeyref handling */
/* Hides the required content that is not needed for display on conkeyref and conref */
*[conref]:-oxy-has-valid-referenced-content
            > *:not(:-oxy-referenced-content):not(oxy|reference),
*[conkeyref]:-oxy-has-valid-referenced-content
            > *:not(:-oxy-referenced-content):not(oxy|reference)
{
    display : none !important;
}

*[conref]:-oxy-has-valid-referenced-content,
*[conkeyref]:-oxy-has-valid-referenced-content {
	visibility:-oxy-collapse-text;
}

oxy|reference,
*[conref]:-oxy-has-valid-referenced-content > *:-oxy-referenced-content,
*[conkeyref]:-oxy-has-valid-referenced-content > *:-oxy-referenced-content{
	visibility:visible;
}

/* --- end conref/conkeyref handling --- */

/*EXM-16989 Some conref cases start*/
/* Try to avoid re-declaring the counter when a content reference is used */

*[class~="topic/ul"] > *[class~="topic/li"][conref]:not([conaction]),
*[class~="topic/ul"] > *[class~="topic/li"][conkeyref]:not([conaction]) {
    display: block;
}

/*  OL  -  LI */
*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"]:first-child,
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]:first-child {
    counter-reset: none;
}

*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction]),
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]){
    counter-increment: none;
}

*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction]):before,
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]):before,
*[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction]):before,
*[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]):before,
*[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction]):before,
*[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"] *[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]):before
{
   /*Avoid showing the counter*/
    content: "";
}

/* Counter increment for the first, second, third and fourth level of ordered list*/
*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"],
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]{
    counter-increment: item-count;
}

/* Counter display for the first, second, third and fourth level of ordered list*/
*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"]:before,
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]:before{
    content: counter(item-count, decimal) ". ";
    font-weight:bold;
}
*[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"]:before,
*[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]:before{
    content: counter(item-count, lower-alpha) ". ";
}
*[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"]:before,
*[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]:before{
    content: counter(item-count, lower-roman) ". ";
}
*[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"]:before,
*[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] *[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"]:before{
    content: counter(item-count, decimal) ". ";
}

*[class~="topic/ol"] > *[class~="topic/li"][conref]:not([conaction])    > *[class~="topic/li"],
*[class~="topic/ol"] > *[class~="topic/li"][conkeyref]:not([conaction]) > *[class~="topic/li"] {
   /* Use list-item instead of block to avoid putting the
    sentinels markers of the "ol" and the first "li"
    on the same line, in compact tag display.*/
    display:list-item;
    list-style:none;
}

/*Make the steps and substeps more readable when using conrefs.*/

*[class~="task/substeps"] > *[class~="task/substep"][conref]:not([conaction]):before,
*[class~="task/substeps"] > *[class~="task/substep"][conkeyref]:not([conaction]):before{
	display:none;
}

*[class~="task/substeps"] > *[class~="task/substep"][conref]:not([conaction]) > *,
*[class~="task/substeps"] > *[class~="task/substep"][conkeyref]:not([conaction]) > *{
	display:none;
}

*[class~="task/steps"] > *[class~="task/step"][conref]:not([conaction]):before,
*[class~="task/steps"] > *[class~="task/step"][conkeyref]:not([conaction]):before {
	display:none;
}

*[class~="task/steps"] > *[class~="task/step"][conref]:not([conaction]) > * ,
*[class~="task/steps"] > *[class~="task/step"][conkeyref]:not([conaction]) > * {
	display:none;
}

/*EXM-31899 Allow arrows between UI controls referred with conref or conkeyref*/
*[class~="ui-d/menucascade"] > *[class~="ui-d/uicontrol"][conref] > *[class~="ui-d/uicontrol"]:before,
*[class~="ui-d/menucascade"] > *[class~="ui-d/uicontrol"][conkeyref] > *[class~="ui-d/uicontrol"]:before{
    content: "→";
}
*[class~="ui-d/menucascade"] > *[class~="ui-d/uicontrol"][conref]:first-child > *[class~="ui-d/uicontrol"]:before,
*[class~="ui-d/menucascade"] > *[class~="ui-d/uicontrol"][conkeyref]:first-child > *[class~="ui-d/uicontrol"]:before{
    content: "";
}

/*  SOME SPECIAL HANDLING FOR CONACTION mark, push before, after and replace */
*[conaction="pushbefore"],
*[conaction="pushafter"],
*[conaction="pushreplace"]{
    border:1pt dotted;
}

*[conaction="mark"]{
    border-left:1pt solid;
}

*[conaction="pushbefore"]:before{
    -oxy-append-content: oxy_label(text, " (Push Before)", styles,
      "font-size:smaller;color:gray;")"" !important;
}

*[conaction="pushafter"]:before{
    -oxy-append-content: oxy_label(text, " (Push After)", styles,
      "font-size:smaller;color:gray;")"" !important;
}

*[conaction="pushreplace"]:before{
    -oxy-append-content: oxy_label(text, " (", styles,
      "font-size:smaller;color:gray;")"" url("../../img/link.png") oxy_label(text, " Push Replace)", styles,
      "font-size:smaller;color:gray;")"" !important;
      link: attr(conref);
}

*[conaction="mark"]:before{
    -oxy-append-content: oxy_label(text, " (", styles,
      "font-size:smaller;color:gray;")"" url("../../img/link.png") oxy_label(text, " Mark)", styles,
      "font-size:smaller;color:gray;")"" !important;
      link: attr(conref);
}

*[conaction="pushreplace"][conkeyref]:before,
*[conaction="mark"][conkeyref]:before{
      link: oxy_concat("", attr(conkeyref, keyref));
}

*[conaction="pushreplace"][conref]:before,
*[conaction="mark"][conref]:before{
      link: attr(conref);
}

/*EXM-16989 Some conref cases end*/

/*EXM-30888 Avoid full tags on directly linked content*/
*:-oxy-has-valid-referenced-content > *:-oxy-referenced-content{
    -oxy-display-tags: none;
}

/* TODO - dan - asta e ceva generic. trebuie sa analizez atributele ref.*/

@media oxygen{
  /* Has no meaning in print*/

  /*Support for DITA 1.2 keyrefs*/
  *[keyref]:before,
  /*EXM-21733 Prefer keyref to href as the DITA 1.2 specs says.*/
  *[keyref][href]:before{
       /*Use concat to cast from URI to string*/
      link: oxy_concat("", attr(keyref, keyref));
      content:url("../../img/link.png") "[" attr(keyref) "]";
      /*See -colors.css */
      text-decoration:underline;
  }
  *[keyref]:empty {
      content: oxy_label(text, oxy_getSomeText(oxy_link-text(), 150, true), background-color, rgb(240, 240, 240));
  }
}

@media oxygen-high-contrast-black, oxygen-dark-theme {
    *[keyref]:empty {
      content: oxy_label(text, oxy_getSomeText(oxy_link-text(), 150, true), background-color, rgb(128, 128, 128));
  }
}


text:
module Fixtures
  class NilDescTask < Evoke::Task
    def invoke
    end
  end
end


text:
#ifndef _NGX_DYNAMIC_COMMAND_H_INCLUDED_
#define _NGX_DYNAMIC_COMMAND_H_INCLUDED_

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>

typedef struct {
    ngx_str_t               name;
    void                 *(*create_conf)(ngx_conf_t *cf);
    char                 *(*init_conf)(ngx_conf_t *cf, void *conf);
} ngx_dynamic_core_module_t;

#if (NGX_PCRE)
typedef struct {
    ngx_regex_t            *regex;
    ngx_str_t               name;
} ngx_dynamic_regex_t;
#endif

#if 0
/*
 * if use dynamic conf, module define should use
 *  NGX_MODULE_V1_DYNAMIC_PADDING and set
 *  module dynamic context and
 *  module dynamic directives as bellow
 */
ngx_module_t  ngx_test_module = {
    NGX_MODULE_V1,
    &ngx_test_module_ctx,                   /* module context */
    ngx_test_commands,                      /* module directives */
    NGX_CORE_MODULE,                        /* module type */
    NULL,                                   /* init master */
    NULL,                                   /* init module */
    NULL,                                   /* init process */
    NULL,                                   /* init thread */
    NULL,                                   /* exit thread */
    NULL,                                   /* exit process */
    NULL,                                   /* exit master */
    &ngx_test_module_dctx,                  /* module dynamic context */
    ngx_test_dcommands,                     /* module dynamic directives */
    NGX_MODULE_V1_DYNAMIC_PADDING
};
#endif
#define NGX_MODULE_V1_DYNAMIC_PADDING  0, 0, 0, 0, 0, 0

extern ngx_uint_t  ngx_core_max_module;

/*
 * return value:
 *      return NGX_OK for successd, NGX_ERROR for failed
 * paras:
 *      cf:   ngx_conf_t passed from ngx_dynamic_conf_load_conf
 *      init: only ngx_dynamic_conf_load_conf set 1, otherwise set 0
 */
ngx_int_t ngx_dynamic_conf_parse(ngx_conf_t *cf, unsigned init);

/*
 * return value:
 *      return regex context
 * paras:
 *      cf: ngx_conf_t passed in dynamic cmd handler
 *      rc: regex options
 */
#if (NGX_PCRE)
ngx_dynamic_regex_t *ngx_dynamic_regex_compile(ngx_conf_t *cf,
        ngx_regex_compile_t *rc);
#endif

int ngx_dynamic_cmp_dns_wildcards(const void *one, const void *two);

void *ngx_get_dconf(ngx_module_t *m);

#endif


text:
#include <pcl/io/vlp_grabber.h>

using boost::asio::ip::udp;

#define VLP_MAX_NUM_LASERS 16
#define VLP_DUAL_MODE 0x39

/////////////////////////////////////////////////////////////////////////////
pcl::VLPGrabber::VLPGrabber (const std::string& pcapFile) :
    HDLGrabber ("", pcapFile)
{
  loadVLP16Corrections ();
}

/////////////////////////////////////////////////////////////////////////////
pcl::VLPGrabber::VLPGrabber (const boost::asio::ip::address& ipAddress,
                             const unsigned short int port) :
    HDLGrabber (ipAddress, port)
{
  loadVLP16Corrections ();
}

/////////////////////////////////////////////////////////////////////////////
pcl::VLPGrabber::~VLPGrabber () throw ()
{
}

/////////////////////////////////////////////////////////////////////////////
void
pcl::VLPGrabber::loadVLP16Corrections ()
{
  double vlp16_vertical_corrections[] = { -15, 1, -13, 3, -11, 5, -9, 7, -7, 9, -5, 11, -3, 13, -1, 15

  };
  for (int i = 0; i < VLP_MAX_NUM_LASERS; i++)
  {
    HDLGrabber::laser_corrections_[i].azimuthCorrection = 0.0;
    HDLGrabber::laser_corrections_[i].distanceCorrection = 0.0;
    HDLGrabber::laser_corrections_[i].horizontalOffsetCorrection = 0.0;
    HDLGrabber::laser_corrections_[i].verticalOffsetCorrection = 0.0;
    HDLGrabber::laser_corrections_[i].verticalCorrection = vlp16_vertical_corrections[i];
    HDLGrabber::laser_corrections_[i].sinVertCorrection = std::sin (HDL_Grabber_toRadians(vlp16_vertical_corrections[i]));
    HDLGrabber::laser_corrections_[i].cosVertCorrection = std::cos (HDL_Grabber_toRadians(vlp16_vertical_corrections[i]));
  }
}

/////////////////////////////////////////////////////////////////////////////
boost::asio::ip::address
pcl::VLPGrabber::getDefaultNetworkAddress ()
{
  return (boost::asio::ip::address::from_string ("255.255.255.255"));
}

/////////////////////////////////////////////////////////////////////////////
void
pcl::VLPGrabber::toPointClouds (HDLDataPacket *dataPacket)
{
  static uint32_t scan_counter = 0;
  static uint32_t sweep_counter = 0;
  if (sizeof(HDLLaserReturn) != 3)
    return;

  time_t system_time;
  time (&system_time);
  time_t velodyne_time = (system_time & 0x00000000ffffffffl) << 32 | dataPacket->gpsTimestamp;

  scan_counter++;

  double interpolated_azimuth_delta;

  int index = 1;
  if (dataPacket->mode == VLP_DUAL_MODE)
  {
    index = 2;
  }
  if (dataPacket->firingData[index].rotationalPosition < dataPacket->firingData[0].rotationalPosition)
  {
    interpolated_azimuth_delta = ( (dataPacket->firingData[index].rotationalPosition + 36000) - dataPacket->firingData[0].rotationalPosition) / 2.0;
  }
  else
  {
    interpolated_azimuth_delta = (dataPacket->firingData[index].rotationalPosition - dataPacket->firingData[0].rotationalPosition) / 2.0;
  }

  for (int i = 0; i < HDL_FIRING_PER_PKT; ++i)
  {
    HDLFiringData firing_data = dataPacket->firingData[i];

    for (int j = 0; j < HDL_LASER_PER_FIRING; j++)
    {
      double current_azimuth = firing_data.rotationalPosition;
      if (j > VLP_MAX_NUM_LASERS)
      {
        current_azimuth += interpolated_azimuth_delta;
      }
      if (current_azimuth > 36000)
      {
        current_azimuth -= 36000;
      }
      if (current_azimuth < HDLGrabber::last_azimuth_)
      {
        if (current_sweep_xyz_->size () > 0)
        {
          current_sweep_xyz_->is_dense = current_sweep_xyzi_->is_dense = false;
          current_sweep_xyz_->header.stamp = velodyne_time;
          current_sweep_xyzi_->header.stamp = velodyne_time;
          current_sweep_xyz_->header.seq = sweep_counter;
          current_sweep_xyzi_->header.seq = sweep_counter;

          sweep_counter++;

          HDLGrabber::fireCurrentSweep ();
        }
        current_sweep_xyz_.reset (new pcl::PointCloud<pcl::PointXYZ> ());
        current_sweep_xyzi_.reset (new pcl::PointCloud<pcl::PointXYZI> ());
      }

      PointXYZ xyz;
      PointXYZI xyzi;
      PointXYZ dual_xyz;
      PointXYZI dual_xyzi;

      HDLGrabber::computeXYZI (xyzi, current_azimuth, firing_data.laserReturns[j], laser_corrections_[j % VLP_MAX_NUM_LASERS]);

      xyz.x = xyzi.x;
      xyz.y = xyzi.y;
      xyz.z = xyzi.z;

      if (dataPacket->mode == VLP_DUAL_MODE)
      {
        HDLGrabber::computeXYZI (dual_xyzi, current_azimuth, dataPacket->firingData[i + 1].laserReturns[j], laser_corrections_[j % VLP_MAX_NUM_LASERS]);

        dual_xyz.x = dual_xyzi.x;
        dual_xyz.y = dual_xyzi.y;
        dual_xyz.z = dual_xyzi.z;

      }

      if (! (boost::math::isnan (xyz.x) || boost::math::isnan (xyz.y) || boost::math::isnan (xyz.z)))
      {
        current_sweep_xyz_->push_back (xyz);
        current_sweep_xyzi_->push_back (xyzi);

        last_azimuth_ = current_azimuth;
      }
      if (dataPacket->mode == VLP_DUAL_MODE)
      {
        if ( (dual_xyz.x != xyz.x || dual_xyz.y != xyz.y || dual_xyz.z != xyz.z)
            && ! (boost::math::isnan (dual_xyz.x) || boost::math::isnan (dual_xyz.y) || boost::math::isnan (dual_xyz.z)))
        {
          current_sweep_xyz_->push_back (dual_xyz);
          current_sweep_xyzi_->push_back (dual_xyzi);
        }
      }
    }
    if (dataPacket->mode == VLP_DUAL_MODE)
    {
      i++;
    }
  }
}

/////////////////////////////////////////////////////////////////////////////
std::string
pcl::VLPGrabber::getName () const
{
  return (std::string ("Velodyne LiDAR (VLP) Grabber"));
}