text:
<?xml version="1.0" encoding="utf-8"?>
<assembly name="Microsoft.VisualBasic.Activities.Compiler" version="10.0.0.0">
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitCtor(Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.PropertyAndField[],System.Reflection.Emit.ConstructorBuilder)">
    <parameter name="properties">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="method">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitEqualsObj(System.Reflection.Emit.TypeBuilder,System.Reflection.Emit.MethodBuilder,System.Reflection.Emit.MethodBuilder)">
    <parameter name="method">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="typedEqualsMethoed">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="typeBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitEqualsTyped(Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.PropertyAndField[],System.Reflection.Emit.MethodBuilder)">
    <parameter name="properties">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="method">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitGetHashCode(Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.PropertyAndField[],System.Reflection.Emit.MethodBuilder)">
    <parameter name="properties">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="method">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitProperty(Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.PropertyAndField)">
    <parameter name="prop">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.EmitToString(Microsoft.Compiler.VisualBasic.AnonymousTypeEmitter.PropertyAndField[],System.Reflection.Emit.MethodBuilder)">
    <parameter name="properties">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="method">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="P:Microsoft.Compiler.VisualBasic.CompilerContext.Options">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.CompilerResults.AddError(System.Int32,System.String,Microsoft.Compiler.VisualBasic.SourceLocation)">
    <parameter name="description">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.CompilerResults.AddWarning(System.Int32,System.String,Microsoft.Compiler.VisualBasic.SourceLocation)">
    <parameter name="description">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.Error.#ctor(System.Int32,System.String,Microsoft.Compiler.VisualBasic.SourceLocation)">
    <parameter name="description">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.HostedCompiler.CompileExpression(System.String,Microsoft.Compiler.VisualBasic.CompilerContext)">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.HostedCompiler.CompileExpression(System.String,Microsoft.Compiler.VisualBasic.CompilerContext,System.Type)">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.Import.#ctor(System.String)">
    <parameter name="importedEntity">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.Import.#ctor(System.String,System.String)">
    <parameter name="alias">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <parameter name="importedEntity">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.ImportScope.GetImports">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.ScriptScope.FindVariable(System.String)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="P:Microsoft.Compiler.VisualBasic.SymbolMap.DynamicAnonymousDelegateEmitter">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="P:Microsoft.Compiler.VisualBasic.SymbolMap.DynamicAnonymousTypeEmitter">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="P:Microsoft.Compiler.VisualBasic.SymbolMap.DynamicAssemblyBuilder">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="P:Microsoft.Compiler.VisualBasic.SymbolMap.DynamicModuleBuilder">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.EqualsArrayType(BCSYM_ArrayType*,System.Type)">
    <parameter name="type">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.EqualsBasicType(BCSYM_NamedRoot*,System.Type)">
    <parameter name="type">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.EqualsBoundGenericType(BCSYM_GenericTypeBinding*,System.Type)">
    <parameter name="type">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.EqualsGenericParamType(BCSYM_GenericParam*,System.Type)">
    <parameter name="type">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.FindMethod(BCSYM_Proc*,System.String,System.Reflection.MethodBase[],System.Type)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
    <parameter name="methods">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.GetArrayType(BCSYM_ArrayType*,BCSYM_GenericBinding*)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.GetConstructor(BCSYM_Proc*,BCSYM_GenericTypeBinding*)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.GetMethod(BCSYM_Proc*,BCSYM_GenericBinding*)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.GetParameterTypes(BCSYM_Proc*,BCSYM_GenericBinding*)">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.SymbolMap.MakeConcrete(System.Type,System.Type[],BCSYM_GenericTypeBinding*,BCSYM_GenericBinding*)">
    <parameter name="typeDef">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineConstructor(System.Reflection.Emit.TypeBuilder,BCSYM_Proc*)">
    <parameter name="typeBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineField(System.Reflection.Emit.TypeBuilder,BCSYM_Variable*)">
    <parameter name="typeBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineGenericTypeParameter(System.Reflection.Emit.TypeBuilder,System.Reflection.Emit.GenericTypeParameterBuilder,BCSYM_GenericParam*)">
    <parameter name="paramBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineMethod(System.Reflection.Emit.TypeBuilder,BCSYM_Proc*)">
    <parameter name="typeBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineProperty(System.Reflection.Emit.TypeBuilder,BCSYM_Property*)">
    <parameter name="typeBuilder">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.DefineType(BCSYM_NamedRoot*)">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeEmitter.GetParameterTypes(System.Reflection.Emit.TypeBuilder,BCSYM_Proc*)">
    <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.TypeScope.FindTypes(System.String,System.String)">
    <attribute ctor="M:JetBrains.Annotations.CanBeNullAttribute.#ctor" />
  </member>
  <member name="M:Microsoft.Compiler.VisualBasic.Warning.#ctor(System.Int32,System.String,Microsoft.Compiler.VisualBasic.SourceLocation)">
    <parameter name="description">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>
</assembly>


text:
package org.workcraft.plugins.atacs;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.workcraft.Framework;
import org.workcraft.exceptions.DeserialisationException;
import org.workcraft.plugins.atacs.commands.ComplexGateSynthesisCommand;
import org.workcraft.utils.BackendUtils;
import org.workcraft.utils.PackageUtils;
import org.workcraft.workspace.WorkspaceEntry;

import java.net.URL;

class MissingToolTests {

    @BeforeAll
    static void init() {
        final Framework framework = Framework.getInstance();
        framework.init();
    }

    @Test
    void testMissingAtacsVerification() throws DeserialisationException {
        AtacsSettings.setCommand(BackendUtils.getTemplateToolPath("ATACS", "atacs-missing"));
        testMissingTool();
    }

    private void testMissingTool() throws DeserialisationException {
        final Framework framework = Framework.getInstance();
        final ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        String workName = PackageUtils.getPackagePath(getClass(), "buffer.stg.work");
        URL url = classLoader.getResource(workName);
        WorkspaceEntry we = framework.loadWork(url.getFile());
        ComplexGateSynthesisCommand command = new ComplexGateSynthesisCommand();
        Assertions.assertNull(command.execute(we));
    }

}

redpajama_set_name: RedPajamaGithub


