text:
package net.izsak.sandcastle.doc;

import net.izsak.sandcastle.JavadocTester;
import nu.xom.Document;
import nu.xom.Node;

import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Test;

/**
 * @author Jozef Izso
 *
 */
public class ClassDocTest {

	@Test
	public void simpleClass_Test() throws Exception {
		JavadocTester tester = new JavadocTester("Class01.java");
		Document doc = tester.getDocumentationXml();

		Node elm = doc.query("//member[@name='T:samples.Class01']").get(0);

		XMLAssert.assertXMLEqual("Just a simple class.", elm.getChild(0).toXML());
	}

	@Test
	public void genericClass01_Test() throws Exception {
		JavadocTester tester = new JavadocTester("GenericClass01.java");
		Document doc = tester.getDocumentationXml();

		String expSummary = ""+
            				    "Generic class with one type parameter <typeparamref name='T' />."+
            			    "";
		String expTypePar = "<typeparam name='T'>Type parameter.</typeparam>";

		Node elm = doc.query("//member[@name='T:samples.GenericClass01{T}']").get(0);
		Node summary = elm.getChild(0);
		Node typePar = elm.getChild(1);

		XMLAssert.assertXMLEqual(expSummary, summary.toXML());
		XMLAssert.assertXMLEqual(expTypePar, typePar.toXML());
	}

	@Test
	public void genericClass02_Test() throws Exception {
		JavadocTester tester = new JavadocTester("GenericClass02.java");
		Document doc = tester.getDocumentationXml();

		String expSummary = ""+
            				    "Generic class with two type parameters."+
            			    "";
		String expTypeParT = "<typeparam name='T'>First type parameter.</typeparam>";
		String expTypeParE = "<typeparam name='E'>Second type parameter.</typeparam>";

		Node elm = doc.query("//member[@name='T:samples.GenericClass02{T,E}']").get(0);
		Node summary = elm.getChild(0);
		Node typeParT = elm.getChild(1);
		Node typeParE = elm.getChild(2);

		XMLAssert.assertXMLEqual(expSummary, summary.toXML());
		XMLAssert.assertXMLEqual(expTypeParT, typeParT.toXML());;
		XMLAssert.assertXMLEqual(expTypeParE, typeParE.toXML());
	}

	@Test
	public void genericClass03_Test() throws Exception {
		JavadocTester tester = new JavadocTester("GenericClass03.java");
		Document doc = tester.getDocumentationXml();

		String expSummary = ""+
		                        "<see cref='M:samples.GenericClass03.method1{T}(T)' /> "+
            				    "takes just one templated parameter "+
            				    "<paramref name='obj'/>\n of type <typeparamref name='T'/>."+
            			    "";
		String expTypeParT = "<typeparam name='T'>Type of the input object.</typeparam>";
		String expParam    = "<param name='obj'>Actual object.</param>";
		String expReturn   = "<returns>An object of type <typeparamref name='T'/>.</returns>";

		Node elm = doc.query("//member[@name='M:samples.GenericClass03.method1{T}(T)']").get(0);
		Node summary = elm.getChild(0);
		Node typeParT = elm.getChild(1);
		Node typeParam = elm.getChild(2);
		Node ret = elm.getChild(3);

		XMLAssert.assertXMLEqual(expSummary, summary.toXML());
		XMLAssert.assertXMLEqual(expTypeParT, typeParT.toXML());
		XMLAssert.assertXMLEqual(expParam, typeParam.toXML());
		XMLAssert.assertXMLEqual(expReturn, ret.toXML());
	}
}


text:
import React from 'react';

export default class Cmp1 extends React.Component {
  render() {
    return
{ this.props.name }
;
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.jpasecurity.contacts.model;

import java.io.Serializable;

import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @author Arne Limburg
 */
@Entity
@DeclareRoles({ "admin", "user" })
@RolesAllowed("admin")
@Table(name = "USR")
public class User implements Serializable {

    @Id @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    @Basic
    private String name;

    public User() {
    }

    public User(String name) {
        setName(name);
    }

    public int getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String toString() {
        return getName();
    }

    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof User)) {
            return false;
        }
        User user = (User)object;
        return getName().equals(user.getName());
    }

    public int hashCode() {
        return getName().hashCode();
    }
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "menu".
 *
 * @property integer $menu_id
 * @property string $name
 * @property string $measure
 * @property string $additional_info
 * @property integer $position
 * @property integer $active
 */
class Menu extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'menu';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['position'], 'required'],
            [['position', 'active'], 'integer'],
            [['name', 'measure', 'additional_info'], 'string', 'max' => 255],
            [['position'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'menu_id' => 'Menu ID',
            'name' => 'Nazwa',
            'measure' => 'Jednostka miary',
            'additional_info' => 'Dodatkowe informacje',
            'position' => 'Pozycja',
            'active' => 'Aktywne',
        ];
    }

    public function getItems()
    {
        return $this->hasMany(MenuItems::className(), ['menu_id' => 'menu_id']);
    }
}


text:
import pickle, socket

def send_command(host, pattern):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(host)
    f = s.makefile('b')
    pickle.dump(pattern, f)
    f.flush()
    f.close()
    s.close()


text:
<?php
/**
 * Test Case
 *
 * PHP version 5.6
 *
 * @category Test
 * @package  Tests
 * @author   Taylor Otwell <taylorotwell@gmail.com>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     https://laravel.com/docs/5.2 Laravel Documentation
 */

/**
 * Test Case
 *
 * A test case that creates an instance of the application.
 *
 * @category Test
 * @package  Tests
 * @author   Taylor Otwell <taylorotwell@gmail.com>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     https://laravel.com/docs/5.2 Laravel Documentation
 */
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
    /**
     * The base URL to use while testing the application.
     *
     * @var string
     */
    protected $baseUrl = 'http://localhost';

    /**
     * Creates the application.
     *
     * @return \Illuminate\Foundation\Application
     */
    public function createApplication()
    {
        $app = include __DIR__.'/../bootstrap/app.php';

        $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();

        return $app;
    }
}


text:
/*************************************************************************

        name: infostate.pl
 description: IS Type definition

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

:- module(infostate, [infostate_variable_of_type/2]).

/*----------------------------------------------------------------------
     dis -- dynamic infostate
----------------------------------------------------------------------*/

infostate_variable_of_type( is, IS ) :-
    IS = record( [ private : Private,
		   shared : Shared ] ),
    Shared = record( [ com : set( proposition ),
		       qud : stackset( question ),
		       lu : LU ] ),
    Private = record( [ agenda: stack(action),
			plan : stack( action ),
			bel : set( proposition ) ] ),
    LU = record( [ speaker : speaker,
		   moves : set( move ) ] ).


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginEnd="@dimen/material_drawer_margin"
    android:layout_marginRight="@dimen/material_drawer_margin"
    android:elevation="8dp"
    android:orientation="vertical">

    <include
        android:id="@+id/toolbar_top"
        layout="@layout/toolbar_top" />

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar" />

    <id.bizdir.ui.widget.DrawShadowFrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/toolbar"
        android:clipChildren="false"
        app:shadowDrawable="@drawable/header_shadow">

        <ImageView
            android:id="@+id/ivBackground"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/background_main" />

        <RelativeLayout
            android:id="@+id/mainView"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:id="@+id/headerView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:layout_marginTop="5dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/textCity"
                    style="@style/TextShadow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="top"
                    android:singleLine="true"
                    android:text="Jakarta"
                    android:textColor="@color/white"
                    android:textSize="24sp" />

                <TextView
                    android:id="@+id/textWeatherType"
                    style="@style/TextShadow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="top"
                    android:singleLine="true"
                    android:text="Mostly Sunny"
                    android:textColor="@color/white"
                    android:textSize="15sp" />

                <TextView
                    android:id="@+id/textTodayCelsius"
                    style="@style/TextShadow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="top"
                    android:singleLine="true"
                    android:text="30°C"
                    android:textColor="@color/white"
                    android:textSize="36sp" />

            </LinearLayout>

            <FrameLayout
                android:id="@+id/dataView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@+id/adsView"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/headerView"
                android:layout_marginTop="10dp">

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1px"
                    android:background="@color/white_transparent" />

                <ListView
                    android:id="@+id/list"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/margintop_para_listview"
                    android:cacheColorHint="@color/listview_cache_color_hint"
                    android:divider="@color/white_transparent"
                    android:dividerHeight="1px" />

                <TextView
                    android:id="@+id/textNoData"
                    style="@style/TextShadow"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:text="@string/no_data"
                    android:textColor="@color/white"
                    android:textSize="16sp" />
            </FrameLayout>

            <FrameLayout
                android:id="@+id/adsView"
                android:layout_width="match_parent"
                android:layout_height="@dimen/banner_image_height"
                android:layout_alignParentBottom="true">

                <ImageView
                    android:id="@+id/image"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/banner_image_height"
                    android:contentDescription="@string/app_name"
                    android:scaleType="fitXY"
                    android:src="@drawable/advertising_image" />

                <ImageView
                    android:id="@+id/imageButtonAds"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/banner_image_height"
                    android:contentDescription="@string/app_name"
                    android:scaleType="fitXY"
                    android:src="@drawable/bg_list" />
            </FrameLayout>

        </RelativeLayout>

    </id.bizdir.ui.widget.DrawShadowFrameLayout>

</RelativeLayout>


text:
<?php

namespace Khepin\YamlFixturesBundle\Fixture;

class YamlAclFixture extends AbstractFixture
{
    public function load($acl_manager, $tags = null)
    {
        if (!$this->hasTag($tags) || !isset($this->file['acl'])) {
            return;
        }

        foreach ($this->file['acl'] as $reference => $permissions) {
            foreach ($permissions as $user => $permission) {
                $acl_manager->setObjectPermission(
                    $this->loader->getReference($reference),
                    $this->getMask($permission),
                    $this->loader->getReference($user)
                );
            }
        }
    }

    /**
     * Retrieves the constant value for the given mask name
     * @param  type $permission
     * @return type
     */
    public function getMask($permission)
    {
        return constant('Symfony\Component\Security\Acl\Permission\MaskBuilder::'.$permission);
    }

    public function createObject($class, $data, $metadata, $options = array())
    {
        // No implementation for ACL fixtures
    }
}


text:
/**
 * This is just a basic key value pair cache.
 */

var cache = {};

module.exports = {
    get: function(key) { if(key in cache) return cache[key]; else return null; },
    set: function(key, value) { cache[key] = value; }
}


