text:
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"

require_relative '../common'
require 'mocha/setup'
require 'pty'
require 'expect'

module IntegrationTestHelpers
  VERBOSE = false
  def sh(command)
    puts "$ #{command}" if VERBOSE
    res = system(command)
    status = $?
    raise "Command: #{command} failed:#{status.exitstatus}" unless res
  end

  def tmpdir(&block)
    Dir.mktmpdir do |dir|
      yield(dir)
    end
  end

  def set_authorized_key(user, pubkey)
    authorized_key = "/home/#{user}/.ssh/authorized_keys"
    sh "sudo cp #{pubkey} #{authorized_key}"
    sh "sudo chown #{user} #{authorized_key}"
    sh "sudo chmod 0744 #{authorized_key}"
  end

  def sign_user_key(user, pubkey)
    cert = "/etc/ssh/users_ca"
    sh "sudo ssh-keygen -s #{cert} -I user_#{user} -n #{user} -V +52w #{pubkey}"
  end

  def with_agent(&block)
    puts "/usr/bin/ssh-agent -c" if VERBOSE
    agent_out = `/usr/bin/ssh-agent -c`
    agent_out.split("\n").each do |line|
      if line =~ /setenv (\S+) (\S+);/
        ENV[$1] = $2
        puts "ENV[#{$1}]=#{$2}" if VERBOSE
      end
    end
    begin
      yield
    ensure
      sh "/usr/bin/ssh-agent -k > /dev/null"
    end
  end

  def ssh_add(key, password)
    command = "ssh-add #{key}"
    status = nil
    PTY.spawn(command) do |reader, writer, pid|
      begin
        reader.expect(/Enter passphrase for .*:/) { |data| puts data }
        writer.puts(password)
        until reader.eof? do
          line = reader.readline
          puts line if VERBOSE
        end
      rescue Errno::EIO => _e
      end
      pid, status = Process.wait2 pid
    end
    raise "Command: #{command} failed:#{status.exitstatus}" unless status

    status.exitstatus
  end

  def with_sshd_config(sshd_config, &block)
    raise "Failed to copy config" unless system("sudo cp -f /etc/ssh/sshd_config /etc/ssh/sshd_config.original")

    begin
      Tempfile.open('sshd_config') do |f|
        f.write(sshd_config)
        f.close
        system("sudo cp -f #{f.path} /etc/ssh/sshd_config")
      end
      system("sudo chmod 0644 /etc/ssh/sshd_config")
      raise "Failed to restart sshd" unless system("sudo service ssh restart")

      yield
    ensure
      system("sudo cp -f /etc/ssh/sshd_config.original /etc/ssh/sshd_config")
      system("sudo service ssh restart")
    end
  end

  def with_lines_as_tempfile(lines = [], add_pid: true, debug: false, &block)
    Tempfile.open('sshd_config') do |f|
      f.write(lines.join("\n"))
      pidpath = nil
      if add_pid
        pidpath = f.path + '.pid'
        f.write("\nPidFile #{pidpath}\n")
      end
      f.write("\nLogLevel DEBUG3\n") if debug
      f.close
      puts "CONFIG: #{f.path} PID: #{pidpath}" if debug
      yield(f.path, pidpath)
    end
  end

  def port_open?(path)
    Socket.tcp("localhost", 10567, connect_timeout: 1) { true } rescue false # rubocop:disable Style/RescueModifier
  end

  # @yield [pid, port]
  def start_sshd_7_or_later(port = '2200', config: nil, debug: false)
    pid = nil
    sshpidfile = nil
    if config
      with_lines_as_tempfile(config, debug: debug) do |path, pidpath|
        puts "DEBUG - SSH LOG: #{path}-log.txt config: #{path}" if debug
        raise "A leftover sshd is already running" if port_open?(port)

        extra_params = []
        extra_params = ['-E', "#{path}-log.txt"] if debug
        pid = spawn('sudo', '/opt/net-ssh-openssh/sbin/sshd', '-D', '-f', path, '-p', port, *extra_params)
        sshpidfile = pidpath
        yield pid, port
      end
    else
      with_lines_as_tempfile(['']) do |path, pidpath|
        pid = spawn('sudo', '/opt/net-ssh-openssh/sbin/sshd', '-D', '-f', path, '-p', port)
        sshpidfile = pidpath
        yield pid, port
      end
    end
  ensure
    # Our pid is sudo and not sshd, -9 (KILL) on sudo will not clean up its children
    # properly, so we just have to hope that -15 (TERM) will manage to bring
    # down sshd.
    if sshpidfile
      sshpid = File.read(sshpidfile).strip
      system('sudo', 'kill', '-15', sshpid.to_s)
      begin
        Timeout.timeout(20) do
          Process.wait(pid)
        end
      rescue Timeout::Error
        warn "Failed to kill openssh process: #{sshpid}"
        system('sudo', 'kill', '-9', sshpid.to_s)
        raise
      end
    elsif pid
      system('sudo', 'kill', '-15', pid.to_s)
      begin
        Timeout.timeout(20) do
          Process.wait(pid)
        end
      rescue Timeout::Error
        warn "Failed to kill openssh process: #{pid}"
        system('sudo', 'kill', '-9', pid.to_s)
        raise
      end
    end
  end

  def localhost
    'localhost'
  end

  def user
    'net_ssh_1'
  end
end


text:
using Server.Infrastructure.Network.Packets;

namespace Server.Game.Network.Packets
{
    public struct ClientChatMessagePacket : IPacket
    {
        public int ChannelId { get; set; }
        public string Message { get; set; }

        public OpCodes OpCode
        {
            get { return OpCodes.CMSG_CHAT_MESSAGE; }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
class DbTest extends CTestCase
{
	public function testConnection()
	{
		$this->assertTrue(false);
	}
}


text:
namespace Microsoft.Azure.Management.KeyVault.Models
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Newtonsoft.Json;
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Microsoft.Rest.Azure;

    /// <summary>
    /// Parameters for creating or updating a vault
    /// </summary>
    public partial class VaultCreateOrUpdateParameters : IResource
    {
        /// <summary>
        /// Initializes a new instance of the VaultCreateOrUpdateParameters
        /// class.
        /// </summary>
        public VaultCreateOrUpdateParameters()
        {
            Properties = new VaultProperties();
        }

        /// <summary>
        /// Initializes a new instance of the VaultCreateOrUpdateParameters
        /// class.
        /// </summary>
        /// <param name="location">The supported Azure location where the key
        /// vault should be created.</param>
        /// <param name="properties">Properties of the vault</param>
        /// <param name="tags">The tags that will be assigned to the key
        /// vault. </param>
        public VaultCreateOrUpdateParameters(string location, VaultProperties properties, IDictionary<string, string> tags = default(IDictionary<string, string>))
        {
            Properties = new VaultProperties();
            Location = location;
            Tags = tags;
            Properties = properties;
        }

        /// <summary>
        /// Gets or sets the supported Azure location where the key vault
        /// should be created.
        /// </summary>
        [JsonProperty(PropertyName = "location")]
        public string Location { get; set; }

        /// <summary>
        /// Gets or sets the tags that will be assigned to the key vault.
        /// </summary>
        [JsonProperty(PropertyName = "tags")]
        public IDictionary<string, string> Tags { get; set; }

        /// <summary>
        /// Gets or sets properties of the vault
        /// </summary>
        [JsonProperty(PropertyName = "properties")]
        public VaultProperties Properties { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (Location == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Location");
            }
            if (Properties == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Properties");
            }
            if (this.Properties != null)
            {
                this.Properties.Validate();
            }
        }
    }
}


text:
package org.apache.kylin.source.adhocquery;

import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.util.ClassUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractPushdownRunner implements IPushDownRunner {
    public static final Logger logger = LoggerFactory.getLogger(AbstractPushdownRunner.class);

    @Override
    public String convertSql(KylinConfig kylinConfig, String sql, String project, String defaultSchema,
                             boolean isPrepare) {
        String converted = sql;
        for (String converterName : kylinConfig.getPushDownConverterClassNames()) {
            IPushDownConverter converter = (IPushDownConverter) ClassUtil.newInstance(converterName);
            String tmp = converter.convert(converted, project, defaultSchema, isPrepare);
            if (!converted.equals(tmp)) {
                logger.info("the query is converted to {} after applying converter {}", tmp, converterName);
            }
            converted = tmp;
        }
        return converted;
    }
}


text:
package org.linguafranca.pwdb.keepasshttp.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author jo
 */
public class LogginProxy {
    private static final AtomicInteger count = new AtomicInteger(0);

    public static Logger logger = LoggerFactory.getLogger("proxy");

    public LogginProxy(){

    }

    public static void main(String[] args) throws IOException {
        go();
    }

    public static void go() throws IOException {
        ServerSocket serverSocket = new ServerSocket(19455);
        do {
            logger.info("Awaiting connection");
            Socket clientSocket = serverSocket.accept();
            Executors.newSingleThreadExecutor().submit(new Service(clientSocket));
        }while (true);

    }

    private static class Service implements Callable<Boolean> {
        private final Socket clientSocket;

        private Service(Socket socket) {
            this.clientSocket = socket;
        }

        @Override
        public Boolean call() throws Exception {
            final String threadName = "Connection " + count.getAndIncrement();
            Thread.currentThread().setName(threadName);
            final InputStream serverInputStream = clientSocket.getInputStream();
            final OutputStream serverOutputStream = clientSocket.getOutputStream();

            Socket forwardSocket = new Socket("192.168.1.131", 19456);
            final InputStream clientInputStream = forwardSocket.getInputStream();
            final OutputStream clientOutputStream = forwardSocket.getOutputStream();

            Callable<Boolean> upstream = new Callable<Boolean>() {
                @Override
                public Boolean call() throws Exception {
                    Thread.currentThread().setName(threadName + " ->");
                    logger.info("upstream starting");
                    byte[] b = new byte[1024];
                    int l;
                    while ((l=serverInputStream.read(b)) > -1) {
                        clientOutputStream.write(b,0,l);
                        clientOutputStream.flush();
                        logger.info(new String(b, 0, l));
                    }
                    logger.info("upstream finished");
                    return true;
                }
            };

            Callable<Boolean> downstream = new Callable<Boolean>() {
                @Override
                public Boolean call() throws Exception {
                    Thread.currentThread().setName(threadName + " <-");
                    logger.info("downstream starting");
                    byte[] b = new byte[1024];
                    int l;
                    while ((l = clientInputStream.read(b)) > -1) {
                        serverOutputStream.write(b,0,l);
                        serverOutputStream.flush();
                        logger.info(new String(b, 0, l));
                    }
                    logger.info("downstream finished");
                    return true;
                }
            };
            Future<Boolean> upstreamFuture = Executors.newSingleThreadExecutor().submit(upstream);
            Future<Boolean> downStreamFuture = Executors.newSingleThreadExecutor().submit(downstream);
            try {
                upstreamFuture.get();
                //forwardSocket.shutdownOutput();
                downStreamFuture.get();
                forwardSocket.shutdownOutput();
                clientSocket.shutdownOutput();
                logger.info("Connection finished");
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
            }
            return true;
        }
    }
}


text:
require 'faraday'
require 'faraday_middleware'
require 'faraday-cookie_jar'
require 'faraday-rate_limiter'
require 'faraday/error_handler'

module UTApi
  class Connection