text:
class ProvidersController < ApplicationController
  before_action :set_provider, only: [:show, :edit, :update, :destroy]

  # GET /providers
  # GET /providers.json
  def index
    @providers = Provider.all
  end

  # GET /providers/1
  # GET /providers/1.json
  def show
  end

  # GET /providers/new
  def new
    @provider = Provider.new
  end

  # GET /providers/1/edit
  def edit
  end

  # POST /providers
  # POST /providers.json
  def create
    @provider = Provider.new(provider_params)

    respond_to do |format|
      if @provider.save
        format.html { redirect_to @provider, notice: 'Provider was successfully created.' }
        format.json { render :show, status: :created, location: @provider }
      else
        format.html { render :new }
        format.json { render json: @provider.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /providers/1
  # PATCH/PUT /providers/1.json
  def update
    respond_to do |format|
      if @provider.update(provider_params)
        format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }
        format.json { render :show, status: :ok, location: @provider }
      else
        format.html { render :edit }
        format.json { render json: @provider.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /providers/1
  # DELETE /providers/1.json
  def destroy
    @provider.destroy
    respond_to do |format|
      format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_provider
      @provider = Provider.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def provider_params
      params.require(:provider).permit(:name, :omniauth_name, :github, :instructions)
    end
end


text:
package org.locationtech.geowave.service;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Produces(MediaType.APPLICATION_JSON)
@Path("/v0/config")
public interface ConfigService {

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/list")
  public Response list(@QueryParam("filter") String filters);

  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/geoserver")
  public Response configGeoServer(
      @QueryParam("GeoServerURL") String GeoServerURL,
      @QueryParam("username") String username,
      @QueryParam("pass") String pass,
      @QueryParam("workspace") String workspace,
      @QueryParam("sslSecurityProtocol") String sslSecurityProtocol,
      @QueryParam("sslTrustStorePath") String sslTrustStorePath,
      @QueryParam("sslTrustStorePassword") String sslTrustStorePassword,
      @QueryParam("sslTrustStoreType") String sslTrustStoreType,
      @QueryParam("sslTruststoreProvider") String sslTruststoreProvider,
      @QueryParam("sslTrustManagerAlgorithm") String sslTrustManagerAlgorithm,
      @QueryParam("sslTrustManagerProvider") String sslTrustManagerProvider,
      @QueryParam("sslKeyStorePath") String sslKeyStorePath,
      @QueryParam("sslKeyStorePassword") String sslKeyStorePassword,
      @QueryParam("sslKeyStoreProvider") String sslKeyStoreProvider,
      @QueryParam("sslKeyPassword") String sslKeyPassword,
      @QueryParam("sslKeyStoreType") String sslKeyStoreType,
      @QueryParam("sslKeyManagerAlgorithm") String sslKeyManagerAlgorithm,
      @QueryParam("sslKeyManagerProvider") String sslKeyManagerProvider);

  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/hdfs")
  public Response configHDFS(@QueryParam("HDFSDefaultFSURL") String HDFSDefaultFSURL);

  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/set")
  public Response set(
      @QueryParam("name") String name,
      @QueryParam("value") String value,
      @QueryParam("password") Boolean password);
}


text:
namespace stags {

    using std::string;
    using std::vector;
    using std::function;
    using std::unordered_map;
    using std::runtime_error;
    using namespace json11;

    // XML configuration
    typedef boost::property_tree::ptree Config;

    void LoadConfig (string const &path, Config *);
    void SaveConfig (string const &path, Config const &);

    // Overriding configuration options in the form of "KEY=VALUE"
    void OverrideConfig (std::vector<std::string> const &overrides, Config *);

    static constexpr int64_t ErrorCode_Success = 0;
    static constexpr int64_t ErrorCode_Unknown = -1;

    class Error: public runtime_error {
        int32_t c;
    public:
        explicit Error (string const &what): runtime_error(what), c(ErrorCode_Unknown) {}
        explicit Error (char const *what): runtime_error(what), c(ErrorCode_Unknown) {}
        explicit Error (string const &what, int32_t code): runtime_error(what), c(code) {}
        explicit Error (char const *what, int32_t code): runtime_error(what), c(code) {}
        virtual int32_t code () const {
            return c;
        }
    };

#define DEFINE_ERROR(name, cc) \
    class name: public Error { \
    public: \
        explicit name (string const &what): Error(what) {} \
        explicit name (char const *what): Error(what) {} \
        virtual int32_t code () const { return cc;} \
    }

    DEFINE_ERROR(InternalError, 0x0001);
    DEFINE_ERROR(ExternalError, 0x0002);
    DEFINE_ERROR(OutOfMemoryError, 0x0004);
    DEFINE_ERROR(FileSystemError, 0x0008);
    DEFINE_ERROR(RequestError, 0x0010);
    DEFINE_ERROR(ConfigError, 0x0020);
    DEFINE_ERROR(PluginError, 0x0040);
    DEFINE_ERROR(PermissionError, 0x0080);
    DEFINE_ERROR(NotImplementedError, 0x0100);
#undef DEFINE_ERROR

#define LOG(x) BOOST_LOG_TRIVIAL(x)
    namespace logging = boost::log;
    void setup_logging (Config const &);
    void cleanup_logging ();

    struct Tag {
        string type;
        string value;
        double score;

        Tag () {
        }

        Tag (string const &t, string const &v, float s = 0): type(t), value(v), score(s) {
        }

    };

    // Tagger interface
    class Tagger {
    public:
        typedef function<Tagger *(Config const&)> Constructor;
        // Returns the data type this tagger is supposed to work on.
        virtual string type () const = 0;
        virtual ~Tagger() {}
        // Generate tags.  The input tags vector is appended to.
        virtual void tag (string const &object, vector<Tag> *tags) = 0;
    };

    // The meta tagger manages all other taggers, and selectively invoke them
    // for different data types.
    Tagger *create_meta_tagger (Config const &, vector<Tagger::Constructor> const &);

    // The server is multi-threaded and this one maintains a
    // tagger set for each thread.
    class MetaTaggerManager {
        Config config;  // we need to save configuration for future creation of taggers.
        vector<Tagger::Constructor> cons;                 // registered constructors
        unordered_map<std::thread::id, Tagger *> insts;   // instance for each thread
        std::mutex mutex;
    public:
        MetaTaggerManager (Config const &c): config(c) {
        }

        ~MetaTaggerManager () {
            for (auto &p: insts) {
                delete p.second;
            }
        }

        void registerTagger (Tagger::Constructor const &c) {
            cons.push_back(c);
        }

        Tagger *get () {
            std::thread::id id = std::this_thread::get_id();
            std::lock_guard<std::mutex> lock(mutex);
            auto it = insts.find(id);
            if (it == insts.end()) {
                Tagger *tagger = create_meta_tagger(config, cons);
                insts[id] = tagger;
                return tagger;
            }
            else {
                return it->second;
            }
        }
    };

    Tagger *create_text_tagger (Config const &);
    Tagger *create_image_tagger (Config const &);
    Tagger *create_audio_tagger (Config const &);
}


text:
package com.zhntd.vault.secure;

import android.app.Activity;

import com.zhntd.vault.activity.SecureActivity;
import com.zhntd.vault.application.VaultApp;
import com.zhntd.vault.utils.Logger;

public class SecurityLockManager {

    final VaultApp mApp;
    private final Stack<Activity> mSecureActivities;

    public SecurityLockManager(VaultApp mApp) {
        if (mApp == null)
            throw new RuntimeException("Invalid args!");
        this.mApp = mApp;
        mSecureActivities = new Stack<>();
    }

    public void registerActivity(Activity activity) {
        if (activity instanceof SecureActivity)
            this.mSecureActivities.push(activity);
        else {
            throw new IllegalArgumentException("Only SecureActivity accepted.");
        }
    }

    public void popActivity(SecureActivity activity) {
        if (activity == this.mSecureActivities.peek()) {
            this.mSecureActivities.pop();
            Logger.d("Successfully pop an activity: " + activity.toString(), getClass());
        } else {
            if (mSecureActivities.remove(activity)) {
                Logger.d("The activity to pop is not match with the pop, but still be removed:"
                        + activity.toString(), getClass());
            } else {
                Logger.e("Failed to remove from the stack!", getClass());
            }
        }
    }

    public boolean isOnTop(Activity activity) {
        return activity == mSecureActivities.peek();
    }

    public void checkState(Activity activity) {
        Logger.d("SecurityLockManager, check state for: " + mSecureActivities.toString(), getClass());
        SecureActivity secureActivity = (SecureActivity) mSecureActivities.peek();
        if (secureActivity != null && activity == secureActivity)
            secureActivity.checkStateWhenResume(this);
        else {
            Logger.e("No activity exist or activity not match to check state!", getClass());
        }
    }
}


text:
import argparse
import re
from common import *

from inventory_loader import get_ansible_inventory
from inventory_loader import get_inventory_hosts

# Define and parse command line arguments
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--host", help="Device Host/IP")
    parser.add_argument("--inventory", help="Ansible Inventory file to use (instead of --host)")
    parser.add_argument("--user", help="User ID")
    parser.add_argument("--passvar", help="Environmental variable with PW.  Otherwise, prompt.")
    return parser.parse_args()

def parse_cdp_neighbors(output):
    """
    Parses the output of IOS "get cdp neighbors" command.

    Based on Napalm get_lldp_neighbors function
    """

    cdp = {}
    # command = 'show cdp neighbors'

    # Check if router supports the command
    if '% Invalid input' in output:
        return {}

    # Process the output to obtain just the CDP entries
    try:
        split_output = re.split(r'^Device[ |-]ID.*$', output, flags=re.M)[1]
        split_output = re.split(r'^Total cdp entries displayed.*$', split_output, flags=re.M)[0]
    except IndexError:
        return {}

    split_output = split_output.strip()

    # Work through the CDP lines, treating lines starting with whitespace
    # as a continution of the previous line (long device ID)
    for cdp_entry in re.split("\n(?!\s+)", split_output):
        device_id = cdp_entry.split()[0]
        if len(cdp_entry.split('\n')) == 2:
            # Long named entry - device_id is first line
            tmp_field = cdp_entry.split('\n')[1].strip()
        else:
            # Single line entry - spilt at device_id
            tmp_field = cdp_entry.split(None,1)[1].strip()

        # First column is the local port
        local_port = tmp_field[:18].strip()
        # Move to hold time
        tmp_field = re.split(r'\d{1,3}', tmp_field[18:], maxsplit=1)[1]
        # Last column is remote port (not 100% reliable - CAT4507, for example)
        remote_port = tmp_field[30:].strip()

        entry = {'port': remote_port, 'hostname': device_id}
        cdp.setdefault(local_port, [])
        cdp[local_port].append(entry)

    return cdp

def print_cdp_csv(cdp_data, local_device=''):
    """Print out a CDP table in CSV format"""

    print '"Local_Device","Local_Intrfce","Remote_Device","Remote_Port"'
    for local_int in cdp_data:
        for entry in cdp_data[local_int]:
            print '"{}","{}","{}","{}"'.format(local_device, local_int, entry['hostname'], entry['port'])

# Connect to a device with NAPALM and run a cli command
def run_napalm_cdp_getter(host, username, password):
    # Connect to the device using NAPALM
    from napalm import get_network_driver
    driver = get_network_driver('ios_rtb')
    device = driver(host, username, password)
    try:
        device.open()
        result = device.get_cdp_neighbors()
        device.close()
        return result
    except Exception as e:
        print 'Error: {}'.format(e)
        return {}

### ---------------------------------------------------------------------------
### MAIN
### ---------------------------------------------------------------------------

# Main function (when running as an executable)
if __name__ == '__main__':

    # Retrive the command line arguments
    args = parse_args()

    # Establish device connection info
    if args.inventory:
        inventory = get_ansible_inventory(args.inventory)
        inventory_hosts = get_inventory_hosts(inventory)
    else:
        host = args.host
    username = args.user
    password = get_password(args.passvar)
    if not password:
        print "No password"
        exit()

    try:
        for host in inventory_hosts:
            print '\n# Running on device {}'.format(host['name'])
            cdp_data = run_napalm_cdp_getter(host['address'], username, password)
            print_cdp_csv(cdp_data, host['name'])
    except:
        cdp_data = run_napalm_cdp_getter(host, username, password)
        print_cdp_csv(cdp_data, host)


text:
import unittest
import json
import urlparse

from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import mocker

from articletrack.balaio import BalaioAPI, BalaioRPC, SettingsMixin

class BalaioCheckSettingsTests(unittest.TestCase):

    def setUp(self):
        pass

    def test_validate_correct_settings(self):
        b_client = BalaioAPI()
        self.assertTrue(b_client.validate_settings('default'))

    def test_raise_using_invalid_settings(self):
        self.assertRaises(ImproperlyConfigured, BalaioAPI, using='UNEXISTENT_KEY')

    def test_api_hostname(self):
        balaio_api = BalaioAPI()
        api_hostname = balaio_api.get_hostname()
        hostname_url = urlparse.urlsplit(api_hostname)

        api_settings_protocol = settings.API_BALAIO['default']['PROTOCOL']
        api_settings_host = settings.API_BALAIO['default']['HOST']
        api_settings_port = settings.API_BALAIO['default']['PORT']
        api_settings_netloc = ":".join([api_settings_host, api_settings_port])

        self.assertTrue(hostname_url.scheme == api_settings_protocol)
        self.assertTrue(hostname_url.netloc == api_settings_netloc)

    def test_api_basepath(self):
        balaio_api = BalaioAPI()
        api_basepath = balaio_api.get_basepath()

        api_settings_path = settings.API_BALAIO['default']['PATH']
        self.assertTrue(api_basepath == api_settings_path)

    def test_api_fullpath(self):
        balaio_api = BalaioAPI()
        api_fullpath_url = balaio_api.get_fullpath()
        api_fullpath_url = urlparse.urlsplit(api_fullpath_url)

        api_settings_protocol = settings.API_BALAIO['default']['PROTOCOL']
        api_settings_host = settings.API_BALAIO['default']['HOST']
        api_settings_port = settings.API_BALAIO['default']['PORT']
        api_settings_netloc = ":".join([api_settings_host, api_settings_port])
        api_settings_path = settings.API_BALAIO['default']['PATH']

        self.assertTrue(api_fullpath_url.scheme == api_settings_protocol)
        self.assertTrue(api_fullpath_url.netloc == api_settings_netloc)
        self.assertTrue(api_fullpath_url.path == api_settings_path)

class BalaioRPCCheckSettingsTests(unittest.TestCase):

    def test_validate_correct_settings(self):
        b_client = BalaioRPC()
        self.assertTrue(b_client.validate_settings('default'))

    def test_raise_using_invalid_settings(self):
        self.assertRaises(ImproperlyConfigured, BalaioAPI, using='UNEXISTENT_KEY')

    def test_api_fullpath(self):
        balaio_api = BalaioRPC()
        api_fullpath_url = balaio_api._fullpath()
        api_fullpath_url = urlparse.urlsplit(api_fullpath_url)

        api_settings_protocol = settings.API_BALAIO['default']['PROTOCOL']
        api_settings_host = settings.API_BALAIO['default']['HOST']
        api_settings_port = settings.API_BALAIO['default']['PORT']
        api_settings_netloc = ":".join([api_settings_host, api_settings_port])
        api_settings_path = settings.API_BALAIO['default']['PATH']

        self.assertTrue(api_fullpath_url.scheme == api_settings_protocol)
        self.assertTrue(api_fullpath_url.netloc == api_settings_netloc)
        self.assertTrue(api_fullpath_url.path == '/' + api_settings_path.strip('/') + '/_rpc/')

class SettingsMixinTests(unittest.TestCase):

    def test_validate_correct_settings(self):
        self.assertTrue(SettingsMixin().validate_settings('default'))

    def test_validate_incorrect_settings(self):
        self.assertRaises(ImproperlyConfigured,
            lambda: SettingsMixin().validate_settings('nonexisting'))

class BalaioRequestsTests(mocker.MockerTestCase):

    def test_is_up(self):
        balaio_api = BalaioAPI()
        # response
        mock_response = self.mocker.mock()
        mock_response.getcode()
        self.mocker.result(200)

        # request
        mock_request = self.mocker.replace('urllib2')
        mock_request.urlopen("%sstatus/" % balaio_api.get_hostname(), timeout=mocker.ANY)
        self.mocker.result(mock_response)

        self.mocker.replay()

        self.assertTrue(balaio_api.is_up())

    def test_list_files_members_by_attempt(self):
        balaio_api = BalaioAPI()
        attempt_id = 25
        expected_json_response = {
            "xml": [
                "0034-8910-rsp-47-04-0817.xml"
            ],
            "pdf": [
                "0034-8910-rsp-47-04-0817.pdf",
                "en_0034-8910-rsp-47-04-0817.pdf"
            ],
            "tif": [
                "0034-8910-rsp-47-04-0817-gf01.tif"
            ],
            'error': False
        }

        # response
        mock_response = self.mocker.mock()

        mock_response.getcode()
        self.mocker.result(200)

        mock_response.read(settings.API_BALAIO_DEFAULT_CHUNK_SIZE)
        self.mocker.result(json.dumps(expected_json_response))

        mock_response.read(settings.API_BALAIO_DEFAULT_CHUNK_SIZE)
        self.mocker.result('')

        # request
        mock_request = self.mocker.replace('urllib2')
        mock_request.urlopen('%sfiles/%s/' % (balaio_api.get_fullpath(), str(attempt_id)), timeout=mocker.ANY)
        self.mocker.result(mock_response)

        self.mocker.replay()

        self.assertEqual(
            balaio_api.list_files_members_by_attempt(attempt_id),
            expected_json_response
        )

    def test_list_files_unexistent_attempt_raise_error(self):
        balaio_api = BalaioAPI()
        invalid_attempt_id = 0
        expected_json_response = {'message': u'Error HTTP Not 200', 'error': True}

        # response
        mock_response = self.mocker.mock()

        mock_response.getcode()
        self.mocker.result(404)

        # request
        mock_request = self.mocker.replace('urllib2')
        mock_request.urlopen('%sfiles/%s/' % (balaio_api.get_fullpath(), str(invalid_attempt_id)), timeout=mocker.ANY)
        self.mocker.result(mock_response)

        self.mocker.replay()

        self.assertEqual(
            balaio_api.list_files_members_by_attempt(invalid_attempt_id),
            expected_json_response
        )

class BalaioAPIRequestsTests(mocker.MockerTestCase):
    def test_valid_remote_call_without_args(self):
        client = BalaioRPC(using='default')

        mock_serverproxy = self.mocker.mock()
        mock_serverproxy.foo()
        self.mocker.result('bar')

        mock_client = self.mocker.patch(client)
        mock_client.server_path
        self.mocker.result('http://domain.com:8086/api/v1/_rpc/')

        mock_client._xmlrpclib.ServerProxy('http://domain.com:8086/api/v1/_rpc/foo/')
        self.mocker.result(mock_serverproxy)

        self.mocker.replay()

        self.assertEqual(client.call('foo'), 'bar')

    def test_valid_remote_call_with_args(self):
        client = BalaioRPC(using='default')

        mock_serverproxy = self.mocker.mock()
        mock_serverproxy.foo('bla')
        self.mocker.result('bar')

        mock_client = self.mocker.patch(client)
        mock_client.server_path
        self.mocker.result('http://domain.com:8086/api/v1/_rpc/')

        mock_client._xmlrpclib.ServerProxy('http://domain.com:8086/api/v1/_rpc/foo/')
        self.mocker.result(mock_serverproxy)

        self.mocker.replay()

        self.assertEqual(client.call('foo', ['bla']), 'bar')

    def test_is_up_when_server_returns_True(self):
        client = BalaioRPC(using='default')

        mock_client = self.mocker.patch(client)
        mock_client.call('status')
        self.mocker.result(True)

        self.mocker.replay()

        self.assertTrue(client.is_up())

    def test_is_up_when_server_returns_False(self):
        client = BalaioRPC(using='default')

        mock_client = self.mocker.patch(client)
        mock_client.call('status')
        self.mocker.result(False)

        self.mocker.replay()

        self.assertFalse(client.is_up())

    def test_is_up_when_connection_blows(self):
        import xmlrpclib
        client = BalaioRPC(using='default')

        mock_client = self.mocker.patch(client)
        mock_client.call('status')
        self.mocker.throw(xmlrpclib.ProtocolError('url', 'headers', '1', 'errmsg'))

        self.mocker.replay()

        self.assertFalse(client.is_up())

    def test_is_up_when_rpc_is_faulty(self):
        import xmlrpclib
        client = BalaioRPC(using='default')

        mock_client = self.mocker.patch(client)
        mock_client.call('status')
        self.mocker.throw(xmlrpclib.Fault('1', 'fault_str'))

        self.mocker.replay()

        self.assertFalse(client.is_up())


text:
import immutablePersistenceTransform from '../Store/ImmutablePersistenceTransform'
import { persistentStoreBlacklist } from '../Reducers/'
import { AsyncStorage } from 'react-native'

const REDUX_PERSIST = {
  active: true,
  reducerVersion: '1',
  storeConfig: {
    storage: AsyncStorage,
    blacklist: persistentStoreBlacklist,
    transforms: [immutablePersistenceTransform]
  }
}

export default REDUX_PERSIST


text:
from fuel_health import cloudvalidation

class DBSpaceTest(cloudvalidation.CloudValidationTest):
    """Cloud Validation Test class for free space for DB."""

    def _check_db_disk_expectation_warning(self, host):
        """Checks whether DB expects less free space than actually
        is presented on the controller node
        """
        scheduler_log = 'nova-scheduler.log'

        if self.config.compute.deployment_os.lower() == 'centos':
            scheduler_log = 'scheduler.log'

        err_msg = "Cannot check {scheduler_log} at {host}".format(
            host=host, scheduler_log=scheduler_log)

        warning_msg = "Host has more disk space than database expected"
        cmd = ("cat /var/log/nova/{scheduler_log} "
               "| grep '{msg}' | tail -1").format(
                   msg=warning_msg, scheduler_log=scheduler_log)

        out, err = self.verify(5, self._run_ssh_cmd, 1, err_msg,
                               'check nova-scheduler.log', host, cmd)

        self.verify_response_true(not err, err_msg, 1)

        return out

    def test_db_expectation_free_space(self):
        """Check disk space allocation for databases on controller nodes
        Target component: Nova

        Scenario:
            1. Check disk space allocation for databases on controller nodes

        Duration: 20 s.

        Deployment tags: RHEL

        Available since release: 2014.2-6.1
        """

        hosts = filter(self._check_db_disk_expectation_warning,
                       self.controllers)

        self.verify_response_true(not hosts,
                                  ("Free disk space cannot be used "
                                   "by database on node(s): {hosts}"
                                   ).format(hosts=hosts),
                                  1)


text:
layout: data_model
title: DeviceObjectType
this_version: 4.1
---

DeviceObjectTypeDevice Object Schema

      <form id="nav-version">
        <select>

            <option value="4.1" selected="selected">MAEC 4.1</option>

        </select>
      </form>

The DeviceObjectType type is intended to characterize a specific Device.

      Field Name
      Type
      Description

      @object_referenceoptional

          QName

The object_reference field specifies a unique ID reference to an Object defined elsewhere. This construct allows for the re-use of the defined Properties of one Object within another, without the need to embed the full Object in the location from which it is being referenced. Thus, this ID reference is intended to resolve to the Properties of the Object that it points to.

      Custom_Properties0..1

          CustomPropertiesType

The Custom_Properties construct is optional and enables the specification of a set of custom Object Properties that may not be defined in existing Properties schemas.

      Description0..1

          StructuredTextType

The Description field is intended for use in providing a brief description of the Device.

      Device_Type0..1

          StringObjectPropertyType

The Device_Type field specifies the type of the device.

      Manufacturer0..1

          StringObjectPropertyType

The Manufacturer field specifies the manufacturer of the device.

      Model0..1

          StringObjectPropertyType

The Model field specifies the model identifier of the device.

      Serial_Number0..1

          StringObjectPropertyType

The Serial_Number field specifies the serial number of the Device.

      Firmware_Version0..1

          StringObjectPropertyType

The Firmware_Version field specifies the version of the firmware running on the device.

      System_Details0..1

          ObjectPropertiesType

The System_Details field captures the details of the system that may be present on the device. It uses the abstract ObjectPropertiesType which permits the specification of any Object; however, it is strongly recommended that the System Object or one of its subtypes be used in this context.


text:
from pprint import pprint
import twitter
import urllib
from credentials import consumer_key, consumer_secret, access_key, access_secret

auth = twitter.OAuth(access_key, access_secret, consumer_key, consumer_secret)
api= twitter.Twitter(auth = auth)

LIST_NAME = 'content'
SCREEN_NAME = 'newsstreamapp'

def get_user_ids(topic):
	topic = urllib.quote_plus(topic)
	results = api.users.search(q = topic)
	IDs = [ user["id_str"] for user in results ]
	return ','.join(IDs)

def create_list():
	result = api.lists.create(name=LIST_NAME)

def add_users(users):
	api.lists.members.create_all(
		slug=LIST_NAME,
		owner_screen_name=SCREEN_NAME,
		user_id=users
	)

def post_something():
	new_status = "testing testing"
	results = api.statuses.update(status = new_status)
	print "updated status: %s" % new_status

def update_list(topic):
	try:
		api.lists.destroy(slug=LIST_NAME, owner_screen_name=SCREEN_NAME)
	except twitter.TwitterHTTPError:
		# The list did not exist.
		pass
	create_list()
	def try_to_add():
		try:
			add_users(get_user_ids(topic))
		except twitter.TwitterHTTPError:
			# Why? We don't know.
			sleep(1)
			try_to_add()
	try_to_add()

if __name__ == "__main__":
	update_list("heavy-metal")

# https://dev.twitter.com/rest/reference/post/lists/create
#add_users(get_user_ids('webdev'))


text:
package demo.order.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import demo.domain.Address;
import demo.domain.AddressType;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.TemplateVariable;
import org.springframework.hateoas.UriTemplate;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Order {

    private Long id;
    private Long createdAt;
    private Long lastModified;
    private List<OrderEvent> orderEvents = new ArrayList<>();
    private OrderStatus status;
    private Set<LineItem> lineItems = new HashSet<>();
    private Address shippingAddress;

    private Long accountId, paymentId;

    public Order() {
        this.status = OrderStatus.ORDER_CREATED;
    }

    public Order(Long accountId, Address shippingAddress) {
        this();
        this.accountId = accountId;
        this.shippingAddress = shippingAddress;
        if (shippingAddress.getAddressType() == null)
            this.shippingAddress.setAddressType(AddressType.SHIPPING);
    }

    public Long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Long createdAt) {
        this.createdAt = createdAt;
    }

    public Long getLastModified() {
        return lastModified;
    }

    public void setLastModified(Long lastModified) {
        this.lastModified = lastModified;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public Set<LineItem> getLineItems() {
        return lineItems;
    }

    public void setLineItems(Set<LineItem> lineItems) {
        this.lineItems = lineItems;
    }

    public Address getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(Address shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public Long getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(Long paymentId) {
        this.paymentId = paymentId;
    }

    @JsonIgnore
    public List<OrderEvent> getEvents() {
        return orderEvents;
    }

    @JsonProperty("orderId")
    public Long getIdentity() {
        return id;
    }

    public void setIdentity(Long id) {
        this.id = id;
    }

    /**
     * Returns the {@link Link} with a rel of {@link Link#REL_SELF}.
     */
    public Link getId() {
        return new Link(new UriTemplate("http://order-web/v1/orders/{id}").with("id", TemplateVariable.VariableType
                .PATH_VARIABLE)
                .expand(getIdentity())
                .toString()).withSelfRel();
    }
}


text:
<?php

declare(strict_types=1);

namespace Keystone\Queue\Retry;

use PHPUnit\Framework\TestCase;

class ExponentialBackoffRetryStrategyTest extends TestCase
{
    public function testGetDelay()
    {
        $strategy = new ExponentialBackoffRetryStrategy();

        $delay = 0;
        for ($attempts = 1; $attempts < 25; ++$attempts) {
            // The delay should keep increasing
            $this->assertGreaterThan($delay, $strategy->getDelay($attempts));
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Manual of tropical medicine (London), Edn 2 828 (1913)

#### Original name
Monilia lustigii Castell. & Chalm.

### Remarks
null


text:
@category_implementation(UIImageView, ZUX)

+ (UIImageView *)imageViewWithImage:(UIImage *)image {
    return ZUX_AUTORELEASE([[self alloc] initWithImage:image]);
}

@end


text:
<?php

App::uses('CakeRoute', 'Routing/Route');
App::uses('Router', 'Routing');

/**
 * Test case for CakeRoute
 *
 * @package       Cake.Test.Case.Routing.Route
 */
class CakeRouteTest extends CakeTestCase {

/**
 * setUp method
 *
 * @return void
 */
	public function setUp() {
		parent::setUp();
		Configure::write('Routing', array('admin' => null, 'prefixes' => array()));
	}

/**
 * Test the construction of a CakeRoute
 *
 * @return void
 */
	public function testConstruction() {
		$route = new CakeRoute('/:controller/:action/:id', array(), array('id' => '[0-9]+'));

		$this->assertEquals('/:controller/:action/:id', $route->template);
		$this->assertEquals(array(), $route->defaults);
		$this->assertEquals(array('id' => '[0-9]+'), $route->options);
		$this->assertFalse($route->compiled());
	}

/**
 * test Route compiling.
 *
 * @return void
 */
	public function testBasicRouteCompiling() {
		$route = new CakeRoute('/', array('controller' => 'pages', 'action' => 'display', 'home'));
		$result = $route->compile();
		$expected = '#^/*$#';
		$this->assertEquals($expected, $result);
		$this->assertEquals(array(), $route->keys);

		$route = new CakeRoute('/:controller/:action', array('controller' => 'posts'));
		$result = $route->compile();

		$this->assertRegExp($result, '/posts/edit');
		$this->assertRegExp($result, '/posts/super_delete');
		$this->assertNotRegExp($result, '/posts');
		$this->assertNotRegExp($result, '/posts/super_delete/1');

		$route = new CakeRoute('/posts/foo:id', array('controller' => 'posts', 'action' => 'view'));
		$result = $route->compile();

		$this->assertRegExp($result, '/posts/foo:1');
		$this->assertRegExp($result, '/posts/foo:param');
		$this->assertNotRegExp($result, '/posts');
		$this->assertNotRegExp($result, '/posts/');

		$this->assertEquals(array('id'), $route->keys);

		$route = new CakeRoute('/:plugin/:controller/:action/*', array('plugin' => 'test_plugin', 'action' => 'index'));
		$result = $route->compile();
		$this->assertRegExp($result, '/test_plugin/posts/index');
		$this->assertRegExp($result, '/test_plugin/posts/edit/5');
		$this->assertRegExp($result, '/test_plugin/posts/edit/5/name:value/nick:name');
	}

/**
 * test that route parameters that overlap don't cause errors.
 *
 * @return void
 */
	public function testRouteParameterOverlap() {
		$route = new CakeRoute('/invoices/add/:idd/:id', array('controller' => 'invoices', 'action' => 'add'));
		$result = $route->compile();
		$this->assertRegExp($result, '/invoices/add/1/3');

		$route = new CakeRoute('/invoices/add/:id/:idd', array('controller' => 'invoices', 'action' => 'add'));
		$result = $route->compile();
		$this->assertRegExp($result, '/invoices/add/1/3');
	}

/**
 * test compiling routes with keys that have patterns
 *
 * @return void
 */
	public function testRouteCompilingWithParamPatterns() {
		$route = new CakeRoute(
			'/:controller/:action/:id',
			array(),
			array('id' => Router::ID)
		);
		$result = $route->compile();
		$this->assertRegExp($result, '/posts/edit/1');
		$this->assertRegExp($result, '/posts/view/518098');
		$this->assertNotRegExp($result, '/posts/edit/name-of-post');
		$this->assertNotRegExp($result, '/posts/edit/4/other:param');
		$this->assertEquals(array('controller', 'action', 'id'), $route->keys);

		$route = new CakeRoute(
			'/:lang/:controller/:action/:id',
			array('controller' => 'testing4'),
			array('id' => Router::ID, 'lang' => '[a-z]{3}')
		);
		$result = $route->compile();
		$this->assertRegExp($result, '/eng/posts/edit/1');
		$this->assertRegExp($result, '/cze/articles/view/1');
		$this->assertNotRegExp($result, '/language/articles/view/2');
		$this->assertNotRegExp($result, '/eng/articles/view/name-of-article');
		$this->assertEquals(array('lang', 'controller', 'action', 'id'), $route->keys);

		foreach (array(':', '@', ';', '$', '-') as $delim) {
			$route = new CakeRoute('/posts/:id' . $delim . ':title');
			$result = $route->compile();

			$this->assertRegExp($result, '/posts/1' . $delim . 'name-of-article');
			$this->assertRegExp($result, '/posts/13244' . $delim . 'name-of_Article[]');
			$this->assertNotRegExp($result, '/posts/11!nameofarticle');
			$this->assertNotRegExp($result, '/posts/11');

			$this->assertEquals(array('id', 'title'), $route->keys);
		}

		$route = new CakeRoute(
			'/posts/:id::title/:year',
			array('controller' => 'posts', 'action' => 'view'),
			array('id' => Router::ID, 'year' => Router::YEAR, 'title' => '[a-z-_]+')
		);
		$result = $route->compile();
		$this->assertRegExp($result, '/posts/1:name-of-article/2009/');
		$this->assertRegExp($result, '/posts/13244:name-of-article/1999');
		$this->assertNotRegExp($result, '/posts/hey_now:nameofarticle');
		$this->assertNotRegExp($result, '/posts/:nameofarticle/2009');
		$this->assertNotRegExp($result, '/posts/:nameofarticle/01');
		$this->assertEquals(array('id', 'title', 'year'), $route->keys);

		$route = new CakeRoute(
			'/posts/:url_title-(uuid::id)',
			array('controller' => 'posts', 'action' => 'view'),
			array('pass' => array('id', 'url_title'), 'id' => Router::ID)
		);
		$result = $route->compile();
		$this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)/');
		$this->assertRegExp($result, '/posts/some_title_for_article-(uuid:12534)');
		$this->assertNotRegExp($result, '/posts/');
		$this->assertNotRegExp($result, '/posts/nameofarticle');
		$this->assertNotRegExp($result, '/posts/nameofarticle-12347');
		$this->assertEquals(array('url_title', 'id'), $route->keys);
	}

/**
 * test more complex route compiling & parsing with mid route greedy stars
 * and optional routing parameters
 *
 * @return void
 */
	public function testComplexRouteCompilingAndParsing() {
		$route = new CakeRoute(
			'/posts/:month/:day/:year/*',
			array('controller' => 'posts', 'action' => 'view'),
			array('year' => Router::YEAR, 'month' => Router::MONTH, 'day' => Router::DAY)
		);
		$result = $route->compile();
		$this->assertRegExp($result, '/posts/08/01/2007/title-of-post');
		$result = $route->parse('/posts/08/01/2007/title-of-post');

		$this->assertEquals(7, count($result));
		$this->assertEquals('posts', $result['controller']);
		$this->assertEquals('view', $result['action']);
		$this->assertEquals('2007', $result['year']);
		$this->assertEquals('08', $result['month']);
		$this->assertEquals('01', $result['day']);
		$this->assertEquals('title-of-post', $result['pass'][0]);

		$route = new CakeRoute(
			"/:extra/page/:slug/*",
			array('controller' => 'pages', 'action' => 'view', 'extra' => null),
			array("extra" => '[a-z1-9_]*', "slug" => '[a-z1-9_]+', "action" => 'view')
		);
		$result = $route->compile();

		$this->assertRegExp($result, '/some_extra/page/this_is_the_slug');
		$this->assertRegExp($result, '/page/this_is_the_slug');
		$this->assertEquals(array('extra', 'slug'), $route->keys);
		$this->assertEquals(array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'), $route->options);
		$expected = array(
			'controller' => 'pages',
			'action' => 'view'
		);
		$this->assertEquals($expected, $route->defaults);

		$route = new CakeRoute(
			'/:controller/:action/*',
			array('project' => false),
			array(
				'controller' => 'source|wiki|commits|tickets|comments|view',
				'action' => 'branches|history|branch|logs|view|start|add|edit|modify'
			)
		);
		$this->assertFalse($route->parse('/chaw_test/wiki'));

		$result = $route->compile();
		$this->assertNotRegExp($result, '/some_project/source');
		$this->assertRegExp($result, '/source/view');
		$this->assertRegExp($result, '/source/view/other/params');
		$this->assertNotRegExp($result, '/chaw_test/wiki');
		$this->assertNotRegExp($result, '/source/wierd_action');
	}

/**
 * test that routes match their pattern.
 *
 * @return void
 */
	public function testMatchBasic() {
		$route = new CakeRoute('/:controller/:action/:id', array('plugin' => null));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null));
		$this->assertFalse($result);

		$result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 0));
		$this->assertFalse($result);

		$result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 1));
		$this->assertEquals('/posts/view/1', $result);

		$route = new CakeRoute('/', array('controller' => 'pages', 'action' => 'display', 'home'));
		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 'home'));
		$this->assertEquals('/', $result);

		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about'));
		$this->assertFalse($result);

		$route = new CakeRoute('/pages/*', array('controller' => 'pages', 'action' => 'display'));
		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 'home'));
		$this->assertEquals('/pages/home', $result);

		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about'));
		$this->assertEquals('/pages/about', $result);

		$route = new CakeRoute('/blog/:action', array('controller' => 'posts'));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view'));
		$this->assertEquals('/blog/view', $result);

		$result = $route->match(array('controller' => 'nodes', 'action' => 'view'));
		$this->assertFalse($result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 1));
		$this->assertFalse($result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'id' => 2));
		$this->assertFalse($result);

		$route = new CakeRoute('/foo/:controller/:action', array('action' => 'index'));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view'));
		$this->assertEquals('/foo/posts/view', $result);

		$route = new CakeRoute('/:plugin/:id/*', array('controller' => 'posts', 'action' => 'view'));
		$result = $route->match(array('plugin' => 'test', 'controller' => 'posts', 'action' => 'view', 'id' => '1'));
		$this->assertEquals('/test/1/', $result);

		$result = $route->match(array('plugin' => 'fo', 'controller' => 'posts', 'action' => 'view', 'id' => '1', '0'));
		$this->assertEquals('/fo/1/0', $result);

		$result = $route->match(array('plugin' => 'fo', 'controller' => 'nodes', 'action' => 'view', 'id' => 1));
		$this->assertFalse($result);

		$result = $route->match(array('plugin' => 'fo', 'controller' => 'posts', 'action' => 'edit', 'id' => 1));
		$this->assertFalse($result);

		$route = new CakeRoute('/admin/subscriptions/:action/*', array(
			'controller' => 'subscribe', 'admin' => true, 'prefix' => 'admin'
		));

		$url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'edit', 1);
		$result = $route->match($url);
		$expected = '/admin/subscriptions/edit/1';
		$this->assertEquals($expected, $result);

		$url = array(
			'controller' => 'subscribe',
			'admin' => true,
			'action' => 'edit_admin_e',
			1
		);
		$result = $route->match($url);
		$expected = '/admin/subscriptions/edit_admin_e/1';
		$this->assertEquals($expected, $result);
	}