text:
using System;
using System.Diagnostics;
using System.IO;
using DevExpress.Internal.WinApi;

namespace DevExpress.Data {
    public static class ShellHelper {
        public static void TryCreateShortcut(string applicationId, string name, string iconPath = null) {
            string shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), name + ".lnk");
            if(!File.Exists(shortcutPath))
                InstallShortcut(shortcutPath, applicationId, iconPath);
        }
        public static void TryCreateShortcut(string sourcePath, string applicationId, string name, string iconPath = null) {
            string shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), name + ".lnk");
            if(!File.Exists(shortcutPath))
                InstallShortcut(sourcePath, shortcutPath, applicationId, iconPath);
        }
        public static void RemoveShortcut(string name) {
            string shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), name + ".lnk");
            if(!File.Exists(shortcutPath))
                File.Delete(shortcutPath);
        }
        static void InstallShortcut(string shortcutPath, string applicationId, string iconPath) {
            string exePath = Process.GetCurrentProcess().MainModule.FileName;
            InstallShortcut(exePath, shortcutPath, applicationId, iconPath);
        }
        static void InstallShortcut(string sourcePath, string shortcutPath, string applicationId, string iconPath) {
            IShellLinkW newShortcut = (IShellLinkW)new CShellLink();
            ErrorHelper.VerifySucceeded(newShortcut.SetPath(sourcePath));
            ErrorHelper.VerifySucceeded(newShortcut.SetArguments(""));
            IPropertyStore newShortcutProperties = (IPropertyStore)newShortcut;
            if(iconPath != null) {
                newShortcut.SetIconLocation(iconPath, 0);
            }
            using(PropVariant appId = new PropVariant(applicationId)) {
                PropertyKey SystemProperties_System_AppUserModel_ID = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 5);
                ErrorHelper.VerifySucceeded(newShortcutProperties.SetValue(SystemProperties_System_AppUserModel_ID, appId));
                ErrorHelper.VerifySucceeded(newShortcutProperties.Commit());
            }
            IPersistFile newShortcutSave = (IPersistFile)newShortcut;
            ErrorHelper.VerifySucceeded(newShortcutSave.Save(shortcutPath, true));
        }
    }
}


text:
Error

{{vm.code}} {{vm.title}}

Your request was malformed!

You are not authenticated!

You are not authorized!

The resource you requested was not found!

The requested method is not allowed!

Your request could not be processed because of a conflict!

The resource you requested is gone!

An internal server error occurred!

The requested method is not implemented by the server!

The service is unavailable!

An unknown error occurred!

Explanation: {{vm.message}}

Request: {{vm.method}} {{vm.url}}


text:
from expects import expect, be
from mamba import description, it
from unittest.mock import MagicMock

from crowd_anki.representation import deck_initializer

DYNAMIC_DECK = {'dyn': True}

TEST_DECK = "test deck"

with description("Initializer from deck") as self:
    with it("should return None when trying to export dynamic deck"):
        collection = MagicMock()

        collection.decks.byName.return_value = DYNAMIC_DECK

        expect(deck_initializer.from_collection(collection, TEST_DECK)).to(be(None))


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports Microsoft.VisualStudio.GraphModel
Imports Microsoft.VisualStudio.LanguageServices.Implementation.Progression
Imports Roslyn.Test.Utilities

Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Progression

    Public Class InheritedByGraphQueryTests
        <Fact, Trait(Traits.Feature, Traits.Features.Progression)>
        Sub TestInheritedByClasses()
            Using testState = New ProgressionTestState(
                    <Workspace>
                        <Project Language="C#" CommonReferences="true" FilePath="Z:\Project.csproj">
                            <Document FilePath="Z:\Project.cs">
using System;

interface IBlah {
}

abstract class $$Base
{
    public abstract int CompareTo(object obj);
}

class Foo : Base, IComparable, IBlah
{
    public override int CompareTo(object obj)
    {
        throw new NotImplementedException();
    }
}

class Foo2 : Base, IBlah
{
    public override int CompareTo(object obj)
    {
        throw new NotImplementedException();
    }
}
                         </Document>
                        </Project>
                    </Workspace>)

                Dim inputGraph = testState.GetGraphWithMarkedSymbolNode()
                Dim outputContext = testState.GetGraphContextAfterQuery(inputGraph, New InheritedByGraphQuery(), GraphContextDirection.Target)

                AssertSimplifiedGraphIs(
                    outputContext.Graph,
                    <DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
                        <Nodes>
                            <Node Id="(@1 Type=Base)" Category="CodeSchema_Class" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsInternal="True" CommonLabel="Base" Icon="Microsoft.VisualStudio.Class.Internal" Label="Base"/>
                            <Node Id="(@1 Type=Foo)" Category="CodeSchema_Class" CodeSchemaProperty_IsInternal="True" CommonLabel="Foo" Icon="Microsoft.VisualStudio.Class.Internal" Label="Foo"/>
                            <Node Id="(@1 Type=Foo2)" Category="CodeSchema_Class" CodeSchemaProperty_IsInternal="True" CommonLabel="Foo2" Icon="Microsoft.VisualStudio.Class.Internal" Label="Foo2"/>
                        </Nodes>
                        <Links>
                            <Link Source="(@1 Type=Foo)" Target="(@1 Type=Base)" Category="InheritsFrom"/>
                            <Link Source="(@1 Type=Foo2)" Target="(@1 Type=Base)" Category="InheritsFrom"/>
                        </Links>
                        <IdentifierAliases>
                            <Alias n="1" Uri="Assembly=file:///Z:/CSharpAssembly1.dll"/>
                        </IdentifierAliases>
                    </DirectedGraph>)
            End Using
        End Sub

        <Fact, Trait(Traits.Feature, Traits.Features.Progression)>
        Sub TestInheritedByInterfaces()
            Using testState = New ProgressionTestState(
                    <Workspace>
                        <Project Language="C#" CommonReferences="true" FilePath="Z:\Project.csproj">
                            <Document FilePath="Z:\Project.cs">
using System;

public interface $$I { }

interface I2 : I, IComparable
{
    void M();
}
                         </Document>
                        </Project>
                    </Workspace>)

                Dim inputGraph = testState.GetGraphWithMarkedSymbolNode()
                Dim outputContext = testState.GetGraphContextAfterQuery(inputGraph, New InheritedByGraphQuery(), GraphContextDirection.Target)

                AssertSimplifiedGraphIs(
                    outputContext.Graph,
                    <DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
                        <Nodes>
                            <Node Id="(@1 Type=I)" Category="CodeSchema_Interface" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsPublic="True" CommonLabel="I" Icon="Microsoft.VisualStudio.Interface.Public" Label="I"/>
                            <Node Id="(@1 Type=I2)" Category="CodeSchema_Interface" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsInternal="True" CommonLabel="I2" Icon="Microsoft.VisualStudio.Interface.Internal" Label="I2"/>
                        </Nodes>
                        <Links>
                            <Link Source="(@1 Type=I2)" Target="(@1 Type=I)" Category="InheritsFrom"/>
                        </Links>
                        <IdentifierAliases>
                            <Alias n="1" Uri="Assembly=file:///Z:/CSharpAssembly1.dll"/>
                        </IdentifierAliases>
                    </DirectedGraph>)
            End Using
        End Sub
    End Class

End Namespace


text:
require 'test_helper'

module PigriderLayout
  class MainControllerTest < ActionController::TestCase
    test "should get globalLayout" do
      get :globalLayout
      assert_response :success
    end

    test "should get aboutUs" do
      get :aboutUs
      assert_response :success
    end

    test "should get contactUs" do
      get :contactUs
      assert_response :success
    end

  end
end


text:
// <>getBase, LookupBase, ProtoBase
var __result1 = toString(); // need built-in function
var __expect1 = __StrTop;


text:
package org.apache.accumulo.server;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.volume.Volume;
import org.apache.accumulo.core.volume.VolumeConfiguration;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.fs.VolumeUtil;
import org.apache.hadoop.fs.Path;

public class ServerConstants {

  public static final String VERSION_DIR = "version";

  public static final String INSTANCE_ID_DIR = "instance_id";

  /**
   * current version (3) reflects additional namespace operations (ACCUMULO-802) in version 1.6.0 <br />
   * (versions should never be negative)
   */
  public static final Integer WIRE_VERSION = 3;

  /**
   * current version (6) reflects the addition of a separate root table (ACCUMULO-1481) in version 1.6.0
   */
  public static final int DATA_VERSION = 6;
  public static final int PREV_DATA_VERSION = 5;

  private static String[] baseUris = null;

  private static List<Pair<Path,Path>> replacementsList = null;

  // these are functions to delay loading the Accumulo configuration unless we must
  public static synchronized String[] getBaseUris() {
    if (baseUris == null) {
      baseUris = checkBaseUris(VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration()), false);
    }