    attr_writer :cookie_jar
    attr_writer :request_interval

    def initialize
      @user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)'
    end

    # TODO: Define a better interface for these function
    def get(*args, &block)
      connection.get(*args, &block)
    end

    def post(*args, &block)
      connection.post(*args, &block)
    end

    def cookie_jar
      @cookie_jar ||= HTTP::CookieJar.new
    end

    def request_interval
      @request_interval ||= 2
    end

  private

    def connection
      @connection ||= Faraday.new(ssl: {verify: false}, request: {timeout: 20, open_timeout: 20}, headers: { 'User-Agent' => @user_agent }) do |faraday|
        faraday.response :follow_redirects, limit: 5
        #faraday.response :raise_error # This catches generic http errors
        faraday.request :retry, exceptions: [UTApi::ConnectionError, UTApi::ServerError], interval: 1, backoff_factor: 2, max: 3
        faraday.use :error_handler # This is custom error handling
        faraday.use :cookie_jar, jar: cookie_jar
        faraday.request :url_encoded
        faraday.request :json
        faraday.response :json, content_type: 'application/json'
        faraday.request :rate_limiter, interval: request_interval if request_interval > 0
        faraday.adapter  :net_http_persistent
      end
    end

  end
end


text:
package formaggio

import scalaz._

import org.specs2.mutable._
import Formlets._

object ViewHelpers {
  import scala.xml._

  def getInput(s: String, view: NodeSeq) =
    ((view \\ "input") filter ((x:Node) => (x \ "@id").text == s)).head

  def getValueForInput(s: String, view: NodeSeq) =
    (getInput(s,view) \ "@value").text

  def getValueForLabel(s: String, view: NodeSeq) =
    (view \\ "label") filter ( _.text == s ) map (_ \ "@for") map (_.text) head

  def getErrorMessageForField(s: String, view: NodeSeq) =
    (for {i <- view \\ "li";
	  if( (i \ "@id").text == s) }
     yield i.text).headOption
}

object FormletsSpecs extends Specification {
  import SampleData._  // types used in these forms
  import Scalaz._
  import ViewHelpers._

  /*
  "form view should be correct" in {

    val view = runFormState(labelledFullNameForm, Map("name1"-> "Jim", "name2" -> "Bob"))._2
    println(view)

    "fields should be filled in with environment values" in {
      getValueForInput("name1", view) must_== "Jim"
      getValueForInput("name2", view) must_== "Bob"
    }

    "labels should be filled in correctly" in {
      getValueForLabel("First", view) must_== "name1"
      getValueForLabel("Second", view) must_== "name2"
    }

  }

  "form results should be correct" in {
    "passing correct parameters should produce a result" in {
      getFormValidation( labelledFullNameForm, Map("name1"-> "Jim", "name2" -> "Bob")).toOption.get.toString must_==
      FullName(Name("Jim").toOption.get,Name("Bob").toOption.get).toString
    }

    "form should fail if one of the values isn't filled in" in {
      val rslt = runFormState(labelledFullNameForm, Map("name1"-> "Jim"))
      println(rslt._2)

      rslt._1.isFailure must beTrue
      rslt._1.fail.toOption.get.head must_==  ("name2","name can not be empty")
    }

    "form should fail if one of the values isn't filled in correctly" in {
      val rslt = runFormState(labelledFullNameForm,
			      Map("name::1"-> "Jim",
				  "name2" -> "bob"
				))
      rslt._1.isFailure must beTrue
      rslt._1.fail.toOption.get.head must_==  ("name2","Name must start with a capital letter")

      val view = rslt._2
      println(view)
      getValueForInput("name::1", view) must_== "Jim"
      getValueForInput("name2", view) must_== "bob"

      "and the view should contain an appropriate error message" in {
	getErrorMessageForField("name2", view) must beSome("Name must start with a capital letter")
	(getInput("name2", view) \ "@class").text must_== "digestive-input-error"
	//for {
      }
    }
  }*/

  "inputs" should {
    val form = requiredInput("test", Some("default"))

    "default input should be displayed if there is no input" in {
      val rslt = runFormState(form, Map())
      println(rslt)
      getValueForInput("test::1", rslt._2) must_== "default"
    }
    "empty string input should override default input" in {
      val rslt = runFormState(form, Map("test::1" -> ""))
      rslt._1.isSuccess must beFalse
      getValueForInput("test::1", rslt._2) must_== ""
    }
  }

  "optional inputs should be handled correctly" in {
    val form = inputText("test", Some("default"))

    "input from environment should show up correctly in form" in {
      val rslt = runFormState(form, Map("test::1" -> "some text"))
      rslt._1.isSuccess must beTrue
      getValueForInput("test::1", rslt._2) must_== "some text"
    }
    "default input should be displayed if there is no input" in {
      val rslt = runFormState(form, Map())
      rslt._1.isFailure must beTrue
      getValueForInput("test::1", rslt._2) must_== "default"
    }
    "empty string input should override default input" in {
      val rslt = runFormState(form, Map("test::1" -> ""))
      println(rslt)
      rslt._1.isSuccess must beTrue
      rslt._1 must_== Success(None)
      getValueForInput("test::1", rslt._2) must_== ""
    }
  }

  "checkboxes should be handled correctly" in {
    val form = inputCheckbox("test")

    "if there is any input for the parameter then the form should return true" in {
      val rslt = runFormState(form, Map("test::1" -> "true"))
      println(rslt)
      rslt._1.either.right.get must_== true
      (getInput("test::1",rslt._2) \ "@checked").text must_== "yes"
    }
    "if there is no input then the form returns false" in {
      val rslt = runFormState(form, Map())
      rslt._1.isSuccess must beTrue
      rslt._1.either.right.get must_== false
      (getInput("test::1",rslt._2) \ "@checked").text must_== ""
    }
  }

  /*
  "required checkboxes should be handled correctly" in {
    val form = termsAndConditions
    "if there is any input for the parameter then the form should return true" in {
      val rslt = runFormState(form, Map("test::1" -> "true"))
    }
  }*/

  "for a person form" in {
    val form = personForm

    val env =
      Map(
	"name::1"-> "Jim",
	"name::2" -> "Bob",
	"age::3" -> "30",
	"nickname::5" -> "Jimbo",
	"password::7" -> "password",
	"password::6" -> "password"
      )

    val successRslt = runFormState(form, env)
    println(successRslt)

    "form view should be correct" in {
      val view = successRslt._2

      "fields should be filled in with environment values" in {
	getValueForInput("name::1", view) must_== "Jim"
	getValueForInput("name::2", view) must_== "Bob"
	getValueForInput("age::3", view) must_== "30"
      }

      "labels should be filled in correctly" in {
	getValueForLabel("First", view) must_== "name::1"
	getValueForLabel("Second", view) must_== "name::2"
	getValueForLabel("Age", view) must_== "age::3"
      }

    }

    "form should fail if one of the values isn't filled in" in {
      val rslt = runFormState(form, Map("name::1"-> "Jim"))
      println(rslt)

      val view = rslt._2
      // gets filled in with default value
      getValueForInput("name::2", view) must_== "Billy"

      rslt._1.isFailure must beTrue
      rslt._1.fail.toOption.get.head must_==  ("name::2", LookupError)
    }

    "form should fail if one of the values isn't filled in correctly" in {
      val rslt = runFormState(form, env + ("name::2" -> "bob") + ("password::6" -> "passwd"))
      println(rslt)
      rslt._1.isFailure must beTrue

      val errors = rslt._1.fail.toOption.get.list.toMap
      //(errors.get("name::2").get)("") must_== Some(GenericError("Name must start with a capital letter"))
      //(errors.get("password7").get)("") must_== Some(GenericError("passwords don't match"))

      val view = rslt._2
      getValueForInput("name::1", view) must_== "Jim"
      getValueForInput("name::2", view) must_== "bob"

      "and the view should contain an appropriate error message" in {
	getErrorMessageForField("name::2", view) must beSome("Name must start with a capital letter")
	getErrorMessageForField("password::7", view) must beSome("passwords don't match")
	(getInput("name::2", view) \ "@class").text must_== "digestive-input-error"
      }
    }

  }