/**
 * test that non-greedy routes fail with extra passed args
 *
 * @return void
 */
	public function testGreedyRouteFailurePassedArg() {
		$route = new CakeRoute('/:controller/:action', array('plugin' => null));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view', '0'));
		$this->assertFalse($result);

		$route = new CakeRoute('/:controller/:action', array('plugin' => null));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'test'));
		$this->assertFalse($result);
	}

/**
 * test that non-greedy routes fail with extra passed args
 *
 * @return void
 */
	public function testGreedyRouteFailureNamedParam() {
		$route = new CakeRoute('/:controller/:action', array('plugin' => null));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'page' => 1));
		$this->assertFalse($result);
	}

/**
 * test that falsey values do not interrupt a match.
 *
 * @return void
 */
	public function testMatchWithFalseyValues() {
		$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));
		$result = $route->match(array(
			'controller' => 'posts', 'action' => 'index', 'plugin' => null, 'admin' => false
		));
		$this->assertEquals('/posts/index/', $result);
	}

/**
 * test match() with greedy routes, named parameters and passed args.
 *
 * @return void
 */
	public function testMatchWithNamedParametersAndPassedArgs() {
		Router::connectNamed(true);

		$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));
		$result = $route->match(array('controller' => 'posts', 'action' => 'index', 'plugin' => null, 'page' => 1));
		$this->assertEquals('/posts/index/page:1', $result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 5));
		$this->assertEquals('/posts/view/5', $result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 0));
		$this->assertEquals('/posts/view/0', $result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, '0'));
		$this->assertEquals('/posts/view/0', $result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 5, 'page' => 1, 'limit' => 20, 'order' => 'title'));
		$this->assertEquals('/posts/view/5/page:1/limit:20/order:title', $result);

		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 'word space', 'order' => 'Θ'));
		$this->assertEquals('/posts/view/word%20space/order:%CE%98', $result);

		$route = new CakeRoute('/test2/*', array('controller' => 'pages', 'action' => 'display', 2));
		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 1));
		$this->assertFalse($result);

		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 2, 'something'));
		$this->assertEquals('/test2/something', $result);

		$result = $route->match(array('controller' => 'pages', 'action' => 'display', 5, 'something'));
		$this->assertFalse($result);
	}