    return baseUris;
  }

  public static String[] checkBaseUris(String[] configuredBaseDirs, boolean ignore) {
    // all base dirs must have same instance id and data version, any dirs that have neither should be ignored
    String firstDir = null;
    String firstIid = null;
    Integer firstVersion = null;
    ArrayList<String> baseDirsList = new ArrayList<String>();
    for (String baseDir : configuredBaseDirs) {
      Path path = new Path(baseDir, INSTANCE_ID_DIR);
      String currentIid;
      Integer currentVersion;
      try {
        currentIid = ZooUtil.getInstanceIDFromHdfs(path, ServerConfiguration.getSiteConfiguration());
        Path vpath = new Path(baseDir, VERSION_DIR);
        currentVersion = Accumulo.getAccumuloPersistentVersion(vpath.getFileSystem(CachedConfiguration.getInstance()), vpath);
      } catch (Exception e) {
        if (ignore)
          continue;
        else
          throw new IllegalArgumentException("Accumulo volume " + path + " not initialized", e);
      }

      if (firstIid == null) {
        firstIid = currentIid;
        firstDir = baseDir;
        firstVersion = currentVersion;
      } else if (!currentIid.equals(firstIid)) {
        throw new IllegalArgumentException("Configuration " + Property.INSTANCE_VOLUMES.getKey() + " contains paths that have different instance ids "
            + baseDir + " has " + currentIid + " and " + firstDir + " has " + firstIid);
      } else if (!currentVersion.equals(firstVersion)) {
        throw new IllegalArgumentException("Configuration " + Property.INSTANCE_VOLUMES.getKey() + " contains paths that have different versions " + baseDir
            + " has " + currentVersion + " and " + firstDir + " has " + firstVersion);
      }

      baseDirsList.add(baseDir);
    }

    if (baseDirsList.size() == 0) {
      throw new RuntimeException("None of the configured paths are initialized.");
    }

    return baseDirsList.toArray(new String[baseDirsList.size()]);
  }

  public static final String TABLE_DIR = "tables";
  public static final String RECOVERY_DIR = "recovery";
  public static final String WAL_DIR = "wal";

  public static String[] getTablesDirs() {
    return VolumeConfiguration.prefix(getBaseUris(), TABLE_DIR);
  }

  public static String[] getRecoveryDirs() {
    return VolumeConfiguration.prefix(getBaseUris(), RECOVERY_DIR);
  }

  public static String[] getWalDirs() {
    return VolumeConfiguration.prefix(getBaseUris(), WAL_DIR);
  }

  public static String[] getWalogArchives() {
    return VolumeConfiguration.prefix(getBaseUris(), "walogArchive");
  }

  public static Path getInstanceIdLocation(Volume v) {
    // all base dirs should have the same instance id, so can choose any one
    return v.prefixChild(INSTANCE_ID_DIR);
  }

  public static Path getDataVersionLocation(Volume v) {
    // all base dirs should have the same version, so can choose any one
    return v.prefixChild(VERSION_DIR);
  }

  public static String[] getMetadataTableDirs() {
    return VolumeConfiguration.prefix(getTablesDirs(), MetadataTable.ID);
  }

  public static String[] getTemporaryDirs() {
    return VolumeConfiguration.prefix(getBaseUris(), "tmp");
  }

  public static synchronized List<Pair<Path,Path>> getVolumeReplacements() {

    if (replacementsList == null) {
      String replacements = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_VOLUMES_REPLACEMENTS);

      replacements = replacements.trim();

      if (replacements.isEmpty())
        return Collections.emptyList();

      String[] pairs = replacements.split(",");
      List<Pair<Path,Path>> ret = new ArrayList<Pair<Path,Path>>();

      for (String pair : pairs) {
        String uris[] = pair.split("\\s+");
        if (uris.length != 2)
          throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains malformed pair " + pair);

        Path p1, p2;
        try {
          // URI constructor handles hex escaping
          p1 = new Path(new URI(VolumeUtil.removeTrailingSlash(uris[0].trim())));
          if (p1.toUri().getScheme() == null)
            throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains " + uris[0] + " which is not fully qualified");
        } catch (URISyntaxException e) {
          throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains " + uris[0] + " which has a syntax error", e);
        }

        try {
          p2 = new Path(new URI(VolumeUtil.removeTrailingSlash(uris[1].trim())));
          if (p2.toUri().getScheme() == null)
            throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains " + uris[1] + " which is not fully qualified");
        } catch (URISyntaxException e) {
          throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains " + uris[1] + " which has a syntax error", e);
        }

        ret.add(new Pair<Path,Path>(p1, p2));
      }

      HashSet<Path> baseDirs = new HashSet<Path>();
      for (String baseDir : getBaseUris()) {
        // normalize using path
        baseDirs.add(new Path(baseDir));
      }

      for (Pair<Path,Path> pair : ret)
        if (!baseDirs.contains(pair.getSecond()))
          throw new IllegalArgumentException(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey() + " contains " + pair.getSecond()
              + " which is not a configured volume");

      // only set if get here w/o exception
      replacementsList = ret;
    }
    return replacementsList;
  }
}


text:
from __future__ import unicode_literals
from ..segmentation import N4BiasFieldCorrection

def test_N4BiasFieldCorrection_inputs():
    input_map = dict(args=dict(argstr='%s',
    ),
    bias_image=dict(hash_files=False,
    ),
    bspline_fitting_distance=dict(argstr='--bspline-fitting %s',
    ),
    bspline_order=dict(requires=['bspline_fitting_distance'],
    ),
    convergence_threshold=dict(requires=['n_iterations'],
    ),
    copy_header=dict(mandatory=True,
    usedefault=True,
    ),
    dimension=dict(argstr='-d %d',
    usedefault=True,
    ),
    environ=dict(nohash=True,
    usedefault=True,
    ),
    ignore_exception=dict(nohash=True,
    usedefault=True,
    ),
    input_image=dict(argstr='--input-image %s',
    mandatory=True,
    ),
    mask_image=dict(argstr='--mask-image %s',
    ),
    n_iterations=dict(argstr='--convergence %s',
    ),
    num_threads=dict(nohash=True,
    usedefault=True,
    ),
    output_image=dict(argstr='--output %s',
    genfile=True,
    hash_files=False,
    ),
    save_bias=dict(mandatory=True,
    usedefault=True,
    xor=['bias_image'],
    ),
    shrink_factor=dict(argstr='--shrink-factor %d',
    ),
    terminal_output=dict(deprecated='1.0.0',
    nohash=True,
    ),
    weight_image=dict(argstr='--weight-image %s',
    ),
    )
    inputs = N4BiasFieldCorrection.input_spec()

    for key, metadata in list(input_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(inputs.traits()[key], metakey) == value

def test_N4BiasFieldCorrection_outputs():
    output_map = dict(bias_image=dict(),
    output_image=dict(),
    )
    outputs = N4BiasFieldCorrection.output_spec()

    for key, metadata in list(output_map.items()):
        for metakey, value in list(metadata.items()):
            assert getattr(outputs.traits()[key], metakey) == value


text:
/**
 * Created by mac-pc on 16/7/18.
 */
define([
    'jquery',
    'tocc-toms/common/BaseView',
    'tocc-toms/common/mod/control/map-search/app/utils/searchUtils',
    'tocc-toms/common/mod/control/map-search/app/search/search',
    'tocc-toms/common/mod/control/map-search/app/utils/mapSearchUtils',
    'tocc-toms/common/mod/control/map-real-distribution/app/utils/mapClusterUtil',
    'tocc-toms/common/mod/control/map-real-distribution/app/carinfo/mainView',
    'text!../../template/mapToolsTemplate.html',
    'bmap',
    'map_utils',
    'log',
    'css!../../resource/css/maptools.css'
],function($,BaseView,SearchUtils,Search,MapSearchUtils,MapClusterUtil,CarInfoMainView,MapToolsTemplate, bmap,mapUtils,Log) {
        var that;
        var view = BaseView.extend({
            events: {

            },
            init: function() {
                that=this;
                that.$clcxView=new CarInfoMainView();
                that._templateFn(MapToolsTemplate);
            },
            render: function(options) {
                that=this;
                that.init();
                that.$map=options.map;
                that.$el=options.container;
                that.$type=options.type;
                that.$ctx=window.AppConfig.RemoteApiUrl+"";
                if(options.type){
                    $(that.$el).append(that.mapToolsTemplate(options));
                }
                that.loadJs();
            },
            initUI: function() {

            },
            loadJs: function() {
                /*$(".analysis-enter").on("click",function(){
                    var options={};
                    if(that.$type==='bus'){
                        options.page='../ReportServer?formlet=TCSP/high/high.frm';
                        options.text='城市公交指标分析';
                    }else if(that.$type==='taxi'){
                        options.page='../ReportServer?formlet=TCSP/bicycle/bicycle.frm';
                        options.text='出租车指标分析';
                    }else if(that.$type==='bicycle'){
                        options.page='../ReportServer?formlet=TCSP/bicycle/bicycle.frm';
                        options.text='公共自行车指标分析';
                    }
                    if(options.page&&parent.window.addFrameTabs){
                        parent.window.addFrameTabs(options);
                    }
                });*/
                //清除历史记录
                $(".rec-clearhis").click(function(event) {
                    $(".rec-history").html("");
                    Search.clearCookie();
                });
                //地图工具下拉面板
                $(".tools-panels").on('click', '.panels-l-list', function(event) {

                    var list_drop = $(this).find('.list-drop').css("display");

                    if(list_drop == "none"){
                        $(".tools-panels .panels-l-list").removeClass('panels-list-active');
                        $(this).addClass('panels-list-active');
                    }else{
                        $(this).removeClass('panels-list-active');
                    }

                });
                //测量距离
                $("#mapTool .measureTool").click(function(event) {
                    that.$map.setMouseTool(DrawType.MEASURE);
                });
                //测量面积
                $("#mapTool .measureAreaTool").click(function(event) {
                    that.$map.setMouseTool(DrawType.MEASAREA);
                });
                //区域查询
                $("#mapTool .bufferQueryTool").click(function(event) {
                    that.$map.setMouseTool(DrawType.QUERY_CIRCLE,drawCircleHandler);
                });

                function drawCircleHandler(center_,radius_,unit_)
                {
                    var type = "SP_GJZD";
                    that.$map.removeOverlay("query_circle");

                    var tab = {
                        title: '区域查询',
                        content: that.$ctx+"/control/map-search/page/spatial/spatialSearch.html?distance="+radius_+"&point="+center_.x+","+center_.y+"&type="+type+"&layerId=query_circle",
                        contentType:"iframe",
                        reload:true,
                        data:{
                            name:'query_circle'
                        }
                    };
                    //单位默认是米
                    var ellipse=new beyond.maps.BQueryCircle({
                        "center":center_,
                        "radius": radius_,
                        "unit":unit_,
                        "strokeColor": "#a3b1cc",
                        "strokeOpacity": 0.9,
                        "strokeWeight": 1,
                        "fillColor": "#4673cc",
                        "fillOpacity": 0.2,
                        "isShowStatus":false
                    });
                    that.$map.addOverlay(ellipse,"query_circle");

                    var mapRadius = beyond.maps.GeometryUtil.convertLenToMapUnit(radius_,unit_);
                    var points = beyond.maps.GeometryUtil.createCircle(center_,mapRadius,0,6);
                    ellipse.addEventListener("drawEnd",drawCircleHandler);

                    $(".search-rec").hide();
                    $(".search-result").show();
                    $(".search-remind").hide();
                    SearchUtils.addTab(tab);
                }
                //公交线路热力图
                $("#layerControl .gjxl_rlt").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    var layerName = MapSearchUtils.layerNameConfig.gjxl_rlt_name;
                    MapSearchUtils.setTileLayerVisible(that.$map,layerName,isChecked,5);
                });
                //公交站点热力图
                $("#layerControl .gjzd_rlt").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    var layerName = MapSearchUtils.layerNameConfig.gjzd_rlt_name;
                    MapSearchUtils.setTileLayerVisible(that.$map,layerName,isChecked,6);
                });
                //公交站点300米覆盖
                $("#layerControl .gjzd_300").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .gjzd_500").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .gjzd_500").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.gjzd_300_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //公交站点500米覆盖
                $("#layerControl .gjzd_500").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .gjzd_300").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .gjzd_300").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.gjzd_500_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //聚合图层
                $("#layerControl .bus_cluster").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    var layerName = MapSearchUtils.layerNameConfig.bus_cluster_name;
                    //MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                    if(isChecked){
                        MapClusterUtil.cluster( "080", that.$map,that.$areaName,function(data){
                            that.$clcxView.carDataInfoWindow(data,that.$map);
                        });
                    }else{
                        MapClusterUtil.cluster( "SP_WHTCC|SP_KYZ,SP_JX,SP_ZXCTKD,SP_WX,SP_KYQY,SP_HYQY", that.$map,that.$areaName,function(data){
                            that.$clcxView.carDataInfoWindow(data,that.$map);
                        });
                    }

                    var isChecked_gjzd = $("#layerControl .gjzd_gjzd").is(":checked");
                    var layerName_gjzd = MapSearchUtils.layerNameConfig.gjzd_gjzd;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName_gjzd,isChecked_gjzd);

                    var isChecked_gj300 = $("#layerControl .gjzd_300").is(":checked");
                    var layerName_gj300 = MapSearchUtils.layerNameConfig.gjzd_300_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName_gj300,isChecked_gj300);

                    var isChecked_gj500 = $("#layerControl .gjzd_500").is(":checked");
                    var layerName_gj500 = MapSearchUtils.layerNameConfig.gjzd_500_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName_gj500,isChecked_gj500);
                });
                //自行车距离公交站点分布图
                $("#layerControl .bicycle_gjzd").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .bicycle_kejiekehuan").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .bicycle_kejiekehuan").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.bicycle_gjzd_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });

                //自行车可借可还站点分布图
                $("#layerControl .bicycle_kejiekehuan").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .bicycle_gjzd").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .bicycle_gjzd").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.bicycle_kejiekehuan_name;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });

                //自行车站点
                $("#layerControl .bicycle_biczd").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .bicycle_biczd").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .bicycle_biczd").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.bicycle_biczd;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });

                //维修分布图
                $("#layerControl .other_wx").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .other_wx").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .other_wx").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.other_wx;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //普货分布图
                $("#layerControl .other_ph").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .other_ph").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .other_ph").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.other_ph;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //驾培学校分布图
                $("#layerControl .other_jp").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .other_jp").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .other_jp").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.other_jp;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //危货停车场分布图
                $("#layerControl .other_whtc").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .other_whtc").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .other_whtc").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.other_whtc;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });
                //客运站分布图
                $("#layerControl .other_kyz").change(function(event) {
                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .other_kyz").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .other_kyz").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.other_kyz;
                    //MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                    MapSearchUtils.setLayerVisible(that.$map,"SP_KYZ",isChecked,"1=1","ssfb");
                });
                //公交站点分布
                $("#layerControl .gjzd_gjzd").change(function(event) {
                    var isChecked_bus_cluster = $("#layerControl .bus_cluster").is(":checked");
                    if(isChecked_bus_cluster){
                        MapClusterUtil.cluster( "080", that.$map,that.$areaName,function(data){
                            that.$clcxView.carDataInfoWindow(data,that.$map);
                        });
                    }else{
                        MapClusterUtil.cluster( "SP_WHTCC|SP_KYZ,SP_JX,SP_ZXCTKD,SP_WX,SP_KYQY,SP_HYQY", that.$map,that.$areaName,function(data){
                            that.$clcxView.carDataInfoWindow(data,that.$map);
                        });
                    }

                    var isChecked = $(this).is(":checked");
                    //var disChecked=$("#layerControl .gjzd_gjzd").is(":checked");
                    //if(disChecked&&isChecked){
                    //    $("#layerControl .gjzd_gjzd").click();
                    //}
                    var layerName = MapSearchUtils.layerNameConfig.gjzd_gjzd;
                    MapSearchUtils.setTopicLayerVisible(that.$map,layerName,isChecked);
                });

            },
            addPanel: function(options) {

            }
        });
        return view;
    });