  "plug should modify the xml in the form" in {
    import scala.xml._

    val plugged = inputText() plug ((x:NodeSeq) =>

{ x }

)
    val target =

<input value="" type="text" class="digestive-input" name="sc_::1" id="sc_::1"></input>

    // not sure why but this doesn't work if you compare the xml datastructures
    (getFormView(plugged)).toString must_== target.toString

  }
    /*
  "mass input forms should work correctly" in {
    import scala.xml._

    val mI = massInput(inputText())
    (getInput("sc_::101", getFormView(mI)) \ "@name").text must_== "sc_::101"

    "when sending multiple values to a mass input" in {
      val rslt = runFormState(mI, Map("sc_::101" -> "foo", "sc_::102" -> "bar"))

      "another entry should be added to the view to allow for a new input" in {
	((rslt._2 \\ "input") filter ((x:Node) => (x \ "@type").text == "text")).length must_== 3
	//(rslt._2 \\ "input").length must_== 3
	((getInput("sc_::103", rslt._2)) \ "@name").text must_== "sc_::103"
      }

      "the mass input must yield a collection" in {
	rslt._1.toOption.get.toList must_== List("foo", "bar")
      }
    }

    "mass input should apppend to the rest of the form correctly" in {
      case class Thingy(thing1: String, things: Seq[FullName], thing2: String)
      implicit def ThingyEqual: Equal[Thingy] = equalA

      val frm = (inputText() |@| massInput(fullNameForm) |@| inputText() <++ ferrors){ Thingy(_,_,_) }

      val rslt =
	getFormValidation(
	  frm,
	  Map("sc_::1" -> "some",
	      "name::201" -> "Foo", "name::202" -> "Bar",
	      "name::203" -> "Jim", "name::204" -> "Bob",
	      "sc_::3" -> "another"))

      rslt.isSuccess must beTrue
      rslt.toOption.get.thing1 must_== "some"
      rslt.toOption.get.thing2 must_== "another"
      /* should pass this test but for some reason says not equal */
      (Seq(
	FullName("Foo", "Bar"),
	FullName("Jim", "Bob")
      ).sequence[({type λ[α]=Validation[String, α]})#λ, FullName]).toOption.get.toList.toString must_== rslt.toOption.get.things.toList.toString

      "errors should work correctly with mass input" in {
	"errors from the mass input should be accumulated in the rest of the form if not shown in mass input" in {
	  val rslt = runFormState(frm, Map("sc_::1" -> "", "name::201" -> "Foo", "name::202" -> "bar", "sc_::3" -> "another"))
	  println(rslt)
	  val view = rslt._2
	  getErrorMessageForField("name::202", view) must beSome("Name must start with a capital letter")
	  getErrorMessageForField("sc_::1", view) must beSome("empty string not allowed for sc_::1")
	}
      }

    }

  }*/

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID" version="2.4">
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
<!--   <listener> -->
<!--       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> -->
<!--   </listener> -->
<!--   <context-param> -->
<!--       <param-name>contextConfigLocation</param-name> -->
<!--       <param-value>WEB-INF/classes/applicationContext.xml</param-value> -->
<!--   </context-param> -->
</web-app>


text:
--TEST--
Test chunk_split() function : usage variations - unexpected values for 'ending' argument
--FILE--
<?php
/* Prototype  : string chunk_split(string $str [, int $chunklen [, string $ending]])
 * Description: Returns split line
 * Source code: ext/standard/string.c
 * Alias to functions: none
*/

echo "*** Testing chunk_split() : unexpected values for 'ending' ***\n";

// Initializing variables
$str = 'This is simple string.';
$chunklen = 4.9;

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//resource variable
$fp = fopen(__FILE__,'r');

//Class to get object variable
class MyClass
{
  public function __toString()
  {
    return "object";
  }
}

//different values for 'ending'
$values = array(

  // int data
  0,
  1,
  12345,
  -2345,

  // float data
  10.5,
  -10.5,
  10.123456e10,
  10.7654321E-10,
  .5,

  // array data
  array(),
  array(0),
  array(1),
  array(1, 2),
  array('color' => 'red', 'item' => 'pen'),

  // null data
  NULL,
  null,

  // boolean data
  true,
  false,
  TRUE,
  FALSE,

  // empty data
  "",
  '',

  // object data
  new MyClass(),

  // undefined data
  @$undefined_var,

  // unset data
  @$unset_var,

  // resource data
  $fp
);

// loop through each element of values for 'ending'
for($count = 0; $count < count($values); $count++) {
  echo "-- Iteration ".($count+1)." --\n";
  var_dump( chunk_split($str, $chunklen, $values[$count]) );
}

echo "Done";

//closing resource
fclose($fp);
?>
--EXPECTF--
*** Testing chunk_split() : unexpected values for 'ending' ***
-- Iteration 1 --
string(28) "This0 is 0simp0le s0trin0g.0"
-- Iteration 2 --
string(28) "This1 is 1simp1le s1trin1g.1"
-- Iteration 3 --
string(52) "This12345 is 12345simp12345le s12345trin12345g.12345"
-- Iteration 4 --
string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345"
-- Iteration 5 --
string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5"
-- Iteration 6 --
string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5"
-- Iteration 7 --
string(94) "This101234560000 is 101234560000simp101234560000le s101234560000trin101234560000g.101234560000"
-- Iteration 8 --
string(100) "This1.07654321E-9 is 1.07654321E-9simp1.07654321E-9le s1.07654321E-9trin1.07654321E-9g.1.07654321E-9"
-- Iteration 9 --
string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5"
-- Iteration 10 --

Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
NULL
-- Iteration 11 --

Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
NULL
-- Iteration 12 --

Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
NULL
-- Iteration 13 --

Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
NULL
-- Iteration 14 --

Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
NULL
-- Iteration 15 --
string(22) "This is simple string."
-- Iteration 16 --
string(22) "This is simple string."
-- Iteration 17 --
string(28) "This1 is 1simp1le s1trin1g.1"
-- Iteration 18 --
string(22) "This is simple string."
-- Iteration 19 --
string(28) "This1 is 1simp1le s1trin1g.1"
-- Iteration 20 --
string(22) "This is simple string."
-- Iteration 21 --
string(22) "This is simple string."
-- Iteration 22 --
string(22) "This is simple string."
-- Iteration 23 --
string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object"
-- Iteration 24 --
string(22) "This is simple string."
-- Iteration 25 --
string(22) "This is simple string."
-- Iteration 26 --

Warning: chunk_split() expects parameter 3 to be string, resource given in %s on line %d
NULL
Done


text:
curl --include \
     --no-buffer \
     --header "Connection: Upgrade" \
     --header "Upgrade: websocket" \
     --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
     --header "Sec-WebSocket-Version: 13"  $1


text:
import { Component } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { map } from 'rxjs/operators';

@Component({
  selector: 'formly-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  isSmallDevice$ = this.breakpointObserver.observe([Breakpoints.XSmall]).pipe(map(result => result.matches));

  menu = [
    {
      path: 'guide',
      title: 'Guides',
      links: [
        { path: '/guide/getting-started', title: 'Introduction' },
        { path: '/guide/properties-options', title: 'Properties and Options' },
        { path: '/guide/validation', title: 'Validation' },
        { path: '/guide/expression-properties', title: 'Formly Expressions' },
        { path: '/guide/custom-formly-field', title: 'Custom Templates' },
        { path: '/guide/custom-formly-wrapper', title: 'Custom Wrapper' },
      ],
    },
    {
      path: 'ui',
      title: 'UI',
      links: [
        { path: '/ui/bootstrap', title: 'Bootstrap' },
        { path: '/ui/material', title: 'Material' },
        { path: '/ui/ionic', title: 'Ionic' },
        { path: '/ui/primeng', title: 'PrimeNG' },
        { path: '/ui/kendo', title: 'Kendo' },
        { path: '/ui/ng-zorro-antd', title: 'Ng-Zorro-Antd' },
      ],
    },
    {
      path: 'examples',
      title: 'Examples',
      links: [
        { title: 'Intro' },
        { path: '/examples/introduction', title: 'Introduction Example' },

        { title: 'Field Options' },
        { path: '/examples/field-options/expression-properties', title: 'Expression Properties' },
        { path: '/examples/field-options/default-value', title: 'Default Value' },
        { path: '/examples/field-options/hide-fields', title: 'Hide Fields' },
        { path: '/examples/field-options/model-options', title: 'modelOptions' },

        { title: 'Form Options' },
        { path: '/examples/form-options/reset-model', title: 'Reset Model' },
        { path: '/examples/form-options/form-state', title: 'Form State' },

        { title: 'Validation Options' },
        { path: '/examples/validation/built-in-validations', title: 'Built-in validations' },
        { path: '/examples/validation/custom-validation', title: 'Custom validation' },
        { path: '/examples/validation/validation-message', title: 'Validation message' },
        { path: '/examples/validation/unique-value-async-validation', title: 'Async validation of unique value' },
        { path: '/examples/validation/async-validation-update-on', title: 'Async validation and `updateOn`' },
        { path: '/examples/validation/matching-two-fields', title: 'Matching Two Fields' },
        { path: '/examples/validation/force-show-error', title: 'Force showing error state' },
        { path: '/examples/validation/toggle-required', title: 'Toggle required field' },
        { path: '/examples/validation/disable-submit-button', title: 'Disable submit button' },

        { title: 'Bootstrap Formly' },
        { path: '/examples/bootstrap-formly/table-rows', title: 'Table Rows' },
        { path: '/examples/bootstrap-formly/select', title: 'Select' },

        { title: 'Bootstrap Specific' },
        { path: '/examples/bootstrap-specific/advanced-layout', title: 'Advanced Layout' },
        { path: '/examples/bootstrap-specific/bootstrap-horizontal', title: 'Bootstrap Horizontal' },
        { path: '/examples/bootstrap-specific/input-add-ons', title: 'Input add-ons' },

        { title: 'Advanced' },
        { path: '/examples/advanced/i18n', title: 'i18n ngx-translate' },
        { path: '/examples/advanced/i18n-alternative', title: 'i18n ngx-translate (alternative approach)' },
        { path: '/examples/advanced/json-schema', title: 'Json schema' },
        { path: '/examples/advanced/repeating-section', title: 'Repeating Section' },
        { path: '/examples/advanced/repeating-section-input', title: 'Repeating Section With Length Input' },
        { path: '/examples/advanced/multi-step-form', title: 'Multi-Step Form' },
        { path: '/examples/advanced/tabs', title: 'Tabs Form' },
        { path: '/examples/advanced/grid-integration', title: 'ag-grid Integration' },
        { path: '/examples/advanced/datatable-integration', title: 'ngx-datatable Integration' },

        { title: 'Other' },
        { path: '/examples/other/cascaded-select', title: 'Cascaded Select (using observable)' },
        { path: '/examples/other/cascaded-select-json', title: 'Cascaded Select JSON powered' },
        { path: '/examples/other/observable-select', title: 'Bind Observable to Select' },
        { path: '/examples/other/advanced-layout-flex', title: 'Advanced Layout (Flex)' },
        { path: '/examples/other/nested-formly-forms', title: 'Nested Forms (fieldGroup wrapper)' },
        { path: '/examples/other/material-prefix-suffix', title: 'Material Field Prefix/Suffix' },
        { path: '/examples/other/hide-fields-with-animations', title: 'Hide Fields with `@angular/animations`' },
        { path: '/examples/other/button', title: 'Button Type' },
        { path: '/examples/other/json-powered', title: 'JSON powered' },
        { path: '/examples/other/input-file', title: 'File input' },
      ],
    },
  ];

  constructor(private breakpointObserver: BreakpointObserver) {}
}


text:
package org.xtreemfs.babudb.replication.service.clients;

import org.xtreemfs.babudb.log.LogEntry;
import org.xtreemfs.babudb.lsmdb.LSN;
import org.xtreemfs.babudb.pbrpc.GlobalTypes.DBFileMetaDatas;
import org.xtreemfs.babudb.pbrpc.GlobalTypes.ErrorCodeResponse;
import org.xtreemfs.babudb.pbrpc.GlobalTypes.LogEntries;
import org.xtreemfs.babudb.replication.service.logic.LoadLogic.DBFileMetaDataSet;
import org.xtreemfs.foundation.buffer.ReusableBuffer;

/**
 * Client to access services of a server that has an active master lease.
 *
 * @author flangner
 * @since 04/12/2010
 */
public interface MasterClient extends ConditionClient {

    /**
     * Requests a list of serialized {@link LogEntry}s inclusive between the
     * given {@link LSN}s start and end at the master.
     *
     * @param start
     * @param end
     * @return the {@link ClientResponseFuture} to receive a list of serialized
     *         LogEntries.
     */
    public ClientResponseFuture<ReusableBuffer[], LogEntries> replica(LSN start, LSN end);

    /**
     * Requests the chunk data with the given chunk details at the master.
     *
     * @param fileName
     * @param start
     * @param end
     * @return the {@link ClientResponseFuture} for receiving Chunk-data.
     */
    public ClientResponseFuture<ReusableBuffer, ErrorCodeResponse> chunk(
            String fileName, long start, long end);

    /**
     * Requests the DBFileMetadata of the master.
     *
     * @param lsn - of the latest written {@link LogEntry}.
     * @return the {@link ClientResponseFuture} receiving a
     *         {@link DBFileMetaDataSet}.
     */
    public ClientResponseFuture<DBFileMetaDataSet, DBFileMetaDatas> load(LSN lsn);
}


text:
FROM mbentley/debian:jessie
LABEL maintainer="Matt Bentley <mbentley@mbentley.net>"

# install typical php packages and then additional packages
RUN apt-get update &&\
  apt-get install -y php5-curl php5-gd php5-fpm php5-imagick php5-mcrypt php5-memcache php5-memcached php5-mysql dnsutils imagemagick ssmtp whois &&\
  sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php5/fpm/php-fpm.conf

# add run script
ADD run.sh /usr/local/bin/run

ENTRYPOINT ["/usr/local/bin/run"]
CMD ["/usr/sbin/php5-fpm","-R","--fpm-config","/etc/php5/fpm/php-fpm.conf"]


text:
//
//  Created by Jesse Squires
//  http://www.jessesquires.com
//
//
//  Documentation
//  http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
//  GitHub
//  https://github.com/jessesquires/JSQMessagesViewController
//
//
//  License
//  Copyright (c) 2014 Jesse Squires
//  Released under an MIT license: http://opensource.org/licenses/MIT
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class JSQMessagesInputToolbar;

#import "JSQMessagesToolbarContentView.h"

/**
 *  A constant the specifies the default height for a `JSQMessagesInputToolbar`.
 */
FOUNDATION_EXPORT const CGFloat kJSQMessagesInputToolbarHeightDefault;

/**
 *  The `JSQMessagesInputToolbarDelegate` protocol defines methods for interacting with
 *  a `JSQMessagesInputToolbar` object.
 */
@protocol JSQMessagesInputToolbarDelegate <UIToolbarDelegate>

@required

/**
 *  Tells the delegate that the toolbar's `rightBarButtonItem` has been pressed.
 *
 *  @param toolbar The object representing the toolbar sending this information.
 *  @param sender  The button that received the touch event.
 */
- (void)messagesInputToolbar:(JSQMessagesInputToolbar *)toolbar
      didPressRightBarButton:(UIButton *)sender;

/**
 *  Tells the delegate that the toolbar's `leftBarButtonItem` has been pressed.
 *
 *  @param toolbar The object representing the toolbar sending this information.
 *  @param sender  The button that received the touch event.
 */
- (void)messagesInputToolbar:(JSQMessagesInputToolbar *)toolbar
       didPressLeftBarButton:(UIButton *)sender;

@end

/**
 *  An instance of `JSQMessagesInputToolbar` defines the input toolbar for
 *  composing a new message. It is displayed above and follow the movement of
 *  the system keyboard.
 */
@interface JSQMessagesInputToolbar : UIToolbar

/**
 *  The object that acts as the delegate of the toolbar.
 */
@property (weak, nonatomic) id<JSQMessagesInputToolbarDelegate> delegate;

/**
 *  Returns the content view of the toolbar. This view contains all subviews of the toolbar.
 */
@property (weak, nonatomic, readonly) JSQMessagesToolbarContentView *contentView;

/**
 *  A boolean value indicating whether the send button is on the right side of the toolbar or not.
 *
 *  @discussion The default value is `YES`, which indicates that the send button is the right-most subview of
 *  the toolbar's `contentView`. Set to `NO` to specify that the send button is on the left. This
 *  property is used to determine which touch events correspond to which actions.
 *
 *  @warning Note, this property *does not* change the positions of buttons in the toolbar's content view.
 *  It only specifies whether the `rightBarButtonItem `or the `leftBarButtonItem` is the send button.
 *  The other button then acts as the accessory button.
 */
@property (assign, nonatomic) BOOL sendButtonOnRight;

/**
 *  Enables or disables the send button based on whether or not its `textView` has text.
 *  That is, the send button will be enabled if there is text in the `textView`, and disabled otherwise.
 */
- (void)toggleSendButtonEnabled;

@end


text:
<?php

class Mob_Tropa_Vendetta_Ataque_Demoliciones extends Mob_Tropa_Ataque {
    protected $_arm = 40000;
    protected $_mun = 6000;
    protected $_dol = 20000;
    protected $_duracion = 60000;
    protected $_puntos = 281;
    protected $_ataque = 2000;
    protected $_defensa = 200;
    protected $_capacidad = 2500;
    protected $_velocidad = 3500;
    protected $_bonificacionVelocidad = "encargos";
    protected $_salario = 60;
    protected $_requisitos = array ("Explosivos" => 6, "Quimico" => 8);
    protected $_bonificacionesA = array ("Explosivos", "Psicologico", "Quimico");
    protected $_bonificacionesD = array ("Explosivos", "Psicologico", "Quimico");
    protected $_modificadores = array('pistolero' => 1.5, 'policia' => 1.8);
}


text:
.. _long: https://docs.python.org/2/library/stdtypes.html

.. _short: https://docs.python.org/2/library/stdtypes.html

.. _vmodl.DynamicData: ../../vmodl/DynamicData.rst

vim.host.CpuInfo
================
  Information about the CPUs.
:extends: vmodl.DynamicData_

Attributes:
    numCpuPackages (`short`_):

       Number of physical CPU packages on the host.
    numCpuCores (`short`_):

       Number of physical CPU cores on the host.
    numCpuThreads (`short`_):

       Number of physical CPU threads on the host.
    hz (`long`_):

       CPU speed per core. This might be an averaged value if the speed is not uniform across all cores. The total CPU speed of the box is defined as hz * numCpuCores


text:
from django.core.mail.backends import console
from base import BaseEmailBackend

class EmailBackend(console.EmailBackend, BaseEmailBackend):
    def send_messages(self, email_messages):
        email_messages = self.render_messages(email_messages)
        super(EmailBackend, self).send_messages(email_messages)


text:
<?xml version="1.0"?>
<test_suite name="physical-device-vn">
<test name="test1">
    <virtual-network uuid="1" name="vn-1"/>
    <physical-interface uuid="1" name="intf-1" />
    <logical-interface uuid="1" name="l-intf-1"/>
    <virtual-machine uuid="1" name="vm1"/>
    <global-vrouter-config uuid="1" name="default-global-system-config:default-global-vrouter-config" vxlan-mode="automatic"/>
    <vmi nova="1"
     uuid="1" name="tap1" mac="00:00:00:00:00:01" vn-name="vn-1" vn-uuid="1"
     vm-name="vm1" vm-uuid="1" vrf="vrf1" ip="1.1.1.1"
    />
    <physical-router uuid="1" name="router-1"/>
    <validate name="router.1">
        <physical-router name="router-1" uuid="1" present="1" />
    </validate>

    <link left="physical-router" left-name="router-1"
          right="physical-interface" right-name="intf-1"/>
    <validate name="validate-2">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1"
         present="no" />
    </validate>

    <link left="physical-interface" left-name="intf-1"
          right="logical-interface" right-name="l-intf-1"/>
    <validate name="validate-3">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1"
         present="no" />
    </validate>

    <link left="logical-interface" left-name="l-intf-1"
          right="virtual-machine-interface" right-name="tap1"/>
    <validate name="validate-4">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" />
    </validate>

    <virtual-network uuid="1" name="vn-1" vxlan-id="2" network-id="100" />

    <validate name="validate-4-1">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" vxlan-id="100" />
    </validate>

    <global-vrouter-config uuid="1" name="default-global-system-config:default-global-vrouter-config" vxlan-mode="configured"/>

    <validate name="validate-4-global-mode-change">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" vxlan-id="2" />
    </validate>

    <virtual-network uuid="1" name="vn-1" vxlan-id="10" network-id="100" />

    <validate name="validate-4-vxlan-id-change">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" vxlan-id="10" />
    </validate>

    <global-vrouter-config uuid="1" name="default-global-system-config:default-global-vrouter-config" vxlan-mode="automatic"/>
    <virtual-network uuid="1" name="vn-1" vxlan-id="2" network-id="100" />

    <validate name="validate-4-2">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" vxlan-id="100" />
    </validate>

    <link left="virtual-machine-interface" left-name="tap1"
          right="virtual-network" right-name="vn-1" del="1"/>
    <validate name="validate-5">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1"
         present="no"/>
    </validate>

    <link left="virtual-machine-interface" left-name="tap1"
          right="virtual-network" right-name="vn-1"/>
    <validate name="validate-6">
        <physical-router-vn name="router-vn-1" uuid="1" device="1" vn="1" />
    </validate>

    <link left="virtual-machine-interface" left-name="tap1"
          right="virtual-network" right-name="vn-1" del="1"/>
    <link left="logical-interface" left-name="l-intf-1"
          right="virtual-machine-interface" right-name="tap-1" del="1"/>
    <link left="physical-router" left-name="router-1"
          right="physical-interface" right-name="intf-1" del="1"/>
    <link left="physical-interface" left-name="intf-1"
          right="logical-interface" right-name="l-intf-1" del="1"/>
    <physical-router uuid="1" name="router-1" del="1"/>
    <virtual-network uuid="1" name="vn-1" del="1"/>
    <virtual-network uuid="2" name="test-vn" del="1"/>
    <physical-interface uuid="1" name="intf-1" device="router-1"  del="1"/>
    <logical-interface uuid="1" name="l-intf-1" port="p-intf-1" vmi="tap1" del="1"/>
    <virtual-machine uuid="1" name="vm1" del="1"/>
    <vmi nova="1"
     uuid="1" name="tap1" mac="00:00:00:00:00:01" vn-name="vn1" vn-uuid="1"
     vm-name="vm1" vm-uuid="1" vrf="vrf1" ip="1.1.1.1" del="1"
    />

</test>
</test_suite>


text:
<!DOCTYPE html>
<html lang="<?=$html_lang?>">

    <meta charset="utf-8" />
    <title><?php echo $title ?></title>
    <meta name="description" content="<?php echo $meta_description ?>" />
    <meta name="keywords" content="<?php echo $meta_keywords ?>" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/workhaven.css" />
    <link rel="stylesheet" type="text/css" href="/css/img-notes.css" />
    <link rel="stylesheet" type="text/css" href="/css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/jquery.minicolors.css" />
    <link rel="stylesheet" type="text/css" href="/css/bootstrap-select.min.css" />

        <?php echo PartialView::factory("admin/_partials/Menu", NULL, TRUE); ?>

      <?php echo $content ?>
      <?php echo PartialView::factory("admin/_partials/Footer", NULL, TRUE); ?>

    <?php echo PartialView::factory("admin/_partials/Hidden", NULL, TRUE); ?>


text:
namespace EveMarket.Core.Repositories.Eve
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    public partial class agtResearchAgent
    {
        [Key]
        [Column(Order = 0)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public long agentID { get; set; }

        [Key]
        [Column(Order = 1)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public long typeID { get; set; }
    }
}


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Ensues.Reflection.Tests")]
[assembly: AssemblyDescription("Ensues Reflection Tests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ken Yourek")]
[assembly: AssemblyProduct("Ensues.Reflection.Tests")]
[assembly: AssemblyCopyright("Copyright © Ken Yourek 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]


text:
/*
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package java.lang.annotation;

/**
 * The annotation type {@code java.lang.annotation.Repeatable} is
 * used to indicate that the annotation type whose declaration it
 * (meta-)annotates is repeatable. The value of
 * {@code @Repeatable} indicates the containing annotation
 * type for the repeatable annotation type.
 *
 * @since 1.8
 * @jls 9.6 Annotation Types
 * @jls 9.7 Annotations
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Repeatable {
    /**
     * Indicates the containing annotation type for the
     * repeatable annotation type.
     * @return the containing annotation type
     */
    Class<? extends Annotation> value();
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.UI.WebControls
{
    using System;
    using System.Collections.Specialized;
    using System.Text.RegularExpressions;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    using DotNetNuke.Common;
    using DotNetNuke.Modules.HTMLEditorProvider;

    /// <summary>
    /// The DNNRichTextEditControl control provides a standard UI component for editing
    /// RichText.
    /// </summary>
    [ToolboxData("<{0}:DNNRichTextEditControl runat=server></{0}:DNNRichTextEditControl>")]
    public class DNNRichTextEditControl : TextEditControl
    {
        private HtmlEditorProvider _richTextEditor;
        private TextBox _defaultTextEditor;

        protected Control TextEditControl
        {
            get
            {
                if (this._richTextEditor != null)
                {
                    return this._richTextEditor.HtmlEditorControl;
                }

                return this._defaultTextEditor;
            }
        }

        protected string EditorText
        {
            get
            {
                if (this._richTextEditor != null)
                {
                    return this._richTextEditor.Text;
                }

                return this._defaultTextEditor.Text;
            }

            set
            {
                if (this._richTextEditor != null)
                {
                    this._richTextEditor.Text = value;
                }
                else
                {
                    this._defaultTextEditor.Text = value;
                }
            }
        }

        public override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            var dataChanged = false;
            var presentValue = this.StringValue;
            var postedValue = this.EditorText;
            if (!presentValue.Equals(postedValue))
            {
                this.Value = postedValue;
                dataChanged = true;
            }

            return dataChanged;
        }

        protected override void CreateChildControls()
        {
            if (this.EditMode == PropertyEditorMode.Edit)
            {
                var pnlEditor = new Panel();
                if (string.IsNullOrEmpty(this.CssClass))
                {
                    pnlEditor.CssClass = "dnnLeft";
                }
                else
                {
                    pnlEditor.CssClass = string.Format("{0} dnnLeft", this.CssClass);
                }

                this._richTextEditor = HtmlEditorProvider.Instance();
                if (this._richTextEditor != null)
                {
                    this._richTextEditor.ControlID = this.ID + "edit";
                    this._richTextEditor.Initialize();
                    this._richTextEditor.Height = this.ControlStyle.Height;
                    this._richTextEditor.Width = this.ControlStyle.Width;
                    if (this._richTextEditor.Height.IsEmpty)
                    {
                        this._richTextEditor.Height = new Unit(250);
                    }

                    this._richTextEditor.Width = new Unit(400);
                }
                else
                {
                    this._defaultTextEditor = new TextBox
                    {
                        ID = this.ID + "edit",
                        Width = this.ControlStyle.Width.IsEmpty ? new Unit(300) : this.ControlStyle.Width,
                        Height = this.ControlStyle.Height.IsEmpty ? new Unit(250) : this.ControlStyle.Height,
                        TextMode = TextBoxMode.MultiLine,
                    };
                    this._defaultTextEditor.Attributes.Add("aria-label", "editor");
                }

                this.Controls.Clear();
                pnlEditor.Controls.Add(this.TextEditControl);
                this.Controls.Add(pnlEditor);
            }

            base.CreateChildControls();
        }

        protected override void OnDataChanged(EventArgs e)
        {
            var strValue = this.RemoveBaseTags(Convert.ToString(this.Value));
            var strOldValue = this.RemoveBaseTags(Convert.ToString(this.OldValue));
            var args = new PropertyEditorEventArgs(this.Name) { Value = this.Page.Server.HtmlEncode(strValue), OldValue = this.Page.Server.HtmlEncode(strOldValue), StringValue = this.Page.Server.HtmlEncode(this.RemoveBaseTags(this.StringValue)) };
            this.OnValueChanged(args);
        }

        protected override void OnInit(EventArgs e)
        {
            this.EnsureChildControls();
            base.OnInit(e);
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (this.EditMode == PropertyEditorMode.Edit)
            {
                this.EditorText = this.Page.Server.HtmlDecode(Convert.ToString(this.Value));
            }

            if (this.Page != null && this.EditMode == PropertyEditorMode.Edit)
            {
                this.Page.RegisterRequiresPostBack(this);
            }
        }

        protected override void RenderEditMode(HtmlTextWriter writer)
        {
            this.RenderChildren(writer);
        }

        protected override void RenderViewMode(HtmlTextWriter writer)
        {
            string propValue = this.Page.Server.HtmlDecode(Convert.ToString(this.Value));
            this.ControlStyle.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(propValue);
            writer.RenderEndTag();
        }

        private string RemoveBaseTags(string strInput)
        {
            return Globals.BaseTagRegex.Replace(strInput, " ");
        }
    }
}


text:
<?php
namespace Hugorut\Filter\Builders;

use Hugorut\Filter\Filters\Filterable;

abstract class Builder
{
	/**
	 * filters
	 *
	 * @var array
	 */
	protected $filters = [];

	/**
	 * the raw query
	 *
	 * @var string
	 */
	protected $query;

	/**
	 * joins to the model
	 *
	 * @var array
	 */
	protected $joins = [];

	/**
	 * where clasuses to the model
	 *
	 * @var array
	 */
	protected $wheres = [];

	/**
	 * where not in clauses to the model
	 *
	 * @var array
	 */
	protected $whereNotIns = [];

	/**
	 * where in clauses to the model
	 *
	 * @var array
	 */
	protected $whereIns = [];

	/**
	 * table to filter
	 *
	 * @var string
	 */
	protected $tableName;

	/**
	 * a model instance
	 *
	 * @var Object
	 */
	protected $model;

	/**
	 * add a filter to the main filters array
	 *
	 * @param Filterable $filter
	 * @return null
	 */
	public function addFilter(Filterable $filter)
	{
		$this->filters[] = $filter;
	}

	/**
	 * get the filters array
	 *
	 * @return array
	 */
	public function getFilters()
	{
		return $this->filters;
	}

	/**
	 * return the query
	 *
	 * @return mixed
	 */
	public function getQuery()
	{
		return $this->query;
	}

	/**
	 * execute the query
	 *
	 * @return Collection
	 */
	public function get()
	{
		return $this->query->get();
	}

	/**
	 * add a where
	 *
	 * @param string $where
	 * @return null
	 */
	public function addWhere($where)
	{
		if(is_array($where) && !empty($where)) {
			$this->wheres[] = $where;
		}
	}

	/**
	 * return the wheres array
	 *
	 * @return array
	 */
	public function getWheres()
	{
		return $this->wheres;
	}

	/**
	 * add a join
	 *
	 * @param string $join
	 */
	public function addJoin($join)
	{
		if(is_array($join) && !empty($join)) {
			$this->joins[] = $join;
		}
	}

	/**
	 * return the joins
	 *
	 * @return array
	 */
	public function getJoins()
	{
		return $this->joins;
	}

	/**
	 * add where not in
	 *
	 * @param string $wherenot
	 */
	public function addWhereNotIn($whereNot)
	{
		if(is_array($whereNot) && !empty($whereNot)) {
			$this->whereNotIns[] = $whereNot;
		}
	}

	/**
	 * return the where not ins
	 *
	 * @return array
	 */
	public function getWhereNotIns()
	{
		return $this->whereNotIns;
	}

	/**
	 * add where in
	 *
	 * @param string $wherenot
	 */
	public function addWhereIn($whereIn)
	{
		if(is_array($whereIn) && !empty($whereIn)) {
			$this->whereIns[] = $whereIn;
		}
	}

	/**
	 * return the where not ins
	 *
	 * @return array
	 */
	public function getWhereIns()
	{
		return $this->whereIns;
	}

	/**
	 * getter
	 *
	 * @return string
	 */
	public function getTableName()
	{
		return $this->model->getTable();
	}

	/**
	 * build and set the query
	 * @return null
	 */
	public function buildQuery()
	{
		$this->buildBaseQuery();

		foreach ($this->filters as $filter) {
			$this->addWhere($filter->getWhere());
			$this->addWhereNotIn($filter->getWhereNotIn());
			$this->addWhereIn($filter->getWhereIn());
			$this->addJoin($filter->getJoin());
		}

		$this->buildClauses();
	}

	/**
	 * build the base query
	 *
	 * @return void
	 */
	abstract function buildBaseQuery();

	/**
	 * build the clauses
	 *
	 * @return void
	 */
	abstract function buildClauses();

	/**
	 * how should we execute the query
	 *
	 * @return Model
	 */
	abstract function execute();
}
 ?>


text:
@interface DDPPlayerListView ()<NSTableViewDataSource, NSTableViewDelegate, NSMenuDelegate>
@property (weak) IBOutlet NSTableColumn *column;
@property (strong) IBOutlet NSMenu *tableMenu;

@property (weak) IBOutlet NSTableView *tableView;
@property (nonatomic, strong) NSMutableDictionary <NSNumber *, NSNumber *>*cellHeightDic;
@end

@implementation DDPPlayerListView

- (void)awakeFromNib {
    [super awakeFromNib];

    self.tableView.columnAutoresizingStyle = NSTableViewUniformColumnAutoresizingStyle;
    self.tableView.doubleAction = @selector(doubleClickTableView:);
    self.tableView.target = self;
    self.column.width = CGRectGetWidth(self.frame);

    [self.tableMenu addItem:[[NSMenuItem alloc] initWithTitle:@"删除" action:@selector(onClickDeleteItem:) keyEquivalent:@""]];
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)viewDidEndLiveResize {
    [super viewDidEndLiveResize];
    [self reloadData];
}

- (void)resizeSubviewsWithOldSize:(NSSize)oldSize {
    [super resizeSubviewsWithOldSize:oldSize];

    [self.cellHeightDic removeAllObjects];
    let indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.tableView.numberOfRows)];
    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
        context.duration = 0;
    } completionHandler:^{
        [self.tableView noteHeightOfRowsWithIndexesChanged:indexSet];
    }];
}

- (void)viewDidMoveToWindow {
    if (self.window) {
        [self reloadData];
    }
}

- (void)reloadData {
    [self.cellHeightDic removeAllObjects];
    [self.tableView reloadData];
}

#pragma mark - NSTableViewDataSource, NSTableViewDelegate
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
    if ([self.delegate respondsToSelector:@selector(numberOfRowAtPlayerListView:)]) {
        return [self.delegate numberOfRowAtPlayerListView:self];
    }
    return 0;
}