/**
 * Ensure that named parameters are urldecoded
 *
 * @return void
 */
	public function testParseNamedParametersUrlDecode() {
		Router::connectNamed(true);
		$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));

		$result = $route->parse('/posts/index/page:%CE%98');
		$this->assertEquals('Θ', $result['named']['page']);

		$result = $route->parse('/posts/index/page[]:%CE%98');
		$this->assertEquals('Θ', $result['named']['page'][0]);

		$result = $route->parse('/posts/index/something%20else/page[]:%CE%98');
		$this->assertEquals('Θ', $result['named']['page'][0]);
		$this->assertEquals('something else', $result['pass'][0]);
	}

/**
 * Ensure that keys at named parameters are urldecoded
 *
 * @return void
 */
	public function testParseNamedKeyUrlDecode() {
		Router::connectNamed(true);
		$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));

		// checking /post/index/user[0]:a/user[1]:b
		$result = $route->parse('/posts/index/user%5B0%5D:a/user%5B1%5D:b');
		$this->assertArrayHasKey('user', $result['named']);
		$this->assertEquals(array('a', 'b'), $result['named']['user']);

		// checking /post/index/user[]:a/user[]:b
		$result = $route->parse('/posts/index/user%5B%5D:a/user%5B%5D:b');
		$this->assertArrayHasKey('user', $result['named']);
		$this->assertEquals(array('a', 'b'), $result['named']['user']);
	}