text:
@implementation DTHTMLAttributedStringBuilderTest

#pragma mark - Utilities

- (NSAttributedString *)_attributedStringFromTestFileName:(NSString *)testFileName
{
	NSBundle *bundle = [NSBundle bundleForClass:[self class]];
	NSString *path = [bundle pathForResource:testFileName ofType:@"html"];
	NSData *data = [NSData dataWithContentsOfFile:path];

	DTHTMLAttributedStringBuilder *builder = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:data options:nil documentAttributes:NULL];
	return [builder generatedAttributedString];
}

- (NSAttributedString *)_attributedStringFromHTMLString:(NSString *)HTMLString options:(NSDictionary *)options
{
	NSData *data = [HTMLString dataUsingEncoding:NSUTF8StringEncoding];

	// set the base URL so that resources are found in the resource bundle
	NSBundle *bundle = [NSBundle bundleForClass:[self class]];
	NSURL *baseURL = [bundle resourceURL];

	NSMutableDictionary *mutableOptions = [[NSMutableDictionary alloc] initWithDictionary:options];
	mutableOptions[NSBaseURLDocumentOption] = baseURL;

	DTHTMLAttributedStringBuilder *builder = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:data options:mutableOptions documentAttributes:NULL];
	return [builder generatedAttributedString];
}

#pragma mark - Tests

- (void)testSpaceBetweenUnderlines
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"SpaceBetweenUnderlines"];

	NSRange range_a;
	NSNumber *underLine = [output attribute:(id)kCTUnderlineStyleAttributeName atIndex:1 effectiveRange:&range_a];

	STAssertTrue([underLine integerValue]==0, @"Space between a and b should not be underlined");
}

// a block following an inline image should only cause a \n after the image, not whitespace
- (void)testWhitspaceAfterParagraphPromotedImage
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"WhitespaceFollowingImagePromotedToParagraph"];

	STAssertTrue([output length]==6, @"Generated String should be 6 characters");

	NSMutableString *expectedOutput = [NSMutableString stringWithFormat:@"1\n%@\n2\n", UNICODE_OBJECT_PLACEHOLDER];

	STAssertTrue([expectedOutput isEqualToString:[output string]], @"Expected output not matching");
}

// This should come out as Keep_me_together with the _ being non-breaking spaces
- (void)testKeepMeTogether
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"KeepMeTogether"];

	NSString *expectedOutput = @"Keep\u00a0me\u00a0together";

	STAssertTrue([expectedOutput isEqualToString:[output string]], @"Expected output not matching");
}

// tests functionality of dir attribute
- (void)testWritingDirection
{
	NSAttributedString *output = [self _attributedStringFromHTMLString:@"
rtl

ltr

normal
" options:nil];

	CTParagraphStyleRef paragraphStyleRTL = (__bridge CTParagraphStyleRef)([output attribute:(id)kCTParagraphStyleAttributeName atIndex:0 effectiveRange:NULL]);
	DTCoreTextParagraphStyle *styleRTL = [DTCoreTextParagraphStyle paragraphStyleWithCTParagraphStyle:paragraphStyleRTL];

	STAssertTrue(styleRTL.baseWritingDirection == NSWritingDirectionRightToLeft, @"Writing direction is not RTL");

	CTParagraphStyleRef paragraphStyleLTR = (__bridge CTParagraphStyleRef)([output attribute:(id)kCTParagraphStyleAttributeName atIndex:4 effectiveRange:NULL]);
	DTCoreTextParagraphStyle *styleLTR = [DTCoreTextParagraphStyle paragraphStyleWithCTParagraphStyle:paragraphStyleLTR];

	STAssertTrue(styleLTR.baseWritingDirection == NSWritingDirectionLeftToRight, @"Writing direction is not LTR");

	CTParagraphStyleRef paragraphStyleNatural = (__bridge CTParagraphStyleRef)([output attribute:(id)kCTParagraphStyleAttributeName atIndex:8 effectiveRange:NULL]);
	DTCoreTextParagraphStyle *styleNatural = [DTCoreTextParagraphStyle paragraphStyleWithCTParagraphStyle:paragraphStyleNatural];

	STAssertTrue(styleNatural.baseWritingDirection == NSWritingDirectionNatural, @"Writing direction is not Natural");
}

// parser should get the displaySize and originalSize from local image
- (void)testAttachmentDisplaySize
{
	NSString *string = [NSString stringWithFormat:@""];
	NSAttributedString *output = [self _attributedStringFromHTMLString:string options:nil];

	STAssertEquals([output length],(NSUInteger)1 , @"Output length should be 1");

	DTTextAttachment *attachment = [output attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL];

	STAssertNotNil(attachment, @"No attachment found in output");

	CGSize expectedSize = CGSizeMake(300, 300);
	STAssertEquals(attachment.originalSize, expectedSize, @"Expected originalSize to be 300x300");
	STAssertEquals(attachment.displaySize, expectedSize, @"Expected displaySize to be 300x300");
}

// parser should ignore "auto" value for height
- (void)testAttachmentAutoSize
{
	NSString *string = [NSString stringWithFormat:@""];
	NSAttributedString *output = [self _attributedStringFromHTMLString:string options:nil];

	STAssertEquals([output length],(NSUInteger)1 , @"Output length should be 1");

	DTTextAttachment *attachment = [output attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL];

	STAssertNotNil(attachment, @"No attachment found in output");

	CGSize expectedOriginalSize = CGSizeMake(300, 300);
	CGSize expectedDisplaySize = CGSizeMake(260, 260);

	STAssertEquals(attachment.originalSize, expectedOriginalSize, @"Expected originalSize to be 300x300");
	STAssertEquals(attachment.displaySize, expectedDisplaySize, @"Expected displaySize to be 260x260");
}

- (void)testFontTagWithStyle
{
	NSAttributedString *output = [self _attributedStringFromHTMLString:@" BOLUS DOSE   = xx.x mg  " options:nil];

	CTFontRef font = (__bridge CTFontRef)([output attribute:(id)kCTFontAttributeName atIndex:0 effectiveRange:NULL]);

	CGFloat pointSize = CTFontGetSize(font);

	STAssertEquals(pointSize, (CGFloat)23.0f, @"Font Size should be 23 px (= 17 pt)");
}

// parser should recover from no end element being sent for this img
- (void)testMissingClosingBracket
{
	NSString *string = [NSString stringWithFormat:@"<img src=\"Oliver.jpg\""];
	NSAttributedString *output = [self _attributedStringFromHTMLString:string options:nil];

	STAssertEquals([output length],(NSUInteger)1 , @"Output length should be 1");

	DTTextAttachment *attachment = [output attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL];

	STAssertNotNil(attachment, @"No attachment found in output");
}

- (void)testRTLParsing
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"RTL"];

	NSUInteger paraEndIndex;
	NSRange firstParagraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(0, 0) parBegIndex:NULL parEndIndex:&paraEndIndex];
	STAssertEquals(NSMakeRange(0, 22), firstParagraphRange, @"First Paragraph Range should be {0,14}");

	NSRange secondParagraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(paraEndIndex, 0) parBegIndex:NULL parEndIndex:NULL];
	STAssertEquals(NSMakeRange(22, 24), secondParagraphRange, @"Second Paragraph Range should be {14,14}");

	CTParagraphStyleRef firstParagraphStyle = (__bridge CTParagraphStyleRef)([output attribute:(id)kCTParagraphStyleAttributeName atIndex:firstParagraphRange.location effectiveRange:NULL]);
	CTParagraphStyleRef secondParagraphStyle = (__bridge CTParagraphStyleRef)([output attribute:(id)kCTParagraphStyleAttributeName atIndex:secondParagraphRange.location effectiveRange:NULL]);

	DTCoreTextParagraphStyle *firstParaStyle = [DTCoreTextParagraphStyle paragraphStyleWithCTParagraphStyle:firstParagraphStyle];
	DTCoreTextParagraphStyle *secondParaStyle = [DTCoreTextParagraphStyle paragraphStyleWithCTParagraphStyle:secondParagraphStyle];

	STAssertTrue(firstParaStyle.baseWritingDirection==kCTWritingDirectionRightToLeft, @"First Paragraph Style is not RTL");
	STAssertTrue(secondParaStyle.baseWritingDirection==kCTWritingDirectionRightToLeft, @"Second Paragraph Style is not RTL");
}