- (nullable NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(nullable NSTableColumn *)tableColumn row:(NSInteger)row {

    DDPPlayerTableCellView *cell = [tableView makeViewWithIdentifier:@"cell" owner:self];
    if (cell == nil) {
        cell = [DDPPlayerTableCellView loadFromNib];
    }

    if ([self.delegate respondsToSelector:@selector(playerListView:titleAtRow:)]) {
        let title = [self.delegate playerListView:self titleAtRow:row];
        cell.label.stringValue = title;
        cell.label.toolTip = title;
    }

    NSInteger currentIndex = NSNotFound;
    if ([self.delegate respondsToSelector:@selector(currentPlayIndexAtPlayerListView:)]) {
        currentIndex = [self.delegate currentPlayIndexAtPlayerListView:self];
    }

    cell.showPoint = currentIndex == row;

    return cell;
}

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
    if ([self.delegate respondsToSelector:@selector(playerListView:titleAtRow:)]) {
        let index = @(row);
        var value = self.cellHeightDic[index];
        if (value == nil) {
            let title = [self.delegate playerListView:self titleAtRow:row];

            NSInteger currentIndex = NSNotFound;
            if ([self.delegate respondsToSelector:@selector(currentPlayIndexAtPlayerListView:)]) {
                currentIndex = [self.delegate currentPlayIndexAtPlayerListView:self];
            }

            CGFloat width = CGRectGetWidth(self.frame);
            if (currentIndex == row) {
                width -= 25;
            } else {
                width -= 10;
            }

            value = @([title heightForFont:nil width:width]);
            self.cellHeightDic[index] = value;
        }
        return value.doubleValue;
    }

    return 16;
}