/**
 * test that named params with null/false are excluded
 *
 * @return void
 */
	public function testNamedParamsWithNullFalse() {
		$route = new CakeRoute('/:controller/:action/*');
		$result = $route->match(array('controller' => 'posts', 'action' => 'index', 'page' => null, 'sort' => false));
		$this->assertEquals('/posts/index/', $result);
	}

/**
 * test that match with patterns works.
 *
 * @return void
 */
	public function testMatchWithPatterns() {
		$route = new CakeRoute('/:controller/:action/:id', array('plugin' => null), array('id' => '[0-9]+'));
		$result = $route->match(array('controller' => 'posts', 'action' => 'view', 'id' => 'foo'));
		$this->assertFalse($result);

		$result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => '9'));
		$this->assertEquals('/posts/view/9', $result);

		$result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => '922'));
		$this->assertEquals('/posts/view/922', $result);

		$result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 'a99'));
		$this->assertFalse($result);
	}

/**
 * test persistParams ability to persist parameters from $params and remove params.
 *
 * @return void
 */
	public function testPersistParams() {
		$route = new CakeRoute(
			'/:lang/:color/blog/:action',
			array('controller' => 'posts'),
			array('persist' => array('lang', 'color'))
		);
		$url = array('controller' => 'posts', 'action' => 'index');
		$params = array('lang' => 'en', 'color' => 'blue');
		$result = $route->persistParams($url, $params);
		$this->assertEquals('en', $result['lang']);
		$this->assertEquals('blue', $result['color']);

		$url = array('controller' => 'posts', 'action' => 'index', 'color' => 'red');
		$params = array('lang' => 'en', 'color' => 'blue');
		$result = $route->persistParams($url, $params);
		$this->assertEquals('en', $result['lang']);
		$this->assertEquals('red', $result['color']);
	}