- (void)testEmptyParagraphAndFontAttribute
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"EmptyLinesAndFontAttribute"];

	NSUInteger paraEndIndex;
	NSRange firstParagraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(0, 0) parBegIndex:NULL parEndIndex:&paraEndIndex];
	STAssertEquals(NSMakeRange(0, 2), firstParagraphRange, @"First Paragraph Range should be {0,14}");

	NSRange secondParagraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(paraEndIndex, 0) parBegIndex:NULL parEndIndex:&paraEndIndex];
	STAssertEquals(NSMakeRange(2, 1), secondParagraphRange, @"Second Paragraph Range should be {14,14}");

	NSRange thirdParagraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(paraEndIndex, 0) parBegIndex:NULL parEndIndex:NULL];
	STAssertEquals(NSMakeRange(3, 1), thirdParagraphRange, @"Second Paragraph Range should be {14,14}");

	NSRange firstParagraphFontRange;
	CTFontRef firstParagraphFont = (__bridge CTFontRef)([output attribute:(id)kCTFontAttributeName atIndex:firstParagraphRange.location effectiveRange:&firstParagraphFontRange]);

	STAssertNotNil((__bridge id)firstParagraphFont, @"First paragraph font is missing");

	if (firstParagraphFont)
	{
		STAssertEquals(firstParagraphRange, firstParagraphFontRange, @"Range Font in first paragraph is not full paragraph");
	}

	NSRange secondParagraphFontRange;
	CTFontRef secondParagraphFont = (__bridge CTFontRef)([output attribute:(id)kCTFontAttributeName atIndex:secondParagraphRange.location effectiveRange:&secondParagraphFontRange]);

	STAssertNotNil((__bridge id)secondParagraphFont, @"Second paragraph font is missing");

	if (secondParagraphFont)
	{
		STAssertEquals(secondParagraphFontRange, secondParagraphRange, @"Range Font in second paragraph is not full paragraph");
	}

	NSRange thirdParagraphFontRange;
	CTFontRef thirdParagraphFont = (__bridge CTFontRef)([output attribute:(id)kCTFontAttributeName atIndex:thirdParagraphRange.location effectiveRange:&thirdParagraphFontRange]);

	STAssertNotNil((__bridge id)secondParagraphFont, @"Third paragraph font is missing");

	if (thirdParagraphFont)
	{
		STAssertEquals(thirdParagraphFontRange, thirdParagraphRange, @"Range Font in third paragraph is not full paragraph");
	}
}

- (void)testFontSizeInterpretation
{
	NSAttributedString *output = [self _attributedStringFromTestFileName:@"FontSizes"];

	NSUInteger paraEndIndex = 0;

	while (paraEndIndex<[output length])
	{
		NSRange paragraphRange = [[output string] rangeOfParagraphsContainingRange:NSMakeRange(paraEndIndex, 0) parBegIndex:NULL parEndIndex:&paraEndIndex];

		__block CGFloat paragraphFontSize = 0; // initialized from first font in paragraph

		[output enumerateAttribute:(id)kCTFontAttributeName inRange:paragraphRange options:0 usingBlock:^(id value, NSRange range, BOOL *stop) {

			NSString *subString = [[output string] substringWithRange:range];

			// the NL are exempt from the test
			if ([subString isEqualToString:@"\n"])
			{
				return;
			}

			DTCoreTextFontDescriptor *fontDescriptor = [DTCoreTextFontDescriptor fontDescriptorForCTFont:(__bridge CTFontRef)(value)];

			if (paragraphFontSize==0)
			{
				paragraphFontSize = fontDescriptor.pointSize;
			}
			else
			{
				STAssertEquals(fontDescriptor.pointSize, paragraphFontSize, @"Font in range %@ does not match paragraph font size of %.1fpx", NSStringFromRange(range), paragraphFontSize);
			}
		}];

	}
}

- (void)testInvalidFontSize
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"
Bla
" options:nil];

	NSDictionary *attributes = [attributedString attributesAtIndex:0 effectiveRange:NULL];

	DTCoreTextFontDescriptor *fontDescriptor = [attributes fontDescriptor];

	STAssertEquals(fontDescriptor.pointSize, (CGFloat)30, @"Should ignore invalid CSS length");
}

// if there is a text attachment contained in a HREF then the URL of that needs to be transferred to the image because it is needed for affixing a custom subview for a link button over the image or
- (void)testTransferOfHyperlinkURLToAttachment
{
	NSAttributedString *string = [self _attributedStringFromHTMLString:@"" options:nil];

	STAssertEquals([string length], (NSUInteger)1, @"Output length should be 1");

	// get the attachment
	DTTextAttachment *attachment = [string attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL];

	STAssertNotNil(attachment, @"Attachment is missing");

	// get the link
	NSURL *URL = [string attribute:DTLinkAttribute atIndex:0 effectiveRange:NULL];

	STAssertNotNil(URL, @"Element URL is nil");

	STAssertEqualObjects(URL, attachment.hyperLinkURL, @"Attachment URL and element URL should match!");
}

// setting ordered list starting number
- (void)testOrderedListStartingNumber
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"
\n
Item #5
\n
Item #6
\n
etc.
\n
" options:nil];
	NSString *string = [attributedString string];

	NSArray *lines = [string componentsSeparatedByString:@"\n"];

	STAssertEquals([lines count], (NSUInteger)4, @"There should be 4 lines"); // last one is empty

	NSString *line1 = lines[0];
	STAssertTrue([line1 hasPrefix:@"\t5."], @"String should have prefix 5. on first item");

	NSString *line2 = lines[1];
	STAssertTrue([line2 hasPrefix:@"\t6."], @"String should have prefix 6. on third item");

	NSString *line3 = lines[2];
	STAssertTrue([line3 hasPrefix:@"\t7."], @"String should have prefix 7. on third item");
}

// testing if Helvetica font family returns the correct font
- (void)testHelveticaVariants
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"
Regular

Bold

Italic

Bold+Italic
" options:nil];

	NSString *string = [attributedString string];
	NSRange entireStringRange = NSMakeRange(0, [string length]);

	__block NSUInteger lineNumber = 0;

	[string enumerateSubstringsInRange:entireStringRange options:NSStringEnumerationByParagraphs usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {

		NSRange fontRange;
		CTFontRef font = (__bridge CTFontRef)([attributedString attribute:(id)kCTFontAttributeName atIndex:substringRange.location effectiveRange:&fontRange]);

		STAssertEquals(enclosingRange, fontRange, @"Font should be on entire string");

		DTCoreTextFontDescriptor *fontDescriptor = [DTCoreTextFontDescriptor fontDescriptorForCTFont:font];

		switch (lineNumber) {
			case 0:
			{
				STAssertEqualObjects(fontDescriptor.fontFamily, @"Helvetica", @"Font family should be Helvetica");
				STAssertEqualObjects(fontDescriptor.fontName, @"Helvetica", @"Font face should be Helvetica");
				break;
			}

			case 1:
			{
				STAssertEqualObjects(fontDescriptor.fontFamily, @"Helvetica", @"Font family should be Helvetica");
				STAssertEqualObjects(fontDescriptor.fontName, @"Helvetica-Bold", @"Font face should be Helvetica");
				break;
			}
			case 2:
			{
				STAssertEqualObjects(fontDescriptor.fontFamily, @"Helvetica", @"Font family should be Helvetica");
				STAssertEqualObjects(fontDescriptor.fontName, @"Helvetica-Oblique", @"Font face should be Helvetica-Oblique");
				break;
			}
			case 3:
			{
				STAssertEqualObjects(fontDescriptor.fontFamily, @"Helvetica", @"Font family should be Helvetica");
				STAssertEqualObjects(fontDescriptor.fontName, @"Helvetica-BoldOblique", @"Font face should be Helvetica-BoldOblique");
				break;
			}
			default:
				break;
		}

		lineNumber++;
	}];
}

- (void)testHeaderLevelTransfer
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"
Header
" options:nil];

	NSNumber *headerLevelNum = [attributedString attribute:DTHeaderLevelAttribute atIndex:0 effectiveRange:NULL];

	STAssertNotNil(headerLevelNum, @"No Header Level Attribute");

	NSInteger level = [headerLevelNum integerValue];

	STAssertEquals(level, (NSInteger)3, @"Level should be 3");
}