#pragma mark - NSMenuDelegate
- (void)menuWillOpen:(NSMenu *)menu {
    if (self.tableView.selectedRowIndexes.count == 0) {
        [menu cancelTrackingWithoutAnimation];
    }
}

#pragma mark - Private Method
- (void)doubleClickTableView:(NSTableView *)sender {
    if ([self.delegate respondsToSelector:@selector(playerListView:didSelectedRow:)]) {
        [self.delegate playerListView:self didSelectedRow:self.tableView.selectedRow];
    }
}

- (void)onClickDeleteItem:(NSMenuItem *)sender {
    let selectedRowIndexes = self.tableView.selectedRowIndexes;
    if ([self.delegate respondsToSelector:@selector(playerListView:didDeleteWithIndexSet:)]) {
        [self.delegate playerListView:self didDeleteWithIndexSet:selectedRowIndexes];
    }
    [self.tableView removeRowsAtIndexes:selectedRowIndexes withAnimation:NSTableViewAnimationEffectFade];
}

#pragma mark - 懒加载
- (NSMutableDictionary *)cellHeightDic {
    if (_cellHeightDic == nil) {
        _cellHeightDic = [NSMutableDictionary dictionary];
    }
    return _cellHeightDic;
}

@end


text:
import React, { Component } from 'react';
import './index.less';