/**
 * test the parse method of CakeRoute.
 *
 * @return void
 */
	public function testParse() {
		$route = new CakeRoute(
			'/:controller/:action/:id',
			array('controller' => 'testing4', 'id' => null),
			array('id' => Router::ID)
		);
		$route->compile();
		$result = $route->parse('/posts/view/1');
		$this->assertEquals('posts', $result['controller']);
		$this->assertEquals('view', $result['action']);
		$this->assertEquals('1', $result['id']);

		$route = new Cakeroute(
			'/admin/:controller',
			array('prefix' => 'admin', 'admin' => 1, 'action' => 'index')
		);
		$route->compile();
		$result = $route->parse('/admin/');
		$this->assertFalse($result);

		$result = $route->parse('/admin/posts');
		$this->assertEquals('posts', $result['controller']);
		$this->assertEquals('index', $result['action']);
	}

/**
 * Test that :key elements are urldecoded
 *
 * @return void
 */
	public function testParseUrlDecodeElements() {
		$route = new Cakeroute(
			'/:controller/:slug',
			array('action' => 'view')
		);
		$route->compile();
		$result = $route->parse('/posts/%E2%88%82%E2%88%82');
		$this->assertEquals('posts', $result['controller']);
		$this->assertEquals('view', $result['action']);
		$this->assertEquals('∂∂', $result['slug']);

		$result = $route->parse('/posts/∂∂');
		$this->assertEquals('posts', $result['controller']);
		$this->assertEquals('view', $result['action']);
		$this->assertEquals('∂∂', $result['slug']);
	}

/**
 * test numerically indexed defaults, get appended to pass
 *
 * @return void
 */
	public function testParseWithPassDefaults() {
		$route = new Cakeroute('/:controller', array('action' => 'display', 'home'));
		$result = $route->parse('/posts');
		$expected = array(
			'controller' => 'posts',
			'action' => 'display',
			'pass' => array('home'),
			'named' => array()
		);
		$this->assertEquals($expected, $result);
	}

/**
 * test that http header conditions can cause route failures.
 *
 * @return void
 */
	public function testParseWithHttpHeaderConditions() {
		$_SERVER['REQUEST_METHOD'] = 'GET';
		$route = new CakeRoute('/sample', array('controller' => 'posts', 'action' => 'index', '[method]' => 'POST'));

		$this->assertFalse($route->parse('/sample'));
	}

/**
 * test that patterns work for :action
 *
 * @return void
 */
	public function testPatternOnAction() {
		$route = new CakeRoute(
			'/blog/:action/*',
			array('controller' => 'blog_posts'),
			array('action' => 'other|actions')
		);
		$result = $route->match(array('controller' => 'blog_posts', 'action' => 'foo'));
		$this->assertFalse($result);

		$result = $route->match(array('controller' => 'blog_posts', 'action' => 'actions'));
		$this->assertNotEmpty($result);

		$result = $route->parse('/blog/other');
		$expected = array('controller' => 'blog_posts', 'action' => 'other', 'pass' => array(), 'named' => array());
		$this->assertEquals($expected, $result);

		$result = $route->parse('/blog/foobar');
		$this->assertFalse($result);
	}

/**
 * test the parseArgs method
 *
 * @return void
 */
	public function testParsePassedArgument() {
		$route = new CakeRoute('/:controller/:action/*');
		$result = $route->parse('/posts/edit/1/2/0');
		$expected = array(
			'controller' => 'posts',
			'action' => 'edit',
			'pass' => array('1', '2', '0'),
			'named' => array()
		);
		$this->assertEquals($expected, $result);

		$result = $route->parse('/posts/edit/a-string/page:1/sort:value');
		$expected = array(
			'controller' => 'posts',
			'action' => 'edit',
			'pass' => array('a-string'),
			'named' => array(
				'page' => 1,
				'sort' => 'value'
			)
		);
		$this->assertEquals($expected, $result);
	}

/**
 * test that only named parameter rules are followed.
 *
 * @return void
 */
	public function testParseNamedParametersWithRules() {
		$route = new CakeRoute('/:controller/:action/*', array(), array(
			'named' => array(
				'wibble',
				'fish' => array('action' => 'index'),
				'fizz' => array('controller' => array('comments', 'other')),
				'pattern' => 'val-[\d]+'
			)
		));
		$result = $route->parse('/posts/display/wibble:spin/fish:trout/fizz:buzz/unknown:value');
		$expected = array(
			'controller' => 'posts',
			'action' => 'display',
			'pass' => array('fish:trout', 'fizz:buzz', 'unknown:value'),
			'named' => array(
				'wibble' => 'spin'
			)
		);
		$this->assertEquals($expected, $result, 'Fish should not be parsed, as action != index');

		$result = $route->parse('/posts/index/wibble:spin/fish:trout/fizz:buzz');
		$expected = array(
			'controller' => 'posts',
			'action' => 'index',
			'pass' => array('fizz:buzz'),
			'named' => array(
				'wibble' => 'spin',
				'fish' => 'trout'
			)
		);
		$this->assertEquals($expected, $result, 'Fizz should be parsed, as controller == comments|other');

		$result = $route->parse('/comments/index/wibble:spin/fish:trout/fizz:buzz');
		$expected = array(
			'controller' => 'comments',
			'action' => 'index',
			'pass' => array(),
			'named' => array(
				'wibble' => 'spin',
				'fish' => 'trout',
				'fizz' => 'buzz'
			)
		);
		$this->assertEquals($expected, $result, 'All params should be parsed as conditions were met.');

		$result = $route->parse('/comments/index/pattern:val--');
		$expected = array(
			'controller' => 'comments',
			'action' => 'index',
			'pass' => array('pattern:val--'),
			'named' => array()
		);
		$this->assertEquals($expected, $result, 'Named parameter pattern unmet.');

		$result = $route->parse('/comments/index/pattern:val-2');
		$expected = array(
			'controller' => 'comments',
			'action' => 'index',
			'pass' => array(),
			'named' => array('pattern' => 'val-2')
		);
		$this->assertEquals($expected, $result, 'Named parameter pattern met.');
	}