// Issue 437, strikethrough bleeding into NL
- (void)testBleedingOutAttributes
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"
abc

" options:nil];

	STAssertTrue([attributedString length] == 5, @"Attributed String should be 5 characters long");

	NSRange effectiveRange;
	NSNumber *strikethroughStyle = [attributedString attribute:DTStrikeOutAttribute atIndex:0 effectiveRange:&effectiveRange];

	STAssertNotNil(strikethroughStyle, @"There should be a strikethrough style");

	NSRange expectedRange = NSMakeRange(0, 4);

	STAssertEquals(effectiveRange, expectedRange, @"Strikethrough style should only contain abc, not the NL");
}

// Issue 441, display size ignored if img has width/height
- (void)testImageDisplaySize
{
	NSDictionary *options = @{DTMaxImageSize: [NSValue valueWithCGSize:CGSizeMake(200, 200)]};

	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"" options:options];

	STAssertTrue([attributedString length]==1, @"Output length should be 1");

	DTImageTextAttachment *imageAttachment = [attributedString attribute:NSAttachmentAttributeName atIndex:0 effectiveRange:NULL];

	CGSize expectedSize = CGSizeMake(200, 200);

	STAssertEquals(expectedSize, imageAttachment.displaySize, @"Expected size should be equal to display size");
}