class BuddiesList extends Component {
  render() {
    const { buddiesList } = this.props;
    return (

        {Object.keys(buddiesList).map(buddyKey => (

{buddiesList[buddyKey]}

        ))}

    )
  }
}

export default BuddiesList;


text:
# Configure Rails Envinronment
ENV["RAILS_ENV"] ||= "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rails/test_help"
require "rspec/rails"
require "puffer_pages/rspec"

Bundler.require :development

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"

Rails.backtrace_cleaner.remove_silencers!

# ActiveRecord::Base.logger = Logger.new(STDOUT)
# Run any available migration
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)

if ActiveRecord::Base.connection.respond_to? :schema_cache
  ActiveRecord::Base.connection.schema_cache.clear!
end

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
Dir["#{File.dirname(__FILE__)}/fabricators/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  # Remove this line if you don't want RSpec's should and should_not
  # methods or matchers
  require 'rspec/expectations'
  config.include RSpec::Matchers

  # == Mock Framework
  config.mock_with :rspec

  config.use_transactional_fixtures = false

  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
    DatabaseCleaner.strategy = :transaction
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end


text:
/**
 * Description of buttons and their uses.
 *
 * @section Buttons
 */


text:
package ezbake.training;

import java.io.Serializable;

public class TweetWithRaw implements Serializable {
    private static final long serialVersionUID = 1L;

    private Tweet tweet;
    private String raw;

    public TweetWithRaw(Tweet tweet, String raw) {
        this.tweet = tweet;
        this.raw = raw;
    }

    public Tweet getTweet() {
        return tweet;
    }

    public String getRaw() {
        return raw;
    }
}


text:
namespace v8 {
namespace internal {

// Type hints for an binary operation.
enum class BinaryOperationHint : uint8_t {
  kNone,
  kSignedSmall,
  kSigned32,
  kNumberOrOddball,
  kString,
  kAny
};

inline size_t hash_value(BinaryOperationHint hint) {
  return static_cast<unsigned>(hint);
}

std::ostream& operator<<(std::ostream&, BinaryOperationHint);

// Type hints for an compare operation.
enum class CompareOperationHint : uint8_t {
  kNone,
  kSignedSmall,
  kNumber,
  kNumberOrOddball,
  kAny
};

inline size_t hash_value(CompareOperationHint hint) {
  return static_cast<unsigned>(hint);
}

std::ostream& operator<<(std::ostream&, CompareOperationHint);

// Type hints for the ToBoolean type conversion.
enum class ToBooleanHint : uint16_t {
  kNone = 0u,
  kUndefined = 1u << 0,
  kBoolean = 1u << 1,
  kNull = 1u << 2,
  kSmallInteger = 1u << 3,
  kReceiver = 1u << 4,
  kString = 1u << 5,
  kSymbol = 1u << 6,
  kHeapNumber = 1u << 7,
  kSimdValue = 1u << 8,
  kAny = kUndefined | kBoolean | kNull | kSmallInteger | kReceiver | kString |
         kSymbol | kHeapNumber | kSimdValue
};

std::ostream& operator<<(std::ostream&, ToBooleanHint);

typedef base::Flags<ToBooleanHint, uint16_t> ToBooleanHints;

std::ostream& operator<<(std::ostream&, ToBooleanHints);

DEFINE_OPERATORS_FOR_FLAGS(ToBooleanHints)

}  // namespace internal
}  // namespace v8

#endif  // V8_TYPE_HINTS_H_


text:
module ApplicationHelper
  def gravatar_url(email, options = {})
    options.assert_valid_keys :size
    size = options[:size] || 32
    digest = email.blank? ? "0" * 32 : Digest::MD5.hexdigest(email)
    "http://www.gravatar.com/avatar/#{digest}?d=mm&s=#{size}"
  end
end


text:
<?php
namespace Contentinum\Entity;

use Doctrine\ORM\Mapping as ORM;
use ContentinumComponents\Entity\AbstractEntity;

/**
 * WebTagAssign
 *
 * @todo no primary indizes set
 *
 *       @ORM\Table(name="web_tags_assign", uniqueConstraints={@ORM\UniqueConstraint(name="WEBTAGASSIGN", columns={"tag_area","web_item_id", "web_tag_id"})}, indexes={@ORM\Index(name="MEDIATAGSID", columns={"web_mediatag_id"}), @ORM\Index(name="IDX_495AA7811958669F", columns={"web_medias_id"})})
 *       @ORM\Entity
 */
class WebTagAssign extends AbstractEntity
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     *
     * @var string @ORM\Column(name="tag_area", type="string", length=200, nullable=false)
     */
    private $tagArea;

    /**
     *
     * @var integer @ORM\Column(name="web_item_id", type="integer", nullable=false)
     */
    private $webItemId;

    /**
     *
     * @var integer @ORM\Column(name="web_itemgroup_id", type="integer", nullable=false)
     */
    private $webItemGroup = 0;

    /**
     *
     * @var integer @ORM\Column(name="web_tag_id", type="integer", nullable=false)
     */
    private $webTagId;

    /**
     *
     * @var \DateTime @ORM\Column(name="register_date", type="datetime", nullable=false)
     */
    private $registerDate = '0000-00-00 00:00:00';

    /**
     *
     * @var \DateTime @ORM\Column(name="up_date", type="datetime", nullable=false)
     */
    private $upDate = '0000-00-00 00:00:00';

    /**
     * Construct
     *
     * @param array $options
     */
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    /**
     * (non-PHPdoc)
     *
     * @see \ContentinumComponents\Entity\AbstractEntity::getEntityName()
     */
    public function getEntityName()
    {
        return get_class($this);
    }

    /**
     * (non-PHPdoc)
     *
     * @see \ContentinumComponents\Entity\AbstractEntity::getPrimaryKey()
     */
    public function getPrimaryKey()
    {
        return array(
            'tagArea',
            'webItemId',
            'webTagId'
        );
    }

    /**
     * (non-PHPdoc)
     *
     * @see \ContentinumComponents\Entity\AbstractEntity::getPrimaryValue()
     */
    public function getPrimaryValue()
    {
        return array(
            'tagArea' => $this->tagArea,
            'webItemId' => $this->webItemId,
            'webTagId' => $this->webTagId
        );
    }

    /**
     * (non-PHPdoc)
     *
     * @see \ContentinumComponents\Entity\AbstractEntity::getProperties()
     */
    public function getProperties()
    {
        return get_object_vars($this);
    }

    /**
     * @return the $id
     */
    public function getId()
    {
        return $this->id;
    }

 /**
     * @param integer $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

 /**
     *
     * @return the $tagArea
     */
    public function getTagArea()
    {
        return $this->tagArea;
    }

    /**
     *
     * @param string $tagArea
     *
     * @return WebTagAssign
     */
    public function setTagArea($tagArea)
    {
        $this->tagArea = $tagArea;

        return $this;
    }

    /**
     *
     * @return the $webItemId
     */
    public function getWebItemId()
    {
        return $this->webItemId;
    }

    /**
     *
     * @param number $webItemId
     *
     * @return WebTagAssign
     */
    public function setWebItemId($webItemId)
    {
        $this->webItemId = $webItemId;

        return $this;
    }

    /**
     * @return the $webItemGroup
     */
    public function getWebItemGroup()
    {
        return $this->webItemGroup;
    }

 /**
     * @param integer $webItemGroup
     */
    public function setWebItemGroup($webItemGroup)
    {
        $this->webItemGroup = $webItemGroup;
    }

 /**
     *
     * @return the $webTagId
     */
    public function getWebTagId()
    {
        return $this->webTagId;
    }

    /**
     *
     * @param number $webTagId
     *
     * @return WebTagAssign
     */
    public function setWebTagId($webTagId)
    {
        $this->webTagId = $webTagId;

        return $this;
    }

    /**
     * Get registerDate
     *
     * @return \DateTime
     */
    public function getRegisterDate()
    {
        return $this->registerDate;
    }

    /**
     * Set registerDate
     *
     * @param \DateTime $registerDate
     * @return WebMediaTags
     */
    public function setRegisterDate($registerDate)
    {
        $this->registerDate = $registerDate;

        return $this;
    }

    /**
     * Get upDate
     *
     * @return \DateTime
     */
    public function getUpDate()
    {
        return $this->upDate;
    }

    /**
     * Set upDate
     *
     * @param \DateTime $upDate
     * @return WebMediaTags
     */
    public function setUpDate($upDate)
    {
        $this->upDate = $upDate;

        return $this;
    }
}