/**
 * test that greedyNamed ignores rules.
 *
 * @return void
 */
	public function testParseGreedyNamed() {
		$route = new CakeRoute('/:controller/:action/*', array(), array(
			'named' => array(
				'fizz' => array('controller' => 'comments'),
				'pattern' => 'val-[\d]+',
			),
			'greedyNamed' => true
		));
		$result = $route->parse('/posts/display/wibble:spin/fizz:buzz/pattern:ignored');
		$expected = array(
			'controller' => 'posts',
			'action' => 'display',
			'pass' => array('fizz:buzz', 'pattern:ignored'),
			'named' => array(
				'wibble' => 'spin',
			)
		);
		$this->assertEquals($expected, $result, 'Greedy named grabs everything, rules are followed');
	}

/**
 * Having greedNamed enabled should not capture routing.prefixes.
 *
 * @return void
 */
	public function testMatchGreedyNamedExcludesPrefixes() {
		Configure::write('Routing.prefixes', array('admin'));
		Router::reload();

		$route = new CakeRoute('/sales/*', array('controller' => 'sales', 'action' => 'index'));
		$this->assertFalse($route->match(array('controller' => 'sales', 'action' => 'index', 'admin' => 1)), 'Greedy named consume routing prefixes.');
	}

/**
 * test that parsing array format named parameters works
 *
 * @return void
 */
	public function testParseArrayNamedParameters() {
		$route = new CakeRoute('/:controller/:action/*');
		$result = $route->parse('/tests/action/var[]:val1/var[]:val2');
		$expected = array(
			'controller' => 'tests',
			'action' => 'action',
			'named' => array(
				'var' => array(
					'val1',
					'val2'
				)
			),
			'pass' => array(),
		);
		$this->assertEquals($expected, $result);

		$result = $route->parse('/tests/action/theanswer[is]:42/var[]:val2/var[]:val3');
		$expected = array(
			'controller' => 'tests',
			'action' => 'action',
			'named' => array(
				'theanswer' => array(
					'is' => 42
				),
				'var' => array(
					'val2',
					'val3'
				)
			),
			'pass' => array(),
		);
		$this->assertEquals($expected, $result);

		$result = $route->parse('/tests/action/theanswer[is][not]:42/theanswer[]:5/theanswer[is]:6');
		$expected = array(
			'controller' => 'tests',
			'action' => 'action',
			'named' => array(
				'theanswer' => array(
					5,
					'is' => array(
						6,
						'not' => 42
					)
				),
			),
			'pass' => array(),
		);
		$this->assertEquals($expected, $result);
	}

/**
 * Test that match can handle array named parameters
 *
 * @return void
 */
	public function testMatchNamedParametersArray() {
		$route = new CakeRoute('/:controller/:action/*');

		$url = array(
			'controller' => 'posts',
			'action' => 'index',
			'filter' => array(
				'one',
				'model' => 'value'
			)
		);
		$result = $route->match($url);
		$expected = '/posts/index/filter%5B0%5D:one/filter%5Bmodel%5D:value';
		$this->assertEquals($expected, $result);

		$url = array(
			'controller' => 'posts',
			'action' => 'index',
			'filter' => array(
				'one',
				'model' => array(
					'two',
					'order' => 'field'
				)
			)
		);
		$result = $route->match($url);
		$expected = '/posts/index/filter%5B0%5D:one/filter%5Bmodel%5D%5B0%5D:two/filter%5Bmodel%5D%5Border%5D:field';
		$this->assertEquals($expected, $result);
	}

/**
 * test restructuring args with pass key
 *
 * @return void
 */
	public function testPassArgRestructure() {
		$route = new CakeRoute('/:controller/:action/:slug', array(), array(
			'pass' => array('slug')
		));
		$result = $route->parse('/posts/view/my-title');
		$expected = array(
			'controller' => 'posts',
			'action' => 'view',
			'slug' => 'my-title',
			'pass' => array('my-title'),
			'named' => array()
		);
		$this->assertEquals($expected, $result, 'Slug should have moved');
	}

/**
 * Test the /** special type on parsing.
 *
 * @return void
 */
	public function testParseTrailing() {
		$route = new CakeRoute('/:controller/:action/**');
		$result = $route->parse('/posts/index/1/2/3/foo:bar');
		$expected = array(
			'controller' => 'posts',
			'action' => 'index',
			'pass' => array('1/2/3/foo:bar'),
			'named' => array()
		);
		$this->assertEquals($expected, $result);

		$result = $route->parse('/posts/index/http://example.com');
		$expected = array(
			'controller' => 'posts',
			'action' => 'index',
			'pass' => array('http://example.com'),
			'named' => array()
		);
		$this->assertEquals($expected, $result);
	}

/**
 * Test the /** special type on parsing - UTF8.
 *
 * @return void
 */
	public function testParseTrailingUTF8() {
		$route = new CakeRoute('/category/**', array('controller' => 'categories','action' => 'index'));
		$result = $route->parse('/category/%D9%85%D9%88%D8%A8%D8%A7%DB%8C%D9%84');
		$expected = array(
			'controller' => 'categories',
			'action' => 'index',
			'pass' => array('موبایل'),
			'named' => array()
		);
		$this->assertEquals($expected, $result);
	}

/**
 * test that utf-8 patterns work for :section
 *
 * @return void
 */
	public function testUTF8PatternOnSection() {
		$route = new CakeRoute(
			'/:section',
			array('plugin' => 'blogs', 'controller' => 'posts' , 'action' => 'index' ),
			array(
				'persist' => array('section'),
				'section' => 'آموزش|weblog'
			)
		);

		$result = $route->parse('/%D8%A2%D9%85%D9%88%D8%B2%D8%B4');
		$expected = array('section' => 'آموزش', 'plugin' => 'blogs', 'controller' => 'posts', 'action' => 'index', 'pass' => array(), 'named' => array());
		$this->assertEquals($expected, $result);

		$result = $route->parse('/weblog');
		$expected = array('section' => 'weblog', 'plugin' => 'blogs', 'controller' => 'posts', 'action' => 'index', 'pass' => array(), 'named' => array());
		$this->assertEquals($expected, $result);
	}
}


text:
#import "CollectionsEditingManyCellsExampleSupplemental.h"

static const NSInteger kSectionCount = 25;
static const NSInteger kSectionItemCount = 50;

@implementation CollectionsEditingManyCellsExample

- (void)viewDidLoad {
  [super viewDidLoad];

  // Add button to toggle edit mode.
  [self updatedRightBarButtonItem:NO];

  // Register cell class.
  [self.collectionView registerClass:[MDCCollectionViewTextCell class]
          forCellWithReuseIdentifier:kCollectionsEditingManyCellsCellIdentifierItem];
  // Optional
  // Register section header class
  [self.collectionView registerClass:[MDCCollectionViewTextCell class]
          forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
                 withReuseIdentifier:kCollectionsEditingManyCellsHeaderReuseIdentifier];

  // Populate content.
  self.content = [NSMutableArray array];
  for (NSInteger i = 0; i < kSectionCount; i++) {
    NSMutableArray *items = [NSMutableArray array];
    for (NSInteger j = 0; j < kSectionItemCount; j++) {
      NSString *itemString = [NSString stringWithFormat:@"Section-%02zd Item-%02zd", i, j];
      [items addObject:itemString];
    }
    [self.content addObject:items];
  }

  // Customize collection view settings.
  self.styler.cellStyle = MDCCollectionViewCellStyleCard;
}

- (void)updatedRightBarButtonItem:(BOOL)isEditing {
  self.navigationItem.rightBarButtonItem =
      [[UIBarButtonItem alloc] initWithTitle:isEditing ? @"Cancel" : @"Edit"
                                       style:UIBarButtonItemStyleDone
                                      target:self
                                      action:@selector(toggleEditMode:)];
}

- (void)toggleEditMode:(id)sender {
  BOOL isEditing = self.editor.isEditing;
  [self updatedRightBarButtonItem:!isEditing];
  [self.editor setEditing:!isEditing animated:YES];
}

@end


text:
Browserify has been one of the staple tools for packaging javascript and
shipping it to the browser. In this talk Yosh will explain browserify's
internals, the current state of tooling and the path that's currently set for
the future.


text:
/** vim: et:ts=4:sw=4:sts=4
 * @license This is a  LICENSE COMMENT that should be preserved.
 * Available via the MIT or new BSD license.
 * see: http://example.com/license for details
 */