// Issue 443: crash on combining font-family:inherit with small caps
- (void)testFontFamilySmallCapsCrash
{
	NSAttributedString *attributedString;

	STAssertTrueNoThrow((attributedString = [self _attributedStringFromHTMLString:@"
Test
" options:nil]), @"Should be able to parse without crash");

	STAssertTrue([attributedString length]==5, @"Should be 5 characters");
}

#pragma mark - Nested Lists

- (void)testNestedListWithStyleNone
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"

Bullet

Bullet 2

" options:nil];

	NSString *string = [attributedString string];
	NSRange entireStringRange = NSMakeRange(0, [string length]);

	__block NSUInteger lineNumber = 0;

	[string enumerateSubstringsInRange:entireStringRange options:NSStringEnumerationByParagraphs usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {

		NSAttributedString *attributedSubstring = [attributedString attributedSubstringFromRange:enclosingRange];

		switch (lineNumber)
		{
			case 1:
			{
				NSArray *lists = [attributedSubstring attribute:DTTextListsAttribute atIndex:0 effectiveRange:NULL];
				NSInteger numLists = [lists count];
				STAssertEquals(numLists, (NSInteger)2, @"There should be two lists active on line 2, but %d found", numLists);

				NSString *subString = [[attributedSubstring string] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

				STAssertTrue([subString hasSuffix:@"Bullet 2"], @"The second line should have the 'Bullet 2' text");

				break;
			}

			default:
				break;
		}

		lineNumber++;
	}];
}

// list prefixes should never contained the newline
- (void)testPrefixWithNewlines
{
	NSAttributedString *attributedString = [self _attributedStringFromHTMLString:@"

Bullet

Bullet 2

" options:nil];

	NSString *string = [attributedString string];
	NSRange entireStringRange = NSMakeRange(0, [string length]);

	__block NSUInteger lineNumber = 0;

	[string enumerateSubstringsInRange:entireStringRange options:NSStringEnumerationByParagraphs usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {

		NSAttributedString *attributedSubstring = [attributedString attributedSubstringFromRange:enclosingRange];

		NSRange prefixRange = [attributedSubstring rangeOfFieldAtIndex:0];
		NSString *prefix = [[attributedSubstring string] substringWithRange:prefixRange];

		// there should never be a newline contained inside the prefix
		NSRange newlineRange = [prefix rangeOfString:@"\n"];

		BOOL foundNL = (newlineRange.location != NSNotFound);

		STAssertFalse(foundNL, @"Newline in prefix of line %d", lineNumber);

		lineNumber++;
	}];
}

@end


text:
package kr.debop4j.timeperiod.test.timeranges;

import kr.debop4j.core.Action1;
import kr.debop4j.core.parallelism.Parallels;
import kr.debop4j.timeperiod.TimeCalendar;
import kr.debop4j.timeperiod.test.TimePeriodTestBase;
import kr.debop4j.timeperiod.timerange.YearRange;
import kr.debop4j.timeperiod.timerange.YearRangeCollection;
import kr.debop4j.timeperiod.tools.Times;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.junit.Test;

import java.util.List;

import static org.fest.assertions.Assertions.assertThat;

/**
 * kr.debop4j.timeperiod.test.timeranges.YearRangeCollectionTest
 *
 * @author 배성혁 sunghyouk.bae@gmail.com
 * @since 13. 5. 26. 오전 12:12
 */
@Slf4j
public class YearRangeCollectionTest extends TimePeriodTestBase {
    @Test
    public void singleYears() {
        final int startYear = 2004;

        YearRangeCollection yearRanges = new YearRangeCollection(startYear, 1);
        assertThat(yearRanges.getYearCount()).isEqualTo(1);

        assertThat(yearRanges.getStartYear()).isEqualTo(startYear);
        assertThat(yearRanges.getEndYear()).isEqualTo(startYear);

        List<YearRange> years = yearRanges.getYears();
        assertThat(years.size()).isEqualTo(1);
        assertThat(years.get(0).isSamePeriod(new YearRange(startYear))).isTrue();
    }

    @Test
    public void calenarMonths() {
        final int startYear = 2004;
        final int yearCount = 5;

        YearRangeCollection yearRanges = new YearRangeCollection(startYear, yearCount, TimeCalendar.getEmptyOffset());

        assertThat(yearRanges.getYearCount()).isEqualTo(yearCount);
        assertThat(yearRanges.getStartYear()).isEqualTo(startYear);
        assertThat(yearRanges.getEndYear()).isEqualTo(startYear + yearCount);
    }

    @Test
    public void yearCounts() {
        int[] yearCounts = new int[] { 1, 6, 48, 180, 365 };

        final DateTime now = Times.now();
        final DateTime today = Times.today();

        for (int yearCount : yearCounts) {
            final YearRangeCollection yearRanges = new YearRangeCollection(now, yearCount);

            final DateTime startTime = yearRanges.getTimeCalendar().mapStart(Times.trimToYear(today));
            final DateTime endTime = yearRanges.getTimeCalendar().mapEnd(startTime.plusYears(yearCount));

            assertThat(yearRanges.getStart()).isEqualTo(startTime);
            assertThat(yearRanges.getEnd()).isEqualTo(endTime);

            final List<YearRange> items = yearRanges.getYears();

            Parallels.run(yearCount, new Action1<Integer>() {
                @Override
                public void perform(Integer y) {
                    final YearRange item = items.get(y);
                    assertThat(item.getStart()).isEqualTo(startTime.plusYears(y));
                    assertThat(item.getEnd()).isEqualTo(yearRanges.getTimeCalendar().mapEnd(startTime.plusYears(y + 1)));

                    assertThat(item.getUnmappedStart()).isEqualTo(startTime.plusYears(y));
                    assertThat(item.getUnmappedEnd()).isEqualTo(startTime.plusYears(y + 1));

                    assertThat(item.isSamePeriod(new YearRange(yearRanges.getStart().plusYears(y)))).isTrue();
                }
            });
        }
    }
}


text:
namespace ppapi {

struct PPAPI_SHARED_EXPORT NetworkInfo {
  NetworkInfo();
  ~NetworkInfo();

  std::string name;
  PP_NetworkListType_Private type;
  PP_NetworkListState_Private state;
  std::vector<PP_NetAddress_Private> addresses;
  std::string display_name;
  int mtu;
};
typedef std::vector<NetworkInfo> NetworkList;

// NetworkListStorage is refcounted container for NetworkList. It
// allows sharing of one NetworkList object between multiple
// NetworkList resources.
class PPAPI_SHARED_EXPORT NetworkListStorage
    : public base::RefCountedThreadSafe<NetworkListStorage> {
 public:
  explicit NetworkListStorage(const NetworkList& list);

  const NetworkList& list() { return list_; }

 private:
  friend class base::RefCountedThreadSafe<NetworkListStorage>;
  ~NetworkListStorage();

  NetworkList list_;

  DISALLOW_COPY_AND_ASSIGN(NetworkListStorage);
};

class PPAPI_SHARED_EXPORT PPB_NetworkList_Private_Shared
    : public ::ppapi::Resource,
      public ::ppapi::thunk::PPB_NetworkList_Private_API {
 public:
  static PP_Resource Create(ResourceObjectType type,
                            PP_Instance instance,
                            const scoped_refptr<NetworkListStorage>& list);

  virtual ~PPB_NetworkList_Private_Shared();

  // Resource override.
  virtual ::ppapi::thunk::PPB_NetworkList_Private_API*
      AsPPB_NetworkList_Private_API() OVERRIDE;

  // PPB_NetworkList_Private_API implementation.
  virtual const NetworkList& GetNetworkListData() const OVERRIDE;
  virtual uint32_t GetCount() OVERRIDE;
  virtual PP_Var GetName(uint32_t index) OVERRIDE;
  virtual PP_NetworkListType_Private GetType(uint32_t index) OVERRIDE;
  virtual PP_NetworkListState_Private GetState(uint32_t index) OVERRIDE;
  virtual int32_t GetIpAddresses(uint32_t index,
                                 PP_NetAddress_Private addresses[],
                                 uint32_t count) OVERRIDE;
  virtual PP_Var GetDisplayName(uint32_t index) OVERRIDE;
  virtual uint32_t GetMTU(uint32_t index) OVERRIDE;

 private:
  PPB_NetworkList_Private_Shared(ResourceObjectType type,
                                 PP_Instance instance,
                                 const scoped_refptr<NetworkListStorage>& list);

  scoped_refptr<NetworkListStorage> list_;

  DISALLOW_COPY_AND_ASSIGN(PPB_NetworkList_Private_Shared);
};

}  // namespace ppapi

#endif  // PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_


text:
<?php

if (!defined('GUZZLE_FUNCTIONS_VERSION')) {

    define('GUZZLE_FUNCTIONS_VERSION', puzzle_ClientInterface::VERSION);

    /**
     * Send a custom request
     *
     * @param string $method  HTTP request method
     * @param string $url     URL of the request
     * @param array  $options Options to use with the request.
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_request($method, $url, array $options = array())
    {
        static $client;
        if (!$client) {
            $client = new puzzle_Client();
        }

        return $client->send($client->createRequest($method, $url, $options));
    }

    /**
     * Send a GET request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_get($url, array $options = array())
    {
        return puzzle_request('GET', $url, $options);
    }

    /**
     * Send a HEAD request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_head($url, array $options = array())
    {
        return puzzle_request('HEAD', $url, $options);
    }

    /**
     * Send a DELETE request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_delete($url, array $options = array())
    {
        return puzzle_request('DELETE', $url, $options);
    }

    /**
     * Send a POST request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_post($url, array $options = array())
    {
        return puzzle_request('POST', $url, $options);
    }

    /**
     * Send a PUT request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_put($url, array $options = array())
    {
        return puzzle_request('PUT', $url, $options);
    }

    /**
     * Send a PATCH request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_patch($url, array $options = array())
    {
        return puzzle_request('PATCH', $url, $options);
    }

    /**
     * Send an OPTIONS request
     *
     * @param string $url     URL of the request
     * @param array  $options Array of request options
     *
     * @return puzzle_message_ResponseInterface
     */
    function puzzle_options($url, array $options = array())
    {
        return puzzle_request('OPTIONS', $url, $options);
    }

    /**
     * @var $__closure_puzzle_batch_hash SplObjectStorage
     */
    global $__closure_puzzle_batch_hash;
    function __callback_puzzle_batch($e)
    {
        /**
         * @var $__closure_puzzle_batch_hash SplObjectStorage
         */
        global $__closure_puzzle_batch_hash;
        $__closure_puzzle_batch_hash->offsetSet($e->getRequest(), $e);
    }

    function __callback_puzzle_batch_convertEvents($e)
    {
        global $__closure_puzzle_batch_hash;
        $__closure_puzzle_batch_hash->offsetSet($e->getRequest(), $e);
    }

    /**
     * Convenience method for sending multiple requests in parallel and
     * retrieving a hash map of requests to response objects or
     * RequestException objects.
     *
     * Note: This method keeps every request and response in memory, and as
     * such is NOT recommended when sending a large number or an indeterminable
     * number of requests in parallel.
     *
     * @param puzzle_ClientInterface $client   Client used to send the requests
     * @param array|Iterator $requests Requests to send in parallel
     * @param array           $options  Passes through the options available in
     *                                  {@see puzzle_ClientInterface::sendAll()}
     *
     * @return SplObjectStorage Requests are the key and each value is a
     *     {@see puzzle_message_ResponseInterface} if the request succeeded
     *     or a {@see puzzle_exception_RequestException} if it failed.
     * @throws InvalidArgumentException if the event format is incorrect.
     */
    function puzzle_batch(puzzle_ClientInterface $client, $requests, array $options = array())
    {
        global $__closure_puzzle_batch_hash;
        $__closure_puzzle_batch_hash = new puzzle_SplObjectStorage();
        foreach ($requests as $request) {
            $__closure_puzzle_batch_hash->offsetSet($request);
        }

        // Merge the necessary complete and error events to the event listeners
        // so that as each request succeeds or fails, it is added to the result
        // hash.
        $options = puzzle_event_RequestEvents::convertEventArray(
            $options,
            array('complete', 'error'),
            array(
                'priority' => puzzle_event_RequestEvents::EARLY,
                'once' => true,
                'fn' => '__callback_puzzle_batch_convertEvents'
            )
        );

        // Send the requests in parallel and aggregate the results.
        $client->sendAll($requests, $options);

        // Update the received value for any of the intercepted requests.
        foreach ($__closure_puzzle_batch_hash as $request) {
            $storedEvent = $__closure_puzzle_batch_hash->offsetGet($request);
            if ($storedEvent instanceof puzzle_event_CompleteEvent) {
                $__closure_puzzle_batch_hash->offsetSet($request, $storedEvent->getResponse());
            } elseif ($storedEvent instanceof puzzle_event_ErrorEvent) {
                $__closure_puzzle_batch_hash->offsetSet($request, $storedEvent->getException());
            }
        }

        return $__closure_puzzle_batch_hash;
    }

    /**
     * Gets a value from an array using a path syntax to retrieve nested data.
     *
     * This method does not allow for keys that contain "/". You must traverse
     * the array manually or using something more advanced like JMESPath to
     * work with keys that contain "/".
     *
     *     // Get the bar key of a set of nested arrays.
     *     // This is equivalent to $collection['foo']['baz']['bar'] but won't
     *     // throw warnings for missing keys.
     *     puzzle_get_path($data, 'foo/baz/bar');
     *
     * @param array  $data Data to retrieve values from
     * @param string $path Path to traverse and retrieve a value from
     *
     * @return mixed|null
     */
    function puzzle_get_path($data, $path)
    {
        $path = explode('/', $path);

        while (null !== ($part = array_shift($path))) {
            if (!is_array($data) || !isset($data[$part])) {
                return null;
            }
            $data = $data[$part];
        }

        return $data;
    }

    /**
     * Set a value in a nested array key. Keys will be created as needed to set
     * the value.
     *
     * This function does not support keys that contain "/" or "[]" characters
     * because these are special tokens used when traversing the data structure.
     * A value may be prepended to an existing array by using "[]" as the final
     * key of a path.
     *
     *     puzzle_get_path($data, 'foo/baz'); // null
     *     puzzle_set_path($data, 'foo/baz/[]', 'a');
     *     puzzle_set_path($data, 'foo/baz/[]', 'b');
     *     puzzle_get_path($data, 'foo/baz');
     *     // Returns ['a', 'b']
     *
     * @param array  $data  Data to modify by reference
     * @param string $path  Path to set
     * @param mixed  $value Value to set at the key
     *
     * @throws RuntimeException when trying to setPath using a nested path
     *     that travels through a scalar value.
     */
    function puzzle_set_path(&$data, $path, $value)
    {
        $current =& $data;
        $queue = explode('/', $path);
        while (null !== ($key = array_shift($queue))) {
            if (!is_array($current)) {
                throw new RuntimeException("Trying to setPath {$path}, but "
                    . "{$key} is set and is not an array");
            } elseif (!$queue) {
                if ($key == '[]') {
                    $current[] = $value;
                } else {
                    $current[$key] = $value;
                }
            } elseif (isset($current[$key])) {
                $current =& $current[$key];
            } else {
                $current[$key] = array();
                $current =& $current[$key];
            }
        }
    }

    /**
     * Expands a URI template
     *
     * @param string $template  URI template
     * @param array  $variables Template variables
     *
     * @return string
     */
    function puzzle_uri_template($template, array $variables)
    {
        if (function_exists('uri_template')) {
            return uri_template($template, $variables);
        }

        static $uriTemplate;
        if (!$uriTemplate) {
            $uriTemplate = new puzzle_UriTemplate();
        }

        return $uriTemplate->expand($template, $variables);
    }

    /**
     * Wrapper for JSON decode that implements error detection with helpful
     * error messages.
     *
     * @param string $json    JSON data to parse
     * @param bool $assoc     When true, returned objects will be converted
     *                        into associative arrays.
     * @param int    $depth   User specified recursion depth.
     * @param int    $options Bitmask of JSON decode options.
     *
     * @return mixed
     * @throws InvalidArgumentException if the JSON cannot be parsed.
     * @link http://www.php.net/manual/en/function.json-decode.php
     */
    function puzzle_json_decode($json, $assoc = false, $depth = 512, $options = 0)
    {
        static $jsonErrors = array(
            JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow or the modes mismatch',
            JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found',
            JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON',
            JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
        );

        if (version_compare(PHP_VERSION, '5.4') >= 0) {

            $data = json_decode($json, $assoc, $depth, $options);

        } elseif (version_compare(PHP_VERSION, '5.3') >= 0) {

            $data = json_decode($json, $assoc, $depth);

        } else {

            $data = json_decode($json, $assoc);
        }

        if (version_compare(PHP_VERSION, '5.3') >= 0) {

            if (JSON_ERROR_NONE !== json_last_error()) {
                $last = json_last_error();
                throw new InvalidArgumentException(
                    'Unable to parse JSON data: '
                    . (isset($jsonErrors[$last])
                        ? $jsonErrors[$last]
                        : 'Unknown error')
                );
            }

        } else {

            if ("$json" !== '' && $data === null) {

                throw new InvalidArgumentException('Unable to parse JSON data: Unknown error');
            }
        }

        return $data;
    }

    /**
     * @internal
     */
    function puzzle_deprecation_proxy($object, $name, $arguments, $map)
    {
        if (!isset($map[$name])) {
            throw new BadMethodCallException('Unknown method, ' . $name);
        }

        $message = sprintf('%s is deprecated and will be removed in a future '
            . 'version. Update your code to use the equivalent %s method '
            . 'instead to avoid breaking changes when this shim is removed.',
            get_class($object) . '::' . $name . '()',
            get_class($object) . '::' . $map[$name] . '()'
        );

        if (version_compare(PHP_VERSION, '5.3') >= 0) {
            trigger_error($message, E_USER_DEPRECATED);
        } else {
            trigger_error($message, E_USER_NOTICE);
        }

        return call_user_func_array(array($object, $map[$name]), $arguments);
    }

    function __puzzle_array_replace(array $first, array $second)
    {
        if (!function_exists('array_replace'))
        {
            function array_replace( array &$array, array &$array1 )
            {
                $args = func_get_args();
                $count = func_num_args();

                for ($i = 0; $i < $count; ++$i) {
                    if (is_array($args[$i])) {
                        foreach ($args[$i] as $key => $val) {
                            $array[$key] = $val;
                        }
                    }
                    else {
                        trigger_error(
                            __FUNCTION__ . '(): Argument #' . ($i+1) . ' is not an array',
                            E_USER_WARNING
                        );
                        return NULL;
                    }
                }

                return $array;
            }
        }

        return array_replace($first, $second);
    }

    function __puzzle_array_replace_recursive(array $first, array $second)
    {
        if (!function_exists('__puzzle_recurse')) {
            function __puzzle_recurse($array, $array1) {
                foreach ($array1 as $key => $value) {
                    // create new key in $array, if it is empty or not an array
                    if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
                        $array[$key] = array();
                    }

                    // overwrite the value in the base array
                    if (is_array($value)) {
                        $value = __puzzle_recurse($array[$key], $value);
                    }
                    $array[$key] = $value;
                }
                return $array;
            }
        }

        if (!function_exists('array_replace_recursive')) {

            function array_replace_recursive($array, $array1)
            {
                // handle the arguments, merge one by one
                $args = func_get_args();
                $array = $args[0];
                if (!is_array($array)) {
                    return $array;
                }
                for ($i = 1; $i < count($args); $i++) {
                    if (is_array($args[$i])) {
                        $array = __puzzle_recurse($array, $args[$i]);
                    }
                }
                return $array;
            }
        }

        return array_replace_recursive($first, $second);
    }
}


text:
'''
Created on 19 Jul 2014

@author: chris
'''
def main():
    bbc_bus_rss_url = "http://feeds.bbci.co.uk/news/business/rss.xml"
    from words import search_bbc_feed
    bbc_bus_feed = search_bbc_feed(bbc_bus_rss_url)
    item = bbc_bus_feed.items[19]
#     print item.summ
    item.sentences_on_page()
    for sentence in item.sentences:
        print sentence
#     item.pos_neg_count()
#     print item.neg_count, item.pos_count

if __name__ == '__main__':
    main()


text:
package net.jpountz.lz4;

import static net.jpountz.lz4.LZ4Constants.LAST_LITERALS;
import static net.jpountz.lz4.LZ4Constants.ML_BITS;
import static net.jpountz.lz4.LZ4Constants.ML_MASK;
import static net.jpountz.lz4.LZ4Constants.RUN_MASK;
import net.jpountz.util.SafeUtils;

enum LZ4SafeUtils {
  ;

  static int hash(byte[] buf, int i) {
    return LZ4Utils.hash(SafeUtils.readInt(buf, i));
  }

  static int hash64k(byte[] buf, int i) {
    return LZ4Utils.hash64k(SafeUtils.readInt(buf, i));
  }

  static boolean readIntEquals(byte[] buf, int i, int j) {
    return buf[i] == buf[j] && buf[i+1] == buf[j+1] && buf[i+2] == buf[j+2] && buf[i+3] == buf[j+3];
  }

  static void safeIncrementalCopy(byte[] dest, int matchOff, int dOff, int matchLen) {
    for (int i = 0; i < matchLen; ++i) {
      dest[dOff + i] = dest[matchOff + i];
    }
  }

  static void wildIncrementalCopy(byte[] dest, int matchOff, int dOff, int matchCopyEnd) {
    do {
      copy8Bytes(dest, matchOff, dest, dOff);
      matchOff += 8;
      dOff += 8;
    } while (dOff < matchCopyEnd);
  }

  static void copy8Bytes(byte[] src, int sOff, byte[] dest, int dOff) {
    for (int i = 0; i < 8; ++i) {
      dest[dOff + i] = src[sOff + i];
    }
  }

  static int commonBytes(byte[] b, int o1, int o2, int limit) {
    int count = 0;
    while (o2 < limit && b[o1++] == b[o2++]) {
      ++count;
    }
    return count;
  }

  static int commonBytesBackward(byte[] b, int o1, int o2, int l1, int l2) {
    int count = 0;
    while (o1 > l1 && o2 > l2 && b[--o1] == b[--o2]) {
      ++count;
    }
    return count;
  }

  static void safeArraycopy(byte[] src, int sOff, byte[] dest, int dOff, int len) {
    System.arraycopy(src, sOff, dest, dOff, len);
  }

  static void wildArraycopy(byte[] src, int sOff, byte[] dest, int dOff, int len) {
    try {
      for (int i = 0; i < len; i += 8) {
        copy8Bytes(src, sOff + i, dest, dOff + i);
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      throw new LZ4Exception("Malformed input at offset " + sOff);
    }
  }

  static int encodeSequence(byte[] src, int anchor, int matchOff, int matchRef, int matchLen, byte[] dest, int dOff, int destEnd) {
    final int runLen = matchOff - anchor;
    final int tokenOff = dOff++;

    if (dOff + runLen + (2 + 1 + LAST_LITERALS) + (runLen >>> 8) > destEnd) {
      throw new LZ4Exception("maxDestLen is too small");
    }

    int token;
    if (runLen >= RUN_MASK) {
      token = (byte) (RUN_MASK << ML_BITS);
      dOff = writeLen(runLen - RUN_MASK, dest, dOff);
    } else {
      token = runLen << ML_BITS;
    }

    // copy literals
    wildArraycopy(src, anchor, dest, dOff, runLen);
    dOff += runLen;

    // encode offset
    final int matchDec = matchOff - matchRef;
    dest[dOff++] = (byte) matchDec;
    dest[dOff++] = (byte) (matchDec >>> 8);

    // encode match len
    matchLen -= 4;
    if (dOff + (1 + LAST_LITERALS) + (matchLen >>> 8) > destEnd) {
      throw new LZ4Exception("maxDestLen is too small");
    }
    if (matchLen >= ML_MASK) {
      token |= ML_MASK;
      dOff = writeLen(matchLen - RUN_MASK, dest, dOff);
    } else {
      token |= matchLen;
    }

    dest[tokenOff] = (byte) token;

    return dOff;
  }

  static int lastLiterals(byte[] src, int sOff, int srcLen, byte[] dest, int dOff, int destEnd) {
    final int runLen = srcLen;

    if (dOff + runLen + 1 + (runLen + 255 - RUN_MASK) / 255 > destEnd) {
      throw new LZ4Exception();
    }

    if (runLen >= RUN_MASK) {
      dest[dOff++] = (byte) (RUN_MASK << ML_BITS);
      dOff = writeLen(runLen - RUN_MASK, dest, dOff);
    } else {
      dest[dOff++] = (byte) (runLen << ML_BITS);
    }
    // copy literals
    System.arraycopy(src, sOff, dest, dOff, runLen);
    dOff += runLen;

    return dOff;
  }

  static int writeLen(int len, byte[] dest, int dOff) {
    while (len >= 0xFF) {
      dest[dOff++] = (byte) 0xFF;
      len -= 0xFF;
    }
    dest[dOff++] = (byte) len;
    return dOff;
  }

  static class Match {
    int start, ref, len;

    void fix(int correction) {
      start += correction;
      ref += correction;
      len -= correction;
    }

    int end() {
      return start + len;
    }
  }

  static void copyTo(Match m1, Match m2) {
    m2.len = m1.len;
    m2.start = m1.start;
    m2.ref = m1.ref;
  }

}


text:
package nitrodragon.render;

import org.lwjgl.BufferUtils;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;

public class Model {

    private int draw_count;
    private int v_id;
    private int t_id;
    private int i_id;

    public Model(float[] vertices, float[] tex_coords, int[] indices) {
        draw_count = indices.length;

        v_id = glGenBuffers();
        glBindBuffer(GL_ARRAY_BUFFER, v_id);
        glBufferData(GL_ARRAY_BUFFER, createBuffer(vertices), GL_STATIC_DRAW);

        t_id = glGenBuffers();
        glBindBuffer(GL_ARRAY_BUFFER, t_id);
        glBufferData(GL_ARRAY_BUFFER, createBuffer(tex_coords), GL_STATIC_DRAW);

        i_id = glGenBuffers();

        IntBuffer buffer = BufferUtils.createIntBuffer(indices.length);
        buffer.put(indices);
        buffer.flip();

        glBufferData(GL_ELEMENT_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, i_id);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
    }

    protected void finalize() {
        glDeleteBuffers(v_id);
        glDeleteBuffers(t_id);
        glDeleteBuffers(i_id);
    }

    public void render() {
        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(1);

        glBindBuffer(GL_ARRAY_BUFFER, v_id);
        glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);

        glBindBuffer(GL_ARRAY_BUFFER, t_id);
        glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, i_id);
        glDrawElements(GL_TRIANGLES, draw_count, GL_UNSIGNED_INT, 0);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ARRAY_BUFFER, 0);

        glDisableVertexAttribArray(0);
        glDisableVertexAttribArray(1);
    }

    private FloatBuffer createBuffer(float[] data) {
        FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
        buffer.put(data);
        buffer.flip();
        return buffer;
    }
}


text:
-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
-- Copyright [2016-2022] EMBL-European Bioinformatics Institute
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

/**
@header patch_90_91_c.sql - Translate sequence region ids of regulatory features
@desc   Translate sequence region ids of regulatory features
*/

DROP TABLE IF EXISTS `temp_regulatory_feature_with_translated_ids`;

CREATE TABLE `temp_regulatory_feature_with_translated_ids` (
  `regulatory_feature_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `feature_type_id` int(10) unsigned DEFAULT NULL,
  `seq_region_id` int(10) unsigned NOT NULL,
  `seq_region_strand` tinyint(1) NOT NULL,
  `seq_region_start` int(10) unsigned NOT NULL,
  `seq_region_end` int(10) unsigned NOT NULL,
  `stable_id` varchar(18) DEFAULT NULL,
  `bound_start_length` mediumint(3) unsigned NOT NULL,
  `bound_end_length` mediumint(3) unsigned NOT NULL,
  `epigenome_count` smallint(6) DEFAULT NULL,
  `regulatory_build_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`regulatory_feature_id`),
  UNIQUE KEY `uniqueness_constraint_idx` (`feature_type_id`,`seq_region_id`,`seq_region_strand`,`seq_region_start`,`seq_region_end`,`stable_id`,`bound_start_length`,`bound_end_length`,`regulatory_build_id`),
  KEY `feature_type_idx` (`feature_type_id`),
  KEY `stable_id_idx` (`stable_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

insert into temp_regulatory_feature_with_translated_ids
select
    regulatory_feature_id,
    feature_type_id,
    core_seq_region_id as seq_region_id,
    seq_region_strand,
    seq_region_start,
    seq_region_end,
    stable_id,
    bound_start_length,
    bound_end_length,
    epigenome_count,
    regulatory_build_id
from regulatory_feature join seq_region using (seq_region_id);

-- patch identifier
INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL, 'patch', 'patch_90_91_c.sql|Translate sequence region ids of regulatory features');


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Unofficial Einstein Facts skill, try saying...

* *Alexa, start Einstein facts*

* *Alexa, open Einstein facts*

Gives some random facts about Albert Einstein

***

### Skill Details

* **Invocation Name:** einstein facts
* **Category:** null
* **ID:** amzn1.ask.skill.cca1aad3-56cf-4db0-bbbc-8b13455a9f91
* **ASIN:** B01NBEZ7JZ
* **Author:** Anonym
* **Release Date:** December 1, 2016 @ 02:35:39
* **In-App Purchasing:** No