text:
from azure.cli.core.util import CLIError

def policy_insights_exception_handler(ex):
    from azure.mgmt.policyinsights.models import QueryFailure

    if isinstance(ex, QueryFailure):
        message = '({}) {}'.format(ex.error.error.code, ex.error.error.message)
        raise CLIError(message)
    raise ex


text:
using System;
using System.Web;

using ASC.Blogs.Core;
using ASC.Blogs.Core.Security;
using ASC.Core;
using ASC.Web.Core.ModuleManagement.Common;

namespace ASC.Web.Community.Blogs
{
    public class BlogsShortcutProvider : IShortcutProvider
    {
        public static string GetCreateContentPageUrl()
        {
            if (SecurityContext.CheckPermissions(new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(
                    SecurityContext.CurrentAccount.ID)), Constants.Action_AddPost))

                return VirtualPathUtility.ToAbsolute(Constants.BaseVirtualPath + "AddBlog.aspx");

            return null;
        }

        public string GetAbsoluteWebPathForShortcut(Guid shortcutID, string currentUrl)
        {
            return "";
        }

        public bool CheckPermissions(Guid shortcutID, string currentUrl)
        {
            if (shortcutID.Equals(new Guid("98DB8D88-EDF2-4f82-B3AF-B95E87E3EE5C")) ||
                shortcutID.Equals(new Guid("20673DF0-665E-4fc8-9B44-D48B2A783508")))
            {
                return SecurityContext.CheckPermissions(new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(
                    SecurityContext.CurrentAccount.ID)), Constants.Action_AddPost);
            }

            return false;
        }
    }
}


text:
import { QueryList } from "@angular/core";
import { ColDef } from "@ag-grid-community/core";
export declare class AgGridColumn {
    childColumns: QueryList<AgGridColumn>;
    hasChildColumns(): boolean;
    toColDef(): ColDef;
    private getChildColDefs;
    private createColDefFromGridColumn;
    children: any;
    sortingOrder: any;
    allowedAggFuncs: any;
    menuTabs: any;
    cellClassRules: any;
    icons: any;
    headerGroupComponent: any;
    headerGroupComponentFramework: any;
    headerGroupComponentParams: any;
    cellStyle: any;
    cellRendererParams: any;
    cellEditorFramework: any;
    cellEditorParams: any;
    pinnedRowCellRendererFramework: any;
    pinnedRowCellRendererParams: any;
    filterFramework: any;
    filterParams: any;
    headerComponent: any;
    headerComponentFramework: any;
    headerComponentParams: any;
    floatingFilterComponent: any;
    floatingFilterComponentParams: any;
    floatingFilterComponentFramework: any;
    tooltipComponent: any;
    tooltipComponentParams: any;
    tooltipComponentFramework: any;
    refData: any;
    columnsMenuParams: any;
    headerName: any;
    columnGroupShow: any;
    headerClass: any;
    toolPanelClass: any;
    headerValueGetter: any;
    groupId: any;
    colId: any;
    sort: any;
    initialSort: any;
    field: any;
    type: any;
    tooltipField: any;
    headerTooltip: any;
    cellClass: any;
    showRowGroup: any;
    filter: any;
    initialAggFunc: any;
    aggFunc: any;
    cellRenderer: any;
    cellEditor: any;
    pinned: any;
    initialPinned: any;
    chartDataType: any;
    sortedAt: any;
    sortIndex: any;
    initialSortIndex: any;
    flex: any;
    initialFlex: any;
    width: any;
    initialWidth: any;
    minWidth: any;
    maxWidth: any;
    rowGroupIndex: any;
    initialRowGroupIndex: any;
    pivotIndex: any;
    initialPivotIndex: any;
    dndSourceOnRowDrag: any;
    valueGetter: any;
    valueSetter: any;
    filterValueGetter: any;
    keyCreator: any;
    cellRendererFramework: any;
    pinnedRowCellRenderer: any;
    valueFormatter: any;
    pinnedRowValueFormatter: any;
    valueParser: any;
    comparator: any;
    equals: any;
    pivotComparator: any;
    suppressKeyboardEvent: any;
    suppressHeaderKeyboardEvent: any;
    colSpan: any;
    rowSpan: any;
    getQuickFilterText: any;
    newValueHandler: any;
    onCellValueChanged: any;
    onCellClicked: any;
    onCellDoubleClicked: any;
    onCellContextMenu: any;
    rowDragText: any;
    tooltipValueGetter: any;
    cellRendererSelector: any;
    cellEditorSelector: any;
    suppressCellFlash: any;
    suppressColumnsToolPanel: any;
    suppressFiltersToolPanel: any;
    openByDefault: any;
    marryChildren: any;
    hide: any;
    initialHide: any;
    rowGroup: any;
    initialRowGroup: any;
    pivot: any;
    initialPivot: any;
    checkboxSelection: any;
    headerCheckboxSelection: any;
    headerCheckboxSelectionFilteredOnly: any;
    suppressMenu: any;
    suppressMovable: any;
    lockPosition: any;
    lockVisible: any;
    lockPinned: any;
    unSortIcon: any;
    suppressSizeToFit: any;
    suppressAutoSize: any;
    enableRowGroup: any;
    enablePivot: any;
    enableValue: any;
    editable: any;
    suppressPaste: any;
    suppressNavigable: any;
    enableCellChangeFlash: any;
    rowDrag: any;
    dndSource: any;
    autoHeight: any;
    wrapText: any;
    sortable: any;
    resizable: any;
    singleClickEdit: any;
    floatingFilter: any;
}


text:
#include <QtDeclarative/qdeclarative.h>
#include <QDir>
#include <QFileInfoList>
#include <QFileSystemWatcher>
#include <QRegExp>
#include <mdesktopentry.h>
#include "menumodel.h"
#include "desktop.h"

MenuModel::MenuModel(QObject *parent) :
    QAbstractItemModel(parent),
    m_type("Application")
{
    m_watcher = new QFileSystemWatcher(this);
    connect(m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(appsDirChanged(QString)));

    // Default dirs
    m_watcher->addPath("/usr/share/applications");
    m_watcher->addPath("/usr/share/meego-ux-ivi/applications");

    QHash<int, QByteArray> roles;
    roles[id]="id";
    roles[name]="name";
    roles[exec]="exec";
    roles[comment]="comment";
    roles[icon]="icon";
    roles[filename]="filename";
    roles[custom]="custom";

    setRoleNames(roles);

}

void MenuModel::appsDirChanged(QString changedDir)
{
    QList<Desktop *> added;
    QList<Desktop *> removed;
    QDir dir (changedDir);
    dir.setFilter(QDir::Files | QDir::NoSymLinks);

    foreach (QFileInfo info, dir.entryInfoList())
    {
        bool found = false;
        foreach (Desktop *d, m_apps)
        {
            if (info.absoluteFilePath().endsWith(d->filename().right(d->filename().lastIndexOf('/'))))
            {
                found = true;
                break;
            }
        }
        if (!found)
        {
            Desktop *desktopEntry = new Desktop(info.absoluteFilePath());
            if (!desktopEntry->isValid() || (desktopEntry->type() != m_type))
            {
                delete desktopEntry;
            }
            else
            {
                added << desktopEntry;
            }
        }
    }

    foreach (Desktop *d, m_apps)
    {
        if (!d->filename().contains(changedDir))
            continue;

        bool found = false;
        foreach (QFileInfo info, dir.entryInfoList())
        {
            if (d->filename() == info.absoluteFilePath())
            {
                found = true;
                break;
            }
        }
        if (!found)
        {
            removed << d;
        }
    }

    if (removed.length() > 0)
    {
        QList<Desktop *> tmp;
        while (!m_apps.isEmpty())
        {
            Desktop *d = m_apps.takeLast();
            if (removed.contains(d))
            {
                delete d;
            }
            else
            {
                tmp << d;
            }
        }

        m_apps = tmp;
    }

    if (added.length() > 0)
    {
        foreach (Desktop *d, added)
        {
            m_apps << d;
        }
    }

    emit appsChanged();
}