define({
    //@license comment to be found
    name: 'license'
});


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pages extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */

	public function index()
	{
		$this->load->model("posts_model");
		$data["posts"] = $this->posts_model->getAllPosts();
		$data["categories"] = $this->posts_model->getCategories();
		$data["categoryOfPosts"] = $this->posts_model->getCategoryOfAllPosts();
		$data["about"] = $this->posts_model->getAbout();
		//echo "<pre>";
		//print_r($data);

		$header["title"] = "Anasayfa";
		$this->load->view("template/header.html" , $header);
		$this->load->view('template/index.html', $data);
		$this->load->view('template/footer.html');

	}

	public function about()
	{
		$this->load->model('posts_model');
		$data["posts"] = $this->posts_model->getAllPosts();
		$data["categories"] = $this->posts_model->getCategories();
		$data["categoryOfPosts"] = $this->posts_model->getCategoryOfAllPosts();
		$data["about"] = $this->posts_model->getAbout();
		$header["title"] = "Hakkında";
		$this->load->view("template/header.html" , $header);
		$this->load->view('template/about.html', $data);
		$this->load->view('template/footer.html');
	}

	public function readPostForUser($categoryOfPost, $postID)
	{
		$this->load->model("posts_model");
		$result = $this->posts_model->getPost($postID);
		$post = $result[0];
		$categories = $this->posts_model->getCategories();
		$data = array(
			'title' => $post->title,
			'postContent' =>  $post->postContent,
			'date' => $post->date,
			'categoryID' => $post->categoryID,
			'categoryOfPost' => $categoryOfPost,
			'postID' => $post->postID,
			'categories' => $categories,
			'about' => $this->posts_model->getAbout(),
			'comments' => $this->posts_model->getCommentsInPost($postID)
			);
		$header["title"] = $post->title;
		$this->load->view("template/header.html" , $header);
		$this->load->view("template/readpostforuser_view.html", $data);
		$this->load->view('template/footer.html');
	}

	public function postsInCategory($categoryID)
	{
		$this->load->model("posts_model");
		$data["postsInCategory"] = $this->posts_model->getPostsInCategory($categoryID);
		$data["categories"] = $this->posts_model->getCategories();
		$data["about"] = $this->posts_model->getAbout();
		$data["category"] = $this->posts_model->getCategory($categoryID);

		//echo "<pre>"; print_r($data);
		$header["title"] = $data["category"][0]->categoryName;
		$this->load->view("template/header.html" , $header);
		$this->load->view("template/postsInCategory_view.html", $data);
		$this->load->view('template/footer.html');
	}
	public function contact()
	{
		$this->load->model("posts_model");
		$data["categories"] = $this->posts_model->getCategories();
		$data["about"] = $this->posts_model->getAbout();
		$header["title"] = "İletişim";
		$this->load->view("template/header.html" , $header);
		$this->load->view('template/contact.html',$data);
		$this->load->view('template/footer.html');
	}

	public function addCommentForPost()
	{
		if ($_POST)
		{
			$name = $this->input->post("name");
			$e_mail = $this->input->post("email");
			$comment = $this->input->post("comment");
			$postID = $this->input->post("postID");
			$categoryOfPost = $this->input->post("categoryOfPost");

			if (empty($name) || empty($e_mail) || empty($comment) ) {
					$header["title"] = "Comment Error";
					$this->load->view("template/header.html", $header);
					$information["content"] = "**Lütfen tüm alanları doldurunuz";
					$this->load->view("template/informationForUser_view.html", $information);
					$this->load->model("posts_model");
					$data["categories"] = $this->posts_model->getCategories();
					$data["about"] = $this->posts_model->getAbout();
					$this->load->view("template/footer.html", $data);
			}
			else{
				$data = array($name, $e_mail, $comment, $postID);
				$this->load->model("posts_model");
				$add = $this->posts_model->addComment($data);

				if ($add)
				{	/*
					$header["title"] = "Başarılı";
					$this->load->view("template/header.html", $header);
					$information["content"] = "Yorumunuz başarıyla gönderildi. ";
					$this->load->view("template/informationForUser_view.html", $information);
					$data["categories"] = $this->posts_model->getCategories();
					$data["about"] = $this->posts_model->getAbout();
					$this->load->view("template/footer.html", $data);
*/
					//$this->load->view("template/readpostforuser_view.html");
				//controller'da readPostForUser'ın içeriği
					$result = $this->posts_model->getPost($postID);
					$post = $result[0];
					$categories = $this->posts_model->getCategories();
					$data = array(
						'title' => $post->title,
						'postContent' =>  $post->postContent,
						'date' => $post->date,
						'categoryID' => $post->categoryID,
						'categoryOfPost' => $categoryOfPost,
						'postID' => $post->postID,
						'categories' => $categories,
						'about' => $this->posts_model->getAbout(),
						'comments' => $this->posts_model->getCommentsInPost($postID)
						);
					$header["title"] = $post->title;
					$this->load->view("template/header.html" , $header);
					$this->load->view("template/readpostforuser_view.html", $data);
					$this->load->view('template/footer.html');
				}
				else
				{
					$header["title"] = "Error";
					$this->load->view("template/header.html", $header);
					$information["content"] = "Yorumunuz gönderilemedi. ";
					$this->load->view("template/informationForUser_view.html", $information);
					$data["categories"] = $this->posts_model->getCategories();
					$data["about"] = $this->posts_model->getAbout();
					$this->load->view("template/footer.html", $data);
				}
			}
		}
		else
			echo "Giris yasak.";
	}

	public function page()
	{
		$this->load->view('page.html');
	}
}


text:
using Pixie.Markup;

namespace Pixie.Terminal.Render
{
    /// <summary>
    /// A markup node renderer for degradable text nodes.
    /// </summary>
    public sealed class DegradableTextRenderer : NodeRenderer
    {
        private DegradableTextRenderer() { }

        /// <summary>
        /// An instance of a degradable text node renderer.
        /// </summary>
        public static readonly DegradableTextRenderer Instance = new DegradableTextRenderer();

        /// <inheritdoc/>
        public override bool CanRender(MarkupNode node)
        {
            return node is DegradableText;
        }

        /// <inheritdoc/>
        public override void Render(MarkupNode node, RenderState state)
        {
            var degradableText = (DegradableText)node;
            if (state.Terminal.CanRender(degradableText.Contents))
            {
                state.Terminal.Write(degradableText.Contents);
            }
            else
            {
                state.Render(degradableText.Fallback);
            }
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VPKArchive</title>
<meta name="date" content="2015-09-17">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

info.ata4.vpk

Class VPKArchive

java.lang.Object

info.ata4.vpk.VPKArchive

public class VPKArchive
extends java.lang.Object

VPK archive class.

Field Summary

Fields

Modifier and Type
Field and Description

static int
SIGNATURE

static int
VERS_MAX

static int
VERS_MIN

Constructor Summary

Constructors

Constructor and Description

VPKArchive()

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
clear()

Clears all loaded entries from this archive instance.

java.util.List<VPKEntry>
getEntries()

Returns a list of all VPK entries.

java.util.List<VPKEntry>
getEntriesForDir(java.lang.String dir)

Returns a list of all VPK entries for the given directory.

java.util.List<VPKEntry>
getEntriesForType(java.lang.String type)

Returns a list of all VPK entries for the given file type/extension.

VPKEntry
getEntry(java.lang.String path)

Returns the VPK entry for the given path.

int
getVersion()

Returns the version number of this VPK archive.

boolean
isMultiChunk()

Returns true if this archive is split up into multiple chunk files.

void
load(java.io.File file)

Loads all entries from a VPK archive file.

void
setMultiChunk(boolean multiChunk)

Sets if this archive should split up into multiple chunk files.

void
setVersion(int version)

Sets a new version number for this VPK archive.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

SIGNATURE

public static final int SIGNATURE

See Also:

Constant Field Values

VERS_MIN

public static final int VERS_MIN

See Also:

Constant Field Values

VERS_MAX

public static final int VERS_MAX

See Also:

Constant Field Values

Constructor Detail

VPKArchive

public VPKArchive()

Method Detail

load

public void load(java.io.File file)
          throws VPKException,
                 java.io.IOException

Loads all entries from a VPK archive file.

Parameters:

file - VPK archive file. For multichunk archives, this must be the
             "_dir" index file.

Throws:

java.io.IOException - when the archive can't be read correctly

VPKException - when a VPK file format error occured

getEntries

public java.util.List<VPKEntry> getEntries()

Returns a list of all VPK entries.

Returns:

VPK entry list

getEntriesForDir

public java.util.List<VPKEntry> getEntriesForDir(java.lang.String dir)

Returns a list of all VPK entries for the given directory. If the directory
 isn't used, null will be returned.

Parameters:

dir - directory path

Returns:

VPK entry list inside the given directory

getEntriesForType

public java.util.List<VPKEntry> getEntriesForType(java.lang.String type)

Returns a list of all VPK entries for the given file type/extension. If
 the type isn't used, null will be returned.

Parameters:

type - file type

Returns:

VPK entry list of the given type

getEntry

public VPKEntry getEntry(java.lang.String path)

Returns the VPK entry for the given path. If no entry with the path exists,
 null will be returned.

Parameters:

path - full file path

Returns:

VPK entry for this path

getVersion

public int getVersion()

Returns the version number of this VPK archive.

Returns:

VPK version

setVersion

public void setVersion(int version)

Sets a new version number for this VPK archive.

Parameters:

version - new version number

Throws:

java.lang.IllegalArgumentException - if the version number is outside the
                                  allowed range

isMultiChunk

public boolean isMultiChunk()

Returns true if this archive is split up into multiple chunk files.

Returns:

true if this is a multi-chunk archive

setMultiChunk

public void setMultiChunk(boolean multiChunk)

Sets if this archive should split up into multiple chunk files.

Parameters:

multiChunk - multi-chunk flag

clear

public void clear()

Clears all loaded entries from this archive instance. This won't effect any data.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method