void MenuModel::setDirectories(QStringList directories)
{
    m_watcher->removePaths(m_watcher->directories());

    foreach(QString directory, directories)
    {
        QString path;
        if (directory.startsWith("~"))
            path = QDir::homePath() + directory.remove(0, 1);
        else if (directory == ".")
            path = QDir::currentPath();
        else
            path = directory;

        // If directory doesn't exist, then attempt to create it
        if (!QDir(path).exists())
        {
            QDir().mkpath(path);
        }

        m_watcher->addPath(path);
    }

    resetApps();
}

void MenuModel::resetApps()
{
    bool found = false;

    while (!m_apps.isEmpty())
        delete m_apps.takeFirst();

    if (m_rootItem)
    {
        delete m_rootItem;
        m_rootItem = NULL;
    }
    m_appsHash.clear();

    buildMenuTreeModel();

    QStringList addedDirectories;

    foreach (QString target, m_watcher->directories())
    {
        QDir dir(target);
        dir.setFilter(QDir::Files | QDir::NoSymLinks);

        QStringList filters;
        filters << "*.desktop";
        foreach (QFileInfo fileInfo, dir.entryInfoList(filters))
        {

            if(!fileInfo.fileName().endsWith(".desktop"))
                continue;

            if(addedDirectories.contains(fileInfo.fileName()))
                continue;

            addedDirectories<<fileInfo.fileName();

            Desktop *desktopEntry = new Desktop(fileInfo.absoluteFilePath());
            if (!desktopEntry->isValid() || (desktopEntry->type() != m_type))
            {
                delete desktopEntry;
                continue;
            }

            m_apps << desktopEntry;

            found = false;
            foreach(QString category, desktopEntry->categories())
            {
                // check if this desktop entry's category matches a menu's category list
                if(!found && m_appsHash.contains(category.toLower()))
                {
                    MenuItem* menu = m_appsHash[category.toLower()];
                    MenuItem* child = new MenuItem(desktopEntry, menu);
                    menu->appendChild(child);
                    found = true;
                }
            }

            if(!found)
            {
                // no match, add it to the "More Apps" menu, the hash key is '*'
                MenuItem* menu = m_appsHash["*"];
                if(menu)
                {
                    MenuItem* child = new MenuItem(desktopEntry, menu);
                    menu->appendChild(child);
                }
            }
        }
    }

    emit appsReset();
}

void MenuModel::buildMenuTreeModel()
{
    MenuItem *parent;

    /* build top level menu */
    m_defaultRootItem = m_rootItem = new MenuItem(NULL);

    addCategory(m_rootItem,
                "Navigation",
                "/usr/share/themes/1024-600-10/icons/ivi/nav.svg",
                "Geography,GPS,Navigation");

    addCategory(m_rootItem,
                "Driver Assistance",
                "/usr/share/themes/1024-600-10/icons/ivi/car.svg",
                "");

    parent = addCategory(m_rootItem,
                         "Communication",
                         "/usr/share/themes/1024-600-10/icons/ivi/communication.svg",
                         "");

    addCategory(parent,
                "Phone",
                "/usr/share/themes/1024-600-10/icons/ivi/dialer.svg",
                "Telephony,TelephonyTools");

    addCategory(parent,
                "Web",
                "/usr/share/themes/1024-600-10/icons/ivi/web.svg",
                "Webservices,WebBrowser,Internet");

    addCategory(parent,
                "Connect",
                "/usr/share/themes/1024-600-10/icons/ivi/connect.svg",
                "Chat,Communications,Email,InstantMessaging,IRCClient,FileTransfer,News,P2P,RemoteAccess,VideoConference");

    parent = addCategory(m_rootItem,
                         "Media",
                         "/usr/share/themes/1024-600-10/icons/ivi/media.svg",
                         "");

    addCategory(parent,
                "Photos",
                "/usr/share/themes/1024-600-10/icons/ivi/photos.svg",
                "Graphics,Photography,Viewer");

    addCategory(parent,
                "Music",
                "/usr/share/themes/1024-600-10/icons/ivi/music.svg",
                "Audio,Music");

    addCategory(parent,
                "Video",
                "/usr/share/themes/1024-600-10/icons/ivi/video.svg",
                "AudioVideo,Video");

    parent = addCategory(m_rootItem,
                         "Other",
                         "/usr/share/themes/1024-600-10/icons/ivi/folder.svg",
                         "");

    addCategory(parent,
                "Activities",
                "/usr/share/themes/1024-600-10/icons/ivi/activities.svg",
                "Education,Game");

    addCategory(parent,
                "Settings",
                "/usr/share/themes/1024-600-10/icons/ivi/settings.svg",
                "Settings,DesktopSettings,HardwareSettings");

    addCategory(parent,
                "Tools",
                "/usr/share/themes/1024-600-10/icons/ivi/tools.svg",
                "Office,Security,Archiving,System,Documentation");

    addCategory(parent,
                "More Apps",
                "/usr/share/themes/1024-600-10/icons/ivi/app.svg",
                "*");
}

MenuItem* MenuModel::addCategory(MenuItem *parent, QString name, QString icon, QString groups)
{
    MenuItem *category;

    category = new MenuItem(NULL, parent);
    category->setCategoryName(name);
    category->setCategoryIcon(icon);
    QList<QString> grouplist = groups.toLower().split(",");
    foreach (QString group, grouplist)
    {
        /* create a hash for retrieve the menu item directly */
        m_appsHash[group] = category;
    }

    category->setCategoryGroups(grouplist);
    parent->appendChild(category);
    m_categories << category;
    return category;
}

QModelIndex MenuModel::index(int row, int column, const QModelIndex &parent) const
{
    if (!hasIndex(row, column, parent))
        return QModelIndex();

    MenuItem *parentItem;

    if (!parent.isValid())
        parentItem = m_rootItem;
    else
        parentItem = static_cast<MenuItem*>(parent.internalPointer());

    MenuItem *childItem = parentItem->child(row);
    if (childItem)
        return createIndex(row, column, childItem);
    else
        return QModelIndex();
}

QModelIndex MenuModel::parent(const QModelIndex &child) const
{
    if (!child.isValid())
        return QModelIndex();

    MenuItem *childItem = static_cast<MenuItem*>(child.internalPointer());
    MenuItem *parentItem = childItem->parent();

    if (parentItem == m_rootItem)
        return QModelIndex();

    return createIndex(parentItem->row(), 0, parentItem);
}

int MenuModel::rowCount(const QModelIndex &parent) const
{
    MenuItem *parentItem;
    if (parent.column() > 0)
        return 0;

    if (!parent.isValid())
        parentItem = m_rootItem;
    else
        parentItem = static_cast<MenuItem*>(parent.internalPointer());

    return parentItem->childCount();
}

int MenuModel::columnCount(const QModelIndex &parent) const
{
    if (parent.isValid())
        return static_cast<MenuItem*>(parent.internalPointer())->columnCount();
    else
        return m_rootItem->columnCount();
}

QVariant MenuModel::data(const QModelIndex& index, int role) const
{
    if (!index.isValid())
        return QVariant();

    MenuItem *item = static_cast<MenuItem*>(index.internalPointer());

    if(role == name ||
       role == exec ||
       role == icon ||
       role == comment ||
       role == filename ||
       role == custom)
    {
        return item->data(index.column(), role);
    }
    return QVariant();
}

bool MenuModel::hasChildren ( const QModelIndex & parent ) const
{
    if(rowCount(parent) > 0)
        return true;
    else
        return false;
}

QDeclarativeListProperty<Desktop> MenuModel::apps()
{
    return QDeclarativeListProperty<Desktop>(this, m_apps);
}

QString MenuModel::value(QString id, QString key)
{
	foreach(Desktop* item, m_apps)
	{
		if(item->id() == id)
			return item->value(key);
	}
	return "";
}

void MenuModel::launchDesktop(QObject *object)
{
    Desktop *target = qobject_cast<Desktop *>(object);
    if (!target)
        return;

    QString cmd = target->exec();

    // http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
    cmd.replace(QRegExp("%k"), target->filename());
    cmd.replace(QRegExp("%i"), QString("--icon ") + target->icon());
    cmd.replace(QRegExp("%c"), target->title());
    cmd.replace(QRegExp("%[fFuU]"), target->filename()); // stuff we don't handle

    QProcess::startDetached(cmd);

    emit startingApp(target->title(), target->icon());
}

void MenuModel::launchDesktopByName(QString name)
{

    if (m_apps.length() == 0)
        return;

    for (int i = 0; i < m_apps.length(); i++)
    {
        Desktop *d = m_apps[i];
        if (d->filename().contains(name))
        {
            launchDesktop(d);
            return;
        }
    }
}

void MenuModel::launch(QString cmd)
{
    QProcess::startDetached(cmd);
}

void MenuModel::setRootIndex(QString name)
{
    beginResetModel();
    if(name.isEmpty())
        m_rootItem = m_defaultRootItem;
    else
    {
        foreach (MenuItem* cat, m_categories)
        {
            if(cat->getCategoryName() == name)
                m_rootItem = cat;
        }
    }
    endResetModel();
}

void MenuModel::setRootIndexToParent()
{
    beginResetModel();
    if(m_rootItem->parent() != NULL)
        m_rootItem = m_rootItem->parent();
    endResetModel();
}

bool MenuModel::isRoot()
{
    if(m_rootItem == m_defaultRootItem)
        return true;
    else
        return false;
}

int MenuModel::getParentIndex()
{
    if(m_rootItem->parent() != NULL)
    {
        m_rootItem = m_rootItem->parent();
        return m_rootItem->row();
    }
    else
        return 0;
}

int MenuModel::getChildCount(int idx)
{
    int size = rowCount(index(idx, 0, QModelIndex()));
    return size;
}

QVariant MenuModel::getNameByIndex(int idx)
{
    return data(index(idx, 0, QModelIndex()), name);
}

QVariant MenuModel::getExecByIndex(int idx)
{
    return data(index(idx, 0, QModelIndex()), exec);
}

QVariant MenuModel::getCommentByIndex(int idx)
{
    return data(index(idx, 0, QModelIndex()), comment);
}

QVariant MenuModel::getIconByIndex(int idx)
{
    return data(index(idx, 0, QModelIndex()), icon);
}

QVariant MenuModel::getFileNameByIndex(int idx)
{
    return data(index(idx, 0, QModelIndex()), filename);
}

MenuModel::~MenuModel()
{
    while (!m_apps.isEmpty())
        delete m_apps.takeFirst();
    delete m_rootItem;
}

QML_DECLARE_TYPE(MenuModel);