text:
module Tooler
  module Template

    def copy_template_sinatra
      gitignore
      license
      readme
      create_dir "lib"
      create_dir "spec"
      create_dir "log"
      template
      gemfile
      procfile
      config_ru
    end

    def template
      ::FileUtils.cp @options[:template_path]+"sinatra/template.rb", @options[:pwd]+"lib/#{@options[:name]}.rb"
    end

    def config_ru
      contents = file_read @options[:template_path]+'sinatra/config.ru'
      contents = contents % {name: @options[:name]}
      file_write @options[:pwd]+"/config.ru", contents
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
var userName="";

//bot display function
function displayBotMessage(message){
  var prevMessage = $('#container').html();
  console.log("message**" + message);
  console.log("message.length**" + message.length);

  if(prevMessage.length >6){
    prevMessage= prevMessage + "
";
  }
  $('#container').html(prevMessage +
  "
Watson: " +
  message + "
");
  $('#container').scrollTop($('#container').prop("scrollHeight"));
}

//bot message function
function getMessage() {
  displayBotMessage("Hi, What can i call you ?");
}

//bot regular function
function watsonAIHandling(message){
  if(userName.length < 1){
    userName=message;

    displayBotMessage("Nice to meet you " + userName + "!!");
    resetConversation();
    console.log(userName+ "2");
  }
  else{
    loadDoc('WatsonInteraction', message);
  }

}

//Function getting loaded on the starting
$(function() {

  //starting function
  getMessage();

  $('#textbox').keypress(function(event){
    if(event.which == 13){
      if( $('#enter').prop("checked")){
        $('#send').click();
        event.preventDefault();
      }
    }
  });

  $('#send').click(function(){
    var userName = "You: ";
    var userMessage = $("#textbox").val();
    $('#textbox').val("");
    var prevMessage = $('#container').html();
    if(prevMessage.length >6){
      prevMessage= prevMessage + "
";
    }
    $('#container').html( prevMessage + "
" + userName + userMessage + "
");
    $('#container').scrollTop($('#container').prop("scrollHeight"));
    watsonAIHandling(userMessage);
  });

});

function loadDoc(url, message) {
  var xhttp;
  xhttp=new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      displayBotMessage(xhttp.responseText);
    }
  };
  var str= message;
  xhttp.open("GET", "WatsonInteraction?question="+str, true);
  xhttp.send();
}

function resetConversation() {
	var xhttp;
	console.log("inside reset conversation");
	xhttp = new XMLHttpRequest();
	xhttp.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
			console.log("got response");
			displayBotMessage(xhttp.responseText);
		}
	};
		var str=1;
		console.log("opening connection");
		xhttp.open("GET", "WatsonInteraction?new="+str, true);
		xhttp.send();
}


text:
module Trade::RebuildTradePlusViews
  def self.run
    time = "#{Time.now.hour}#{Time.now.min}#{Time.now.sec}"
    timestamp = Date.today.to_s.gsub('-', '') + time
    # WARNING: localisation manually added to the group view, so if you want to recreate the group view using this script, localisation will be lost
    # puts "Rebuild group SQL view..."
    # self.rebuild_sql_views(:group, timestamp)
    # self.rebuild_trade_plus_view(:group)
    puts "Rebuild trade codes SQL views..."
    self.rebuild_sql_views(:trade_codes, timestamp)
    self.rebuild_sql_views(:final_trade_codes, timestamp)
    self.rebuild_trade_plus_view(:formatted_data)
    self.rebuild_trade_plus_view(:formatted_data_final)
  end

  def self.rebuild_sql_views(type, timestamp)
    view_type =
      case type
      when :group then Trade::TradePlusGroupView
      when :trade_codes then Trade::FormattedCodes::TradePlusFormattedCodes
      when :final_trade_codes then Trade::FormattedCodes::TradePlusFormattedFinalCodes
      end
    view_type.new.generate_view(timestamp)
  end

  def self.rebuild_trade_plus_view(type)
    views = Dir["db/views/trade_plus_#{type}_view/*"]
    latest_view = views.map { |v| v.split("/").last }.sort.last.split('.').first
    self.recreate_view(type, latest_view)
  end

  def self.recreate_view(type, sql_view)
    view_name = "trade_plus_#{type}_view"
    ActiveRecord::Base.transaction do
      command = "DROP VIEW IF EXISTS #{view_name} CASCADE"
      puts command
      db.execute(command)

      command = "CREATE VIEW #{view_name} AS #{ActiveRecord::Migration.view_sql(sql_view, view_name)}"
      puts command
      db.execute(command)
    end
  end

  def self.db
    ActiveRecord::Base.connection
  end
end


text:
<?php
	$p = $_POST['var'];
	$book = '
		<bookstore>
		<book category="cooking">
		<title lang="en">Everyday Italian</title>
		<author>Giada De Laurentiis</author>
		<year>2005</year>
		<price>30.00</price>
		</book>
		<book category="web" cover="paperback">
		<title lang="en">Learning XML</title>
		<author>Erik T. Ray</author>
		<year>2003</year>
		<price>39.95</price>
		</book>
		<book category="web">
		<title lang="en">XQuery Kick Start</title>
		<author>James McGovern</author>
		<author>Per Bothner</author>
		<author>Kurt Cagle</author>
		<author>James Linn</author>
		<author>Vaidyanathan Nagarajan</author>
		<year>2003</year>
		<price>49.99</price>
		</book>
		</bookstore>
		';
	if($p == 'title'){
		echo $book;
	}
?>


text:
/*
 * StringReader.h
 *
 *      Author: jc
 */

#pragma once

#include <string>

#include "Reader.h"

namespace RedZone {

class RZ_API StringReader : public Reader {
public:
   StringReader( std::string const & string );

   virtual std::string read( size_t nBytes );
   virtual std::string readAll();
   virtual std::string id() const;

   virtual ~StringReader();

protected:
   std::string const & m_string;
   std::string::const_iterator m_iter;
};

} /* namespace RedZone */


text:
   #define SYSAC_HOST_PRIORITY_MASK                              0x0000000f
   #define SYSAC_HOST_PRIORITY_WIDTH                             4
   #define SYSAC_HOST_PRIORITY_RESET                             0000000000
      #define SYSAC_HOST_PRIORITY_PRIORITY_BITS                  3:0
      #define SYSAC_HOST_PRIORITY_PRIORITY_SET                   0x0000000f
      #define SYSAC_HOST_PRIORITY_PRIORITY_CLR                   0xfffffff0
      #define SYSAC_HOST_PRIORITY_PRIORITY_MSB                   3
      #define SYSAC_HOST_PRIORITY_PRIORITY_LSB                   0
      #define SYSAC_HOST_PRIORITY_PRIORITY_RESET                 0x0
#define SYSAC_DBG_PRIORITY                                       HW_REGISTER_RW( 0x7e009004 )
   #define SYSAC_DBG_PRIORITY_MASK                               0x0000000f
   #define SYSAC_DBG_PRIORITY_WIDTH                              4
   #define SYSAC_DBG_PRIORITY_RESET                              0000000000
      #define SYSAC_DBG_PRIORITY_PRIORITY_BITS                   3:0
      #define SYSAC_DBG_PRIORITY_PRIORITY_SET                    0x0000000f
      #define SYSAC_DBG_PRIORITY_PRIORITY_CLR                    0xfffffff0
      #define SYSAC_DBG_PRIORITY_PRIORITY_MSB                    3
      #define SYSAC_DBG_PRIORITY_PRIORITY_LSB                    0
      #define SYSAC_DBG_PRIORITY_PRIORITY_RESET                  0x0
#define SYSAC_HVSM_PRIORITY                                      HW_REGISTER_RW( 0x7e009008 )
   #define SYSAC_HVSM_PRIORITY_MASK                              0x000000ff
   #define SYSAC_HVSM_PRIORITY_WIDTH                             8
   #define SYSAC_HVSM_PRIORITY_RESET                             0000000000
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_BITS                7:4
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_SET                 0x000000f0
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_CLR                 0xffffff0f
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_MSB                 7
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_LSB                 4
      #define SYSAC_HVSM_PRIORITY_P_PRIORITY_RESET               0x0
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_BITS                3:0
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_SET                 0x0000000f
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_CLR                 0xfffffff0
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_MSB                 3
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_LSB                 0
      #define SYSAC_HVSM_PRIORITY_N_PRIORITY_RESET               0x0
#define SYSAC_V3D_PRIORITY                                       HW_REGISTER_RW( 0x7e00900c )
   #define SYSAC_V3D_PRIORITY_MASK                               0x0000000f
   #define SYSAC_V3D_PRIORITY_WIDTH                              4
   #define SYSAC_V3D_PRIORITY_RESET                              0000000000
      #define SYSAC_V3D_PRIORITY_PRIORITY_BITS                   3:0
      #define SYSAC_V3D_PRIORITY_PRIORITY_SET                    0x0000000f
      #define SYSAC_V3D_PRIORITY_PRIORITY_CLR                    0xfffffff0
      #define SYSAC_V3D_PRIORITY_PRIORITY_MSB                    3
      #define SYSAC_V3D_PRIORITY_PRIORITY_LSB                    0
      #define SYSAC_V3D_PRIORITY_PRIORITY_RESET                  0x0
#define SYSAC_H264_PRIORITY                                      HW_REGISTER_RW( 0x7e009010 )
   #define SYSAC_H264_PRIORITY_MASK                              0x0000000f
   #define SYSAC_H264_PRIORITY_WIDTH                             4
   #define SYSAC_H264_PRIORITY_RESET                             0000000000
      #define SYSAC_H264_PRIORITY_PRIORITY_BITS                  3:0
      #define SYSAC_H264_PRIORITY_PRIORITY_SET                   0x0000000f
      #define SYSAC_H264_PRIORITY_PRIORITY_CLR                   0xfffffff0
      #define SYSAC_H264_PRIORITY_PRIORITY_MSB                   3
      #define SYSAC_H264_PRIORITY_PRIORITY_LSB                   0
      #define SYSAC_H264_PRIORITY_PRIORITY_RESET                 0x0
#define SYSAC_JPEG_PRIORITY                                      HW_REGISTER_RW( 0x7e009014 )
   #define SYSAC_JPEG_PRIORITY_MASK                              0x000000ff
   #define SYSAC_JPEG_PRIORITY_WIDTH                             8
   #define SYSAC_JPEG_PRIORITY_RESET                             0000000000
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_BITS                7:4
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_SET                 0x000000f0
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_CLR                 0xffffff0f
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_MSB                 7
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_LSB                 4
      #define SYSAC_JPEG_PRIORITY_P_PRIORITY_RESET               0x0
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_BITS                3:0
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_SET                 0x0000000f
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_CLR                 0xfffffff0
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_MSB                 3
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_LSB                 0
      #define SYSAC_JPEG_PRIORITY_N_PRIORITY_RESET               0x0
#define SYSAC_TRANS_PRIORITY                                     HW_REGISTER_RW( 0x7e009018 )
   #define SYSAC_TRANS_PRIORITY_MASK                             0x000000ff
   #define SYSAC_TRANS_PRIORITY_WIDTH                            8
   #define SYSAC_TRANS_PRIORITY_RESET                            0000000000
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_BITS               7:4
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_SET                0x000000f0
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_CLR                0xffffff0f
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_MSB                7
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_LSB                4
      #define SYSAC_TRANS_PRIORITY_P_PRIORITY_RESET              0x0
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_BITS               3:0
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_SET                0x0000000f
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_CLR                0xfffffff0
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_MSB                3
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_LSB                0
      #define SYSAC_TRANS_PRIORITY_N_PRIORITY_RESET              0x0
#define SYSAC_ISP_PRIORITY                                       HW_REGISTER_RW( 0x7e00901c )
   #define SYSAC_ISP_PRIORITY_MASK                               0x0000000f
   #define SYSAC_ISP_PRIORITY_WIDTH                              4
   #define SYSAC_ISP_PRIORITY_RESET                              0000000000
      #define SYSAC_ISP_PRIORITY_PRIORITY_BITS                   3:0
      #define SYSAC_ISP_PRIORITY_PRIORITY_SET                    0x0000000f
      #define SYSAC_ISP_PRIORITY_PRIORITY_CLR                    0xfffffff0
      #define SYSAC_ISP_PRIORITY_PRIORITY_MSB                    3
      #define SYSAC_ISP_PRIORITY_PRIORITY_LSB                    0
      #define SYSAC_ISP_PRIORITY_PRIORITY_RESET                  0x0
#define SYSAC_USB_PRIORITY                                       HW_REGISTER_RW( 0x7e009020 )
   #define SYSAC_USB_PRIORITY_MASK                               0x0000000f
   #define SYSAC_USB_PRIORITY_WIDTH                              4
   #define SYSAC_USB_PRIORITY_RESET                              0000000000
      #define SYSAC_USB_PRIORITY_PRIORITY_BITS                   3:0
      #define SYSAC_USB_PRIORITY_PRIORITY_SET                    0x0000000f
      #define SYSAC_USB_PRIORITY_PRIORITY_CLR                    0xfffffff0
      #define SYSAC_USB_PRIORITY_PRIORITY_MSB                    3
      #define SYSAC_USB_PRIORITY_PRIORITY_LSB                    0
      #define SYSAC_USB_PRIORITY_PRIORITY_RESET                  0x0
#define SYSAC_L2_ARBITER_CONTROL                                 HW_REGISTER_RW( 0x7e009040 )
   #define SYSAC_L2_ARBITER_CONTROL_MASK                         0x0000ffff
   #define SYSAC_L2_ARBITER_CONTROL_WIDTH                        16
   #define SYSAC_L2_ARBITER_CONTROL_RESET                        0000000000
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_BITS       15:8
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_SET        0x0000ff00
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_CLR        0xffff00ff
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_MSB        15
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_LSB        8
      #define SYSAC_L2_ARBITER_CONTROL_CHANNEL_INIBIT_RESET      0x0
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_BITS            7:6
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_SET             0x000000c0
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_CLR             0xffffff3f
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_MSB             7
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_LSB             6
      #define SYSAC_L2_ARBITER_CONTROL_ALGORITHM_RESET           0x0
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_BITS            5:4
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_SET             0x00000030
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_CLR             0xffffffcf
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_MSB             5
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_LSB             4
      #define SYSAC_L2_ARBITER_CONTROL_THRESHOLD_RESET           0x0
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_BITS                3:2
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_SET                 0x0000000c
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_CLR                 0xfffffff3
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_MSB                 3
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_LSB                 2
      #define SYSAC_L2_ARBITER_CONTROL_DELAY_RESET               0x0
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_BITS                1:0
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_SET                 0x00000003
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_CLR                 0xfffffffc
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_MSB                 1
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_LSB                 0
      #define SYSAC_L2_ARBITER_CONTROL_LIMIT_RESET               0x0
#define SYSAC_UC_ARBITER_CONTROL                                 HW_REGISTER_RW( 0x7e009044 )
   #define SYSAC_UC_ARBITER_CONTROL_MASK                         0x0000ffff
   #define SYSAC_UC_ARBITER_CONTROL_WIDTH                        16
   #define SYSAC_UC_ARBITER_CONTROL_RESET                        0000000000
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_BITS       15:8
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_SET        0x0000ff00
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_CLR        0xffff00ff
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_MSB        15
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_LSB        8
      #define SYSAC_UC_ARBITER_CONTROL_CHANNEL_INIBIT_RESET      0x0
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_BITS            7:6
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_SET             0x000000c0
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_CLR             0xffffff3f
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_MSB             7
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_LSB             6
      #define SYSAC_UC_ARBITER_CONTROL_ALGORITHM_RESET           0x0
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_BITS            5:4
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_SET             0x00000030
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_CLR             0xffffffcf
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_MSB             5
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_LSB             4
      #define SYSAC_UC_ARBITER_CONTROL_THRESHOLD_RESET           0x0
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_BITS                3:2
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_SET                 0x0000000c
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_CLR                 0xfffffff3
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_MSB                 3
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_LSB                 2
      #define SYSAC_UC_ARBITER_CONTROL_DELAY_RESET               0x0
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_BITS                1:0
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_SET                 0x00000003
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_CLR                 0xfffffffc
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_MSB                 1
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_LSB                 0
      #define SYSAC_UC_ARBITER_CONTROL_LIMIT_RESET               0x0
#define SYSAC_SRC_ARBITER_CONTROL                                HW_REGISTER_RW( 0x7e009048 )
   #define SYSAC_SRC_ARBITER_CONTROL_MASK                        0x0000ffff
   #define SYSAC_SRC_ARBITER_CONTROL_WIDTH                       16
   #define SYSAC_SRC_ARBITER_CONTROL_RESET                       0000000000
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_BITS      15:8
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_SET       0x0000ff00
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_CLR       0xffff00ff
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_MSB       15
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_LSB       8
      #define SYSAC_SRC_ARBITER_CONTROL_CHANNEL_INIBIT_RESET     0x0
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_BITS           7:6
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_SET            0x000000c0
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_CLR            0xffffff3f
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_MSB            7
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_LSB            6
      #define SYSAC_SRC_ARBITER_CONTROL_ALGORITHM_RESET          0x0
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_BITS           5:4
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_SET            0x00000030
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_CLR            0xffffffcf
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_MSB            5
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_LSB            4
      #define SYSAC_SRC_ARBITER_CONTROL_THRESHOLD_RESET          0x0
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_BITS               3:2
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_SET                0x0000000c
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_CLR                0xfffffff3
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_MSB                3
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_LSB                2
      #define SYSAC_SRC_ARBITER_CONTROL_DELAY_RESET              0x0
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_BITS               1:0
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_SET                0x00000003
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_CLR                0xfffffffc
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_MSB                1
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_LSB                0
      #define SYSAC_SRC_ARBITER_CONTROL_LIMIT_RESET              0x0
#define SYSAC_PERI_ARBITER_CONTROL                               HW_REGISTER_RW( 0x7e00904c )
   #define SYSAC_PERI_ARBITER_CONTROL_MASK                       0x0000ffff
   #define SYSAC_PERI_ARBITER_CONTROL_WIDTH                      16
   #define SYSAC_PERI_ARBITER_CONTROL_RESET                      0000000000
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_BITS     15:8
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_SET      0x0000ff00
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_CLR      0xffff00ff
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_MSB      15
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_LSB      8
      #define SYSAC_PERI_ARBITER_CONTROL_CHANNEL_INIBIT_RESET    0x0
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_BITS          7:6
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_SET           0x000000c0
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_CLR           0xffffff3f
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_MSB           7
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_LSB           6
      #define SYSAC_PERI_ARBITER_CONTROL_ALGORITHM_RESET         0x0
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_BITS          5:4
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_SET           0x00000030
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_CLR           0xffffffcf
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_MSB           5
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_LSB           4
      #define SYSAC_PERI_ARBITER_CONTROL_THRESHOLD_RESET         0x0
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_BITS              3:2
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_SET               0x0000000c
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_CLR               0xfffffff3
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_MSB               3
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_LSB               2
      #define SYSAC_PERI_ARBITER_CONTROL_DELAY_RESET             0x0
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_BITS              1:0
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_SET               0x00000003
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_CLR               0xfffffffc
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_MSB               1
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_LSB               0
      #define SYSAC_PERI_ARBITER_CONTROL_LIMIT_RESET             0x0
#define SYSAC_DMA_ARBITER_CONTROL_UC                             HW_REGISTER_RW( 0x7e009050 )
   #define SYSAC_DMA_ARBITER_CONTROL_UC_MASK                     0x0000ffff
   #define SYSAC_DMA_ARBITER_CONTROL_UC_WIDTH                    16
   #define SYSAC_DMA_ARBITER_CONTROL_UC_RESET                    0000000000
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_BITS   15:8
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_SET    0x0000ff00
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_CLR    0xffff00ff
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_MSB    15
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_LSB    8
      #define SYSAC_DMA_ARBITER_CONTROL_UC_CHANNEL_INIBIT_RESET  0x0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_BITS        7:6
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_SET         0x000000c0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_CLR         0xffffff3f
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_MSB         7
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_LSB         6
      #define SYSAC_DMA_ARBITER_CONTROL_UC_ALGORITHM_RESET       0x0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_BITS        5:4
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_SET         0x00000030
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_CLR         0xffffffcf
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_MSB         5
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_LSB         4
      #define SYSAC_DMA_ARBITER_CONTROL_UC_THRESHOLD_RESET       0x0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_BITS            3:2
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_SET             0x0000000c
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_CLR             0xfffffff3
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_MSB             3
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_LSB             2
      #define SYSAC_DMA_ARBITER_CONTROL_UC_DELAY_RESET           0x0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_BITS            1:0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_SET             0x00000003
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_CLR             0xfffffffc
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_MSB             1
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_LSB             0
      #define SYSAC_DMA_ARBITER_CONTROL_UC_LIMIT_RESET           0x0
#define SYSAC_DMA_ARBITER_CONTROL_L2                             HW_REGISTER_RW( 0x7e009054 )
   #define SYSAC_DMA_ARBITER_CONTROL_L2_MASK                     0x0000ffff
   #define SYSAC_DMA_ARBITER_CONTROL_L2_WIDTH                    16
   #define SYSAC_DMA_ARBITER_CONTROL_L2_RESET                    0000000000
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_BITS        7:6
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_SET         0x000000c0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_CLR         0xffffff3f
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_MSB         7
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_LSB         6
      #define SYSAC_DMA_ARBITER_CONTROL_L2_ALGORITHM_RESET       0x0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_BITS        5:4
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_SET         0x00000030
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_CLR         0xffffffcf
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_MSB         5
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_LSB         4
      #define SYSAC_DMA_ARBITER_CONTROL_L2_THRESHOLD_RESET       0x0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_BITS            3:2
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_SET             0x0000000c
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_CLR             0xfffffff3
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_MSB             3
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_LSB             2
      #define SYSAC_DMA_ARBITER_CONTROL_L2_DELAY_RESET           0x0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_BITS            1:0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_SET             0x00000003
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_CLR             0xfffffffc
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_MSB             1
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_LSB             0
      #define SYSAC_DMA_ARBITER_CONTROL_L2_LIMIT_RESET           0x0
#define SYSAC_DMA_ARBITER_CONTROL_PER                            HW_REGISTER_RW( 0x7e009058 )
   #define SYSAC_DMA_ARBITER_CONTROL_PER_MASK                    0x0000ffff
   #define SYSAC_DMA_ARBITER_CONTROL_PER_WIDTH                   16
   #define SYSAC_DMA_ARBITER_CONTROL_PER_RESET                   0000000000
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_BITS  15:8
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_SET   0x0000ff00
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_CLR   0xffff00ff
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_MSB   15
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_LSB   8
      #define SYSAC_DMA_ARBITER_CONTROL_PER_CHANNEL_INIBIT_RESET 0x0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_BITS       7:6
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_SET        0x000000c0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_CLR        0xffffff3f
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_MSB        7
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_LSB        6
      #define SYSAC_DMA_ARBITER_CONTROL_PER_ALGORITHM_RESET      0x0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_BITS       5:4
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_SET        0x00000030
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_CLR        0xffffffcf
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_MSB        5
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_LSB        4
      #define SYSAC_DMA_ARBITER_CONTROL_PER_THRESHOLD_RESET      0x0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_BITS           3:2
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_SET            0x0000000c
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_CLR            0xfffffff3
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_MSB            3
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_LSB            2
      #define SYSAC_DMA_ARBITER_CONTROL_PER_DELAY_RESET          0x0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_BITS           1:0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_SET            0x00000003
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_CLR            0xfffffffc
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_MSB            1
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_LSB            0
      #define SYSAC_DMA_ARBITER_CONTROL_PER_LIMIT_RESET          0x0
#define SYSAC_DMA_ARBITER_CONTROL_LITE                           HW_REGISTER_RW( 0x7e00905c )
   #define SYSAC_DMA_ARBITER_CONTROL_LITE_MASK                   0x0000ffff
   #define SYSAC_DMA_ARBITER_CONTROL_LITE_WIDTH                  16
   #define SYSAC_DMA_ARBITER_CONTROL_LITE_RESET                  0000000000
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_BITS 15:8
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_SET  0x0000ff00
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_CLR  0xffff00ff
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_MSB  15
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_LSB  8
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_CHANNEL_INIBIT_RESET0x0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_BITS      7:6
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_SET       0x000000c0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_CLR       0xffffff3f
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_MSB       7
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_LSB       6
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_ALGORITHM_RESET     0x0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_BITS      5:4
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_SET       0x00000030
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_CLR       0xffffffcf
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_MSB       5
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_LSB       4
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_THRESHOLD_RESET     0x0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_BITS          3:2
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_SET           0x0000000c
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_CLR           0xfffffff3
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_MSB           3
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_LSB           2
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_DELAY_RESET         0x0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_BITS          1:0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_SET           0x00000003
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_CLR           0xfffffffc
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_MSB           1
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_LSB           0
      #define SYSAC_DMA_ARBITER_CONTROL_LITE_LIMIT_RESET         0x0
#define SYSAC_DUMMY_STATUS                                       HW_REGISTER_RW( 0x7e009060 )
   #define SYSAC_DUMMY_STATUS_MASK                               0x00000001
   #define SYSAC_DUMMY_STATUS_WIDTH                              1
   #define SYSAC_DUMMY_STATUS_RESET                              0000000000
      #define SYSAC_DUMMY_STATUS_IDLE_BITS                       0:0
      #define SYSAC_DUMMY_STATUS_IDLE_SET                        0x00000001
      #define SYSAC_DUMMY_STATUS_IDLE_CLR                        0xfffffffe
      #define SYSAC_DUMMY_STATUS_IDLE_MSB                        0
      #define SYSAC_DUMMY_STATUS_IDLE_LSB                        0
      #define SYSAC_DUMMY_STATUS_IDLE_RESET                      0x0
#define SYSAC_DMA_DREQ_CONTROL                                   HW_REGISTER_RW( 0x7e009064 )
   #define SYSAC_DMA_DREQ_CONTROL_MASK                           0x0000000f
   #define SYSAC_DMA_DREQ_CONTROL_WIDTH                          4
   #define SYSAC_DMA_DREQ_CONTROL_RESET                          0000000000
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_BITS            2:0
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_SET             0x00000007
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_CLR             0xfffffff8
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_MSB             2
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_LSB             0
      #define SYSAC_DMA_DREQ_CONTROL_SMI_DISABLE_RESET           0x0
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_BITS       3:3
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_SET        0x00000008
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_CLR        0xfffffff7
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_MSB        3
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_LSB        3
      #define SYSAC_DMA_DREQ_CONTROL_DMA_DBG_PAUSE_OR_RESET      0x0
#define SYSAC_V3D_LIMITER                                        HW_REGISTER_RW( 0x7e009068 )
   #define SYSAC_V3D_LIMITER_MASK                                0x00000fff
   #define SYSAC_V3D_LIMITER_WIDTH                               12
   #define SYSAC_V3D_LIMITER_RESET                               0000000000
      #define SYSAC_V3D_LIMITER_ENABLE_BITS                      0:0
      #define SYSAC_V3D_LIMITER_ENABLE_SET                       0x00000001
      #define SYSAC_V3D_LIMITER_ENABLE_CLR                       0xfffffffe
      #define SYSAC_V3D_LIMITER_ENABLE_MSB                       0
      #define SYSAC_V3D_LIMITER_ENABLE_LSB                       0
      #define SYSAC_V3D_LIMITER_ENABLE_RESET                     0x0
      #define SYSAC_V3D_LIMITER_SPARE_BITS                       3:1
      #define SYSAC_V3D_LIMITER_SPARE_SET                        0x0000000e
      #define SYSAC_V3D_LIMITER_SPARE_CLR                        0xfffffff1
      #define SYSAC_V3D_LIMITER_SPARE_MSB                        3
      #define SYSAC_V3D_LIMITER_SPARE_LSB                        1
      #define SYSAC_V3D_LIMITER_SPARE_RESET                      0x0
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_BITS                7:3
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_SET                 0x000000f8
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_CLR                 0xffffff07
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_MSB                 7
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_LSB                 3
      #define SYSAC_V3D_LIMITER_MAX_PRIORITY_RESET               0x0
      #define SYSAC_V3D_LIMITER_INCREMENT_BITS                   0:0
      #define SYSAC_V3D_LIMITER_INCREMENT_SET                    0x00000001
      #define SYSAC_V3D_LIMITER_INCREMENT_CLR                    0xfffffffe
      #define SYSAC_V3D_LIMITER_INCREMENT_MSB                    0
      #define SYSAC_V3D_LIMITER_INCREMENT_LSB                    0
      #define SYSAC_V3D_LIMITER_INCREMENT_RESET                  0x0
      #define SYSAC_V3D_LIMITER_HOLDOFF_BITS                     0:0
      #define SYSAC_V3D_LIMITER_HOLDOFF_SET                      0x00000001
      #define SYSAC_V3D_LIMITER_HOLDOFF_CLR                      0xfffffffe
      #define SYSAC_V3D_LIMITER_HOLDOFF_MSB                      0
      #define SYSAC_V3D_LIMITER_HOLDOFF_LSB                      0
      #define SYSAC_V3D_LIMITER_HOLDOFF_RESET                    0x0


text:
<?php

namespace skeeks\cms\models;

use Yii;

/**
 * This is the model class for table "{{%cms_content_element_tree}}".
 *
 * @property integer $id
 * @property integer $created_by
 * @property integer $updated_by
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $element_id
 * @property integer $tree_id
 *
 * @property CmsContentElement $element
 * @property CmsTree $tree
 */
class CmsContentElementTree extends Core
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%cms_content_element_tree}}';
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return array_merge(parent::attributeLabels(), [
            'id' => Yii::t('skeeks/cms', 'ID'),
            'created_by' => Yii::t('skeeks/cms', 'Created By'),
            'updated_by' => Yii::t('skeeks/cms', 'Updated By'),
            'created_at' => Yii::t('skeeks/cms', 'Created At'),
            'updated_at' => Yii::t('skeeks/cms', 'Updated At'),
            'element_id' => Yii::t('skeeks/cms', 'Element ID'),
            'tree_id' => Yii::t('skeeks/cms', 'Tree ID'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return array_merge(parent::rules(), [
            [['created_by', 'updated_by', 'created_at', 'updated_at', 'element_id', 'tree_id'], 'integer'],
            [['element_id', 'tree_id'], 'required'],
            [
                ['element_id', 'tree_id'],
                'unique',
                'targetAttribute' => ['element_id', 'tree_id'],
                'message' => \Yii::t('skeeks/cms', 'The combination of Element ID and Tree ID has already been taken.')
            ]
        ]);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getElement()
    {
        return $this->hasOne(CmsContentElement::className(), ['id' => 'element_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTree()
    {
        return $this->hasOne(Tree::className(), ['id' => 'tree_id']);
    }
}


text:
const add = require('./add.png')
const text = require('./text.png')
const link = require('./link.png')
const image = require('./image.png')
const camera = require('./camera.png')
const cancel = require('./cancel.png')

export default {
  add,
  text,
  link,
  image,
  camera,
  cancel,
}


text:
import { ChangeDetectionStrategy, Component, Injector, Input, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Group, GroupForRegistration } from 'app/api/models';
import { BaseComponent } from 'app/shared/base.component';
import { LoginService } from 'app/ui/core/login.service';

/**
 * Public registration step: select the group
 */
@Component({
  selector: 'registration-step-group',
  templateUrl: 'registration-step-group.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RegistrationStepGroupComponent extends BaseComponent implements OnInit {
  @Input() groupSets: Group[];
  @Input() groups: (GroupForRegistration | Group)[];
  @Input() control: FormControl;
  singleLine: boolean;

  constructor(
    injector: Injector,
    public login: LoginService) {
    super(injector);
  }

  ngOnInit() {
    super.ngOnInit();
    // Show in a single line if there's at most 3 groups, and none has description
    this.singleLine = this.groups.length <= 3 && this.groups.filter(g => g['description']).length === 0;
  }

  groupsForSet(groupSet: Group) {
    const groups = this.groups as Group[];
    if (groupSet == null) {
      return groups.filter(g => g.groupSet == null);
    } else {
      return groups.filter(g => g.groupSet && [groupSet.id, groupSet.internalName].includes(g.groupSet));
    }
  }
}


text:
'use strict';

var gulp          = require('gulp'),
    util          = require('gulp-util'),
    rename        = require('gulp-rename'),
    sass          = require('gulp-sass'),
    autoprefixer  = require('gulp-autoprefixer'),
    plumber       = require('gulp-plumber'),
    gulpif        = require('gulp-if'),
    sourcemaps    = require('gulp-sourcemaps');

var config      = require('../config').css,
    writeSourcemaps  = !util.env.production;

gulp.task('css', function() {
  gulp.src(config.src)
    .pipe(gulpif(writeSourcemaps, sourcemaps.init()))
      .pipe(plumber({
        errorHandler: function (err) {
          console.log(err);
          this.emit('end');
        }
      }))
      .pipe(sass({
        outputStyle: 'compressed',
        errLogToConsole: true
      }))
      .pipe(autoprefixer({ browsers: ['last 2 versions', '> 1%', 'IE 9']}))
      .pipe(rename({suffix: '.min'}))
    .pipe(gulpif(writeSourcemaps, sourcemaps.write()))
    .pipe(gulp.dest(config.dest));
});


text:
#include "../Mutex.h"
#include "../Thread.h"
#include <set>
#include <stdio.h>

class Request;

class Inventory
{
 public:
  void add(Request* req)
  {
    muduo::MutexLockGuard lock(mutex_);
    requests_.insert(req);
  }

  void remove(Request* req) __attribute__ ((noinline))
  {
    muduo::MutexLockGuard lock(mutex_);
    requests_.erase(req);
  }

  void printAll() const;

 private:
  mutable muduo::MutexLock mutex_;
  std::set<Request*> requests_;
};

Inventory g_inventory;

class Request
{
 public:
  void process() // __attribute__ ((noinline))
  {
    muduo::MutexLockGuard lock(mutex_);
    g_inventory.add(this);
    // ...
  }

  ~Request() __attribute__ ((noinline))
  {
    muduo::MutexLockGuard lock(mutex_);
    sleep(1);
    g_inventory.remove(this);
  }

  void print() const __attribute__ ((noinline))
  {
    muduo::MutexLockGuard lock(mutex_);
    // ...
  }

 private:
  mutable muduo::MutexLock mutex_;
};

void Inventory::printAll() const
{
  muduo::MutexLockGuard lock(mutex_);
  sleep(1);
  for (std::set<Request*>::const_iterator it = requests_.begin();
      it != requests_.end();
      ++it)
  {
    (*it)->print();
  }
  printf("Inventory::printAll() unlocked\n");
}

/*
void Inventory::printAll() const
{
  std::set<Request*> requests
  {
    muduo::MutexLockGuard lock(mutex_);
    requests = requests_;
  }
  for (std::set<Request*>::const_iterator it = requests.begin();
      it != requests.end();
      ++it)
  {
    (*it)->print();
  }
}
*/

void threadFunc()
{
  Request* req = new Request;
  req->process();
  delete req;
}

int main()
{
  muduo::Thread thread(threadFunc);
  thread.start();
  usleep(500 * 1000);
  g_inventory.printAll();
  thread.join();
}


text:
namespace pcpp
{

LoggerPP::LoggerPP() : m_ErrorString(NULL), m_ErrorStringLen(0), m_SuppressErrors(false)
{
	for (int i = 0; i<NumOfLogModules; i++)
		m_LogModulesArray[i] = Normal;
}
} // namespace pcpp


text:
package org.assertj.core.presentation;

import org.junit.After;
import org.junit.Before;

/**
 * @author Filip Hrisafov
 */
public abstract class AbstractBaseRepresentationTest {

  @Before
  public void setUp() {
    StandardRepresentation.resetDefaults();
  }

  @After
  public void afterTests() {
    StandardRepresentation.resetDefaults();
  }
}


text:
public class MyAccount implements CheckingAccount, SavingAccount {

    double balance;

    public MyAccount(double balance) {
        this.balance = balance;
    }

    public double getCheckingBalance() {
        return balance * 0.8;
    }

    public double getSavingBalance() {
        return balance * 0.2;
    }
}


text:
def add_routes(routes_name)
  instance_eval(File.read(Rails.root.join("config/#{routes_name}.rb")))
end

get "sign_in", to: "sign_in#index", as: :sign_in
get "sign_in_warning", to: "sign_in#warn_idp_disconnecting", as: :sign_in_warning
post "sign_in_warning", to: "sign_in#warn_idp_disconnecting", as: :sign_in_warning
post "sign_in_confirm", to: "sign_in#confirm_idp", as: :sign_in_confirm
post "sign_in", to: "sign_in#select_idp", as: :sign_in_submit
get "begin_sign_in", to: "start#sign_in", as: :begin_sign_in

constraints IsLoa2 do
  get "prove_identity_ignore_hint", to: "prove_identity#ignore_hint", as: :prove_identity_ignore_hint
  get "will_it_work_for_me", to: "will_it_work_for_me#index", as: :will_it_work_for_me
  post "will_it_work_for_me", to: "will_it_work_for_me#will_it_work_for_me", as: :will_it_work_for_me_submit
  get "about_documents", to: "about#about_documents", as: :about_documents
  get "prove_your_identity_another_way", to: "about#prove_your_identity_another_way", as: :prove_your_identity_another_way
  get "why_might_this_not_work_for_me", to: "will_it_work_for_me#why_might_this_not_work_for_me", as: :why_might_this_not_work_for_me
  get "may_not_work_if_you_live_overseas", to: "will_it_work_for_me#may_not_work_if_you_live_overseas", as: :may_not_work_if_you_live_overseas
  get "will_not_work_without_uk_address", to: "will_it_work_for_me#will_not_work_without_uk_address", as: :will_not_work_without_uk_address
end

get "start", to: "start#index", as: :start
post "start", to: "start#request_post", as: :start
get "prove_identity", to: "prove_identity#index", as: :prove_identity
get "begin_registration", to: "start#register", as: :begin_registration
get "start_ignore_hint", to: "start#ignore_hint", as: :start_ignore_hint
get "accessibility", to: "static#accessibility", as: :accessibility
get "privacy_notice", to: "static#privacy_notice", as: :privacy_notice
get "verify_services", to: "static#verify_services", as: :verify_services
get "cookies", to: "static#cookies", as: :cookies
get "about", to: "about#about_verify", as: :about
get "about_choosing_a_company", to: "about#about_choosing_a_company", as: :about_choosing_a_company
get "confirm_your_identity", to: "confirm_your_identity#index", as: :confirm_your_identity
get "failed_uplift", to: "failed_uplift#index", as: :failed_uplift
get "failed_sign_in", to: "failed_sign_in#idp", as: :failed_sign_in
get "other_ways_to_access_service", to: "other_ways_to_access_service#index", as: :other_ways_to_access_service
get "forgot_company", to: "static#forgot_company", as: :forgot_company
get "choose_a_certified_company", to: "choose_a_certified_company#index", as: :choose_a_certified_company
post "choose_a_certified_company", to: "choose_a_certified_company#select_idp", as: :choose_a_certified_company_submit
get "choose_a_certified_company/:company", to: "choose_a_certified_company#about", as: :choose_a_certified_company_about
get "response_processing", to: "response_processing#index", as: :response_processing
get "redirect_to_service_signing_in" => "redirect_to_service#signing_in", as: :redirect_to_service_signing_in
get "redirect_to_service_start_again" => "redirect_to_service#start_again", as: :redirect_to_service_start_again
get "redirect_to_service_error" => "redirect_to_service#error", as: :redirect_to_service_error
get "feedback_landing", to: "feedback_landing#index", as: :feedback_landing
get "confirmation", to: "confirmation#matching_journey", as: :confirmation
get "confirmation_non_matching_journey", to: "confirmation#non_matching_journey", as: :confirmation_non_matching_journey
get "failed_registration", to: "failed_registration#index", as: :failed_registration
get "feedback", to: "feedback#index", as: :feedback
post "feedback", to: "feedback#submit", as: :feedback_submit
get "feedback_sent", to: "feedback_sent#index", as: :feedback_sent
get "further_information", to: "further_information#index", as: :further_information
get "further_information_timeout", to: "further_information#timeout", as: :further_information_timeout
post "further_information", to: "further_information#submit", as: :further_information_submit
post "further_information_cancel", to: "further_information#cancel", as: :further_information_cancel
post "further_information_null_attribute", to: "further_information#submit_null_attribute", as: :further_information_null_attribute_submit
get "cancelled_registration", to: "cancelled_registration#index", as: :cancelled_registration
get "paused_registration", to: "paused_registration#index", as: :paused_registration
get "paused_registration_resume_link", to: "paused_registration#from_resume_link", as: :paused_registration_resume_link
get "resume_registration", to: "paused_registration#resume", as: :resume_registration
post "resume_registration", to: "paused_registration#resume_with_idp", as: :resume_registration_submit
get "completed_registration", to: "completed_registration#index", as: :completed_registration

if SINGLE_IDP_FEATURE
  get "continue_to_your_idp", to: "single_idp_journey#continue_to_your_idp", as: :continue_to_your_idp
  post "continue_to_your_idp", to: "single_idp_journey#continue"
  get "single_idp_start_page", to: "single_idp_journey#rp_start_page", as: :single_idp_start_page
end


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>All Classes - Feathers User Interface Controls for Starling Framework API Reference</title>
      <base target="classFrame">
      <link rel="stylesheet" href="style.css" type="text/css" media="screen">
      <link rel="stylesheet" href="print.css" type="text/css" media="print">
      <link rel="stylesheet" href="override.css" type="text/css">

All Classes

            Alert

            AnchorLayout

            AnchorLayoutData

            ArrayChildrenHierarchicalCollectionDataDescriptor

            ArrayListCollectionDataDescriptor

            BaseDefaultItemRenderer

            BitmapFontTextFormat

            BitmapFontTextRenderer

            Button

            ButtonGroup

            Callout

            CalloutPopUpContentManager

            Check

            CollectionEventType

            DefaultGroupedListHeaderOrFooterRenderer

            DefaultGroupedListItemRenderer

            DefaultListItemRenderer

            DeviceCapabilities

            DisplayListWatcher

            DragData

            DragDropEvent

            DragDropManager

            Drawers

            DropDownPopUpContentManager

            ExclusiveTouch

            FeathersControl

            FeathersEventType

            FocusManager

            GroupedList

            Header

            HierarchicalCollection

            HorizontalLayout

            IDragSource

            IDropTarget

            IFeathersControl

            IFeathersDisplayObject

            IFeathersEventDispatcher

            IFocusDisplayObject

            IFocusExtras

            IFocusManager

            IGroupedListHeaderOrFooterRenderer

            IGroupedListItemRenderer

            IGroupedToggle

            IHierarchicalCollectionDataDescriptor

            ILayout

            ILayoutData

            ILayoutDisplayObject

            IListCollectionDataDescriptor

            IListItemRenderer

            ImageLoader

            ImageStateValueSelector

            IPopUpContentManager

            IScreen

            IScrollBar

            ITextEditor

            ITextEditorViewPort

            ITextRenderer

            IToggle

            ITrimmedVirtualLayout

            IVariableVirtualLayout

            IVirtualLayout

            Label

            LayoutBoundsResult

            LayoutGroup

            LayoutGroupGroupedListHeaderOrFooterRenderer

            LayoutGroupGroupedListItemRenderer

            LayoutGroupListItemRenderer

            List

            ListCollection

            NumericStepper

            OldFadeNewSlideTransitionManager

            PageIndicator

            Panel

            PanelScreen

            PickerList

            PopUpManager

            ProgressBar

            PropertyProxy

            Radio

            Scale3Image

            Scale3Textures

            Scale9Image

            Scale9ImageStateValueSelector

            Scale9Textures

            Screen

            ScreenFadeTransitionManager

            ScreenNavigator

            ScreenNavigatorItem

            ScreenSlidingStackTransitionManager

            ScrollBar

            ScrollContainer

            Scroller

            ScrollText

            SimpleScrollBar

            Slider

            SmartDisplayObjectStateValueSelector

            StageTextField

            StageTextTextEditor

            StandardIcons

            StateValueSelector

            StateWithToggleValueSelector

            TabBar

            TabBarSlideTransitionManager

            TextArea

            TextFieldTextEditor

            TextFieldTextEditorViewPort

            TextFieldTextRenderer

            TextInput

            TiledColumnsLayout

            TiledImage

            TiledRowsLayout

            ToggleGroup

            ToggleSwitch

            TokenList

            VectorIntListCollectionDataDescriptor

            VectorListCollectionDataDescriptor

            VectorNumberListCollectionDataDescriptor

            VectorUintListCollectionDataDescriptor

            VerticalCenteredPopUpContentManager

            VerticalLayout

            ViewPortBounds

            XMLListListCollectionDataDescriptor


text:
package com.github.nhirakawa.wilson.http.server.filter.before;

import com.github.nhirakawa.wilson.http.common.WilsonHeaders;
import io.javalin.http.Context;
import io.javalin.http.Handler;
import java.util.UUID;
import javax.inject.Inject;

/**
 * If X-Wilson-Request-Id header is missing, set it
 */
public class SetRequestId implements Handler {

  @Inject
  SetRequestId() {}

  @Override
  public void handle(Context ctx) throws Exception {
    if (ctx.header(WilsonHeaders.requestId()) == null) {
      ctx.header(WilsonHeaders.requestId(), UUID.randomUUID().toString());
    }
  }
}


text:
package voldemort.server.http.gui;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import voldemort.VoldemortException;
import voldemort.common.service.ServiceType;
import voldemort.server.VoldemortConfig;
import voldemort.server.VoldemortServer;
import voldemort.server.http.VoldemortServletContextListener;
import voldemort.server.storage.StorageService;
import voldemort.store.StorageEngine;
import voldemort.store.metadata.MetadataStore;
import voldemort.store.readonly.FileFetcher;
import voldemort.store.readonly.ReadOnlyStorageEngine;
import voldemort.store.readonly.ReadOnlyUtils;
import voldemort.utils.ByteArray;
import voldemort.utils.ReflectUtils;
import voldemort.utils.Utils;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * A servlet that supports both manual or programmatic operations on read only
 * stores. The operations are
 *

 *
FETCH. Fetch the given files to the local node. Parameters:
 * operation="fetch", dir=[data-directory], store=[name-of-store],
 * pushVersion=[version-of-push]

 *
SWAP. Swap the data directory atomically. Parameters: operation="swap",
 * store=[name-of-store]

 *
ROLLBACK. Rollback the store to previous push version. Parameters:
 * operation="rollback", store=[name-of-store],
 * pushVersion=[version-of-push-to-rollback-to]

 *

 *
 * DEPRECATED: Do not use anymore. This class has logic duplicated from the
 * {@link voldemort.server.protocol.admin.AdminServiceRequestHandler}. It has
 * not been maintained properly.
 *
 */
@Deprecated
public class ReadOnlyStoreManagementServlet extends HttpServlet {

    private static final long serialVersionUID = 1;
    private static final Logger logger = Logger.getLogger(ReadOnlyStoreManagementServlet.class);

    private volatile List<ReadOnlyStorageEngine> stores;
    private VelocityEngine velocityEngine;
    private FileFetcher fileFetcher;
    private MetadataStore metadataStore;

    public ReadOnlyStoreManagementServlet() {}

    public ReadOnlyStoreManagementServlet(VoldemortServer server, VelocityEngine engine) {
        this.stores = getReadOnlyStores(server);
        this.velocityEngine = Utils.notNull(engine);
        setFetcherClass(server);
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        VoldemortServer server = (VoldemortServer) config.getServletContext()
                                                         .getAttribute(VoldemortServletContextListener.SERVER_KEY);

        initMetadataStore(server);
        initStores(server);
        initVelocity(config);
        setFetcherClass(server);
    }

    public void initMetadataStore(VoldemortServer server) {
        this.metadataStore = Utils.notNull(server).getMetadataStore();
    }

    public void initStores(VoldemortServer server) {
        this.stores = getReadOnlyStores(server);
    }

    public void initVelocity(ServletConfig config) {
        this.velocityEngine = (VelocityEngine) Utils.notNull(config.getServletContext()
                                                                   .getAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY));
    }

    private void setFetcherClass(VoldemortServer server) {
        String className = server.getVoldemortConfig()
                                 .getAllProps()
                                 .getString("file.fetcher.class", null);
        if(className == null || className.trim().length() == 0) {
            this.fileFetcher = null;
        } else {
            try {
                logger.info("Loading fetcher " + className);
                Class<?> cls = Class.forName(className.trim());
                this.fileFetcher = (FileFetcher) ReflectUtils.callConstructor(cls,
                                                                              new Class<?>[] { VoldemortConfig.class },
                                                                              new Object[] { server.getVoldemortConfig() });
            } catch(Exception e) {
                throw new VoldemortException("Error loading file fetcher class " + className, e);
            }
        }
    }

    private List<ReadOnlyStorageEngine> getReadOnlyStores(VoldemortServer server) {
        StorageService storage = (StorageService) Utils.notNull(server)
                                                       .getService(ServiceType.STORAGE);
        List<ReadOnlyStorageEngine> l = Lists.newArrayList();
        for(StorageEngine<ByteArray, byte[], byte[]> engine: storage.getStoreRepository()
                                                                    .getStorageEnginesByClass(ReadOnlyStorageEngine.class)) {
            l.add((ReadOnlyStorageEngine) engine);
        }
        return l;
    }

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
            IOException {
        Map<String, Object> params = Maps.newHashMap();
        params.put("stores", stores);
        velocityEngine.render("read-only-mgmt.vm", params, resp.getOutputStream());
    }

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
            IOException {
        try {
            String operation = getRequired(req, "operation").toLowerCase();
            if("swap".equals(operation)) {
                doSwap(req, resp);
            } else if("fetch".equals(operation)) {
                doFetch(req, resp);
            } else if("rollback".equals(operation)) {
                doRollback(req);
            } else if("failed-fetch".equals(operation)) {
                doFailedFetch(req);
            } else {
                throw new IllegalArgumentException("Unknown operation parameter: "
                                                   + req.getParameter("operation"));
            }
        } catch(Exception e) {
            logger.error("Error while performing operation.", e);
            resp.sendError(500, "Error while performing operation: " + e.getMessage());
        }
    }

    private void doFailedFetch(HttpServletRequest req) throws ServletException {
        String dir = getRequired(req, "dir");
        String storeName = getRequired(req, "store");

        try {

            if(!Utils.isReadableDir(dir))
                throw new ServletException("Could not read folder " + dir
                                           + " correctly to delete it");

            ReadOnlyStorageEngine store = this.getStore(storeName);
            if(store.getCurrentVersionId() == ReadOnlyUtils.getVersionId(new File(dir))) {
                logger.warn("Cannot delete " + dir + " for " + storeName
                            + " since it is the current dir");
                return;
            }

            Utils.rm(new File(dir));
        } catch(Exception e) {
            throw new ServletException(e);
        }
    }

    private void doSwap(HttpServletRequest req, HttpServletResponse resp) throws IOException,
            ServletException {
        String dir = getRequired(req, "dir");
        String storeName = getRequired(req, "store");

        if(metadataStore != null
           && !metadataStore.getServerStateUnlocked()
                            .equals(MetadataStore.VoldemortState.NORMAL_SERVER)
           && !metadataStore.getServerStateUnlocked()
                            .equals(MetadataStore.VoldemortState.OFFLINE_SERVER)) {
            throw new ServletException("Voldemort server is neither in normal state nor in offline state");
        }

        ReadOnlyStorageEngine store = this.getStore(storeName);
        if(store == null)
            throw new ServletException("'" + storeName + "' is not a registered read-only store.");

        if(!Utils.isReadableDir(dir))
            throw new ServletException("Store directory '" + dir + "' is not a readable directory.");

        // Retrieve the current directory before swapping it
        String currentDirPath = store.getCurrentDirPath();

        // Swap with the new directory
        store.swapFiles(dir);

        // Send back the previous directory
        resp.getWriter().write(currentDirPath);
    }

    private void doFetch(HttpServletRequest req, HttpServletResponse resp) throws IOException,
            ServletException {
        String fetchUrl = getRequired(req, "dir");
        String storeName = getRequired(req, "store");
        String pushVersionString = getOptional(req, "pushVersion");

        ReadOnlyStorageEngine store = this.getStore(storeName);
        if(store == null)
            throw new ServletException("'" + storeName + "' is not a registered read-only store.");

        long pushVersion;
        if(pushVersionString == null) {
            // Find the max version
            long maxVersion;
            File[] storeDirList = ReadOnlyUtils.getVersionDirs(new File(store.getStoreDirPath()));
            if(storeDirList == null || storeDirList.length == 0) {
                throw new ServletException("Push version required since no version folders exist");
            } else {
                maxVersion = ReadOnlyUtils.getVersionId(ReadOnlyUtils.findKthVersionedDir(storeDirList,
                                                                                storeDirList.length - 1,
                                                                                storeDirList.length - 1)[0]);
            }
            pushVersion = maxVersion + 1;
        } else {
            pushVersion = Long.parseLong(pushVersionString);
            if(pushVersion <= store.getCurrentVersionId())
                throw new ServletException("Version of push specified (" + pushVersion
                                           + ") should be greater than current version "
                                           + store.getCurrentVersionId());
        }

        // fetch the files if necessary
        File fetchDir = null;
        if(fileFetcher == null) {

            logger.warn("File fetcher class has not instantiated correctly. Assuming local file");

            if(!Utils.isReadableDir(fetchUrl)) {
                throw new ServletException("Fetch url " + fetchUrl + " is not readable");
            }

            fetchDir = new File(store.getStoreDirPath(), "version-" + Long.toString(pushVersion));

            if(fetchDir.exists())
                throw new ServletException("Version directory " + fetchDir.getAbsolutePath()
                                           + " already exists");

            Utils.move(new File(fetchUrl), fetchDir);

        } else {
            logger.info("Executing fetch of " + fetchUrl);

            try {
                fetchDir = fileFetcher.fetch(fetchUrl, store.getStoreDirPath() + File.separator
                                                       + "version-" + Long.toString(pushVersion));

                if(fetchDir == null) {
                    throw new ServletException("File fetcher failed for " + fetchUrl
                                               + " and store name = " + storeName
                                               + " due to incorrect input path/checksum error");
                } else {
                    logger.info("Fetch complete.");
                }

            } catch(Exception e) {
                throw new ServletException("Exception in Fetcher = " + e.getMessage());
            }

        }
        resp.getWriter().write(fetchDir.getAbsolutePath());
    }

    private void doRollback(HttpServletRequest req) throws ServletException {
        String storeName = getRequired(req, "store");
        long pushVersion = Long.parseLong(getRequired(req, "pushVersion"));

        ReadOnlyStorageEngine store = getStore(storeName);
        if(store == null)
            throw new ServletException("'" + storeName + "' is not a registered read-only store.");

        try {
            File rollbackVersionDir = new File(store.getStoreDirPath(), "version-" + pushVersion);

            store.rollback(rollbackVersionDir);
        } catch(Exception e) {
            throw new ServletException("Exception in rollback = " + e.getMessage());
        }
    }

    private String getOptional(HttpServletRequest req, String name) {
        return req.getParameter(name);
    }

    private String getRequired(HttpServletRequest req, String name) throws ServletException {
        String val = req.getParameter(name);
        if(val == null)
            throw new ServletException("Missing required parameter '" + name + "'.");
        return val;
    }

    private ReadOnlyStorageEngine getStore(String storeName) throws ServletException {
        for(ReadOnlyStorageEngine store: this.stores)
            if(store.getName().equals(storeName))
                return store;
        throw new ServletException("'" + storeName + "' is not a registered read-only store.");
    }
}


text:
package org.apache.samza.coordinator.server

import org.apache.samza.job.model.JobModel
import org.apache.samza.util.Logging

/**
 * A servlet that dumps the job model for a Samza job.
 */
class JobServlet(jobModelGenerator: () => JobModel) extends ServletBase with Logging {
  protected def getObjectToWrite() = jobModelGenerator()
}


text:
@interface MyMapClassBeginTime : NSObject

@property (nonatomic) NSString *beginTime;
@property (nonatomic) NSString *beginTimeFormatted;

+(MyMapClassBeginTime *)classBeginTimeWithDictionary:(NSDictionary *)dict;

@end


text:
{{<layout}}

{{$pageTitle}} You don't need to tell DVLA about your condition {{/pageTitle}}

{{$head}}
	{{>includes/head}}
	{{>includes/scripts}}
{{/head}}

{{$content}}
{{>includes/buttons/no-back-phase-banner}}

 You don't need to tell DVLA about your

As your last transient ischaemic attack (TIA) more than 3 months ago and they are not causing any problems that may affect your driving, you do not need to tell DVLA.

What happens next?

If any of the following apply:

you have had more than one recent stroke or TIA

one month after your stroke you are still suffering from weakness of the arms or legs, visual disturbance, or problems with co-ordination, memory or understanding

you have had any kind of seizure, unless it happened at the time of your stroke or TIA or within the following 24 hours and you have never had a seizure, stroke or TIA before

you needed brain surgery as part of the treatment for your stroke

a person providing your medical care has said he/she is concerned about your ability to drive safely

you hold a current Large Goods Vehicle (LGV) or Passenger Carrying Vehicle (PCV) (Group 2) driving licence

…you should  download, complete and return all relevant paper forms to DVLA by post.

Change in your condition

If you develop another medical condition or there is any change to your existing medical condition, you must inform DVLA.

			{{>includes/buttons/govuk}}

{{/content}}

{{/layout}}


text:
package cfclient

import (
	"net/url"
	"testing"

	. "github.com/smartystreets/goconvey/convey"
)

func TestListAppUsageEvents(t *testing.T) {
	Convey("List App Usage Events", t, func() {
		mocks := []MockRoute{
			{"GET", "/v2/app_usage_events", listAppUsageEventsPayload, "", 200, "", nil},
			{"GET", "/v2/app_usage_eventsPage2", listAppUsageEventsPayloadPage2, "", 200, "results-per-page=2&page=2", nil},
		}
		setupMultiple(mocks, t)
		defer teardown()
		c := &Config{
			ApiAddress: server.URL,
			Token:      "foobar",
		}
		client, err := NewClient(c)
		So(err, ShouldBeNil)

		appUsageEvents, err := client.ListAppUsageEvents()
		So(err, ShouldBeNil)

		So(len(appUsageEvents), ShouldEqual, 4)
		So(appUsageEvents[0].GUID, ShouldEqual, "b32241a5-5508-4d42-893c-360e42a300b6")
		So(appUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:33Z")
	})
}

func TestListAppUsageEventsByQuery(t *testing.T) {
	Convey("List App Usage Events", t, func() {
		mocks := []MockRoute{
			{"GET", "/v2/app_usage_events", listAppUsageEventsPayload, "", 200, "results-per-page=2", nil},
			{"GET", "/v2/app_usage_eventsPage2", listAppUsageEventsPayloadPage2, "", 200, "results-per-page=2&page=2", nil},
		}
		setupMultiple(mocks, t)
		defer teardown()
		c := &Config{
			ApiAddress: server.URL,
			Token:      "foobar",
		}
		client, err := NewClient(c)
		So(err, ShouldBeNil)

		var query = url.Values{
			"results-per-page": []string{
				"2",
			},
		}
		appUsageEvents, err := client.ListAppUsageEventsByQuery(query)
		So(err, ShouldBeNil)

		So(len(appUsageEvents), ShouldEqual, 4)
		So(appUsageEvents[0].GUID, ShouldEqual, "b32241a5-5508-4d42-893c-360e42a300b6")
		So(appUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:33Z")
	})
}


text:
package com.cloudhopper.commons.charset;

/**
 * This class encodes and decodes Java Strings to and from the Latin-1/ISO-8859-1
 * alphabet.
 *
 * @author joelauer (twitter: @jjlauer or http://twitter.com/jjlauer)
 */
public class ISO88591Charset extends JavaCharset {

    public ISO88591Charset() {
        super("ISO-8859-1");
    }

    @Override
    public int estimateEncodeByteLength(CharSequence str0) {
        if (str0 == null) {
            return 0;
        }
        // only 8-bit chars
        return str0.length();
    }

    @Override
    public int estimateDecodeCharLength(byte[] bytes) {
        if (bytes == null) {
            return 0;
        }
        // only 8-bit chars
        return bytes.length;
    }

}


text:
package net.lecousin.framework.core.tests.concurrent.threads;

import net.lecousin.framework.application.LCCore;
import net.lecousin.framework.concurrent.CancelException;
import net.lecousin.framework.concurrent.Executable;
import net.lecousin.framework.concurrent.threads.Task;
import net.lecousin.framework.concurrent.threads.Task.Priority;
import net.lecousin.framework.concurrent.threads.Threading;
import net.lecousin.framework.core.test.LCCoreAbstractTest;
import net.lecousin.framework.mutable.MutableBoolean;
import net.lecousin.framework.mutable.MutableInteger;

import org.junit.Assert;
import org.junit.Test;

public class TestTask extends LCCoreAbstractTest {

	@Test
	public void test() throws Exception {
		Task<Object,?> task = Task.cpu("test", Task.Priority.NORMAL, t -> null).start();
		Assert.assertEquals(Threading.getCPUTaskManager(), task.getTaskManager());
		Assert.assertEquals(LCCore.getApplication(), task.getApplication());

		MutableBoolean ok = new MutableBoolean(false);
		Task.cpu("test", Task.Priority.NORMAL, new Executable.FromRunnable(() -> {
			ok.set(true);
		})).start().getOutput().block(0);
		Assert.assertTrue(ok.get());

		MutableInteger i = new MutableInteger(0);
		Task.cpu("test", Task.Priority.NORMAL, new Executable.FromRunnable(() -> {
			i.inc();
		}), r -> {
			i.inc();
		}).start().getOutput().block(0);
		Assert.assertEquals(2, i.get());

		i.set(0);
		task = Task.cpu("test", Task.Priority.NORMAL, t -> {
			i.inc();
			return null;
		}, r -> {
			i.inc();
		});
		Assert.assertFalse(task.isDone());
		task.getOutput().cancel(new CancelException("a cancel test"));
		task.start();
		Assert.assertTrue(task.isCancelled());
		Assert.assertTrue(task.isDone());
		Assert.assertEquals(0, i.get());

		Task<Integer, ?> unmanaged = Task.unmanaged("test", Task.Priority.NORMAL, t -> Integer.valueOf(111));
		unmanaged.startOn(true);
		Assert.assertEquals(111, unmanaged.getOutput().blockResult(0).intValue());

		Task<Integer, Exception> done;
		done = Task.done(Integer.valueOf(1), null);
		Assert.assertTrue(done.isDone());
		Assert.assertTrue(done.isSuccessful());
		Assert.assertEquals(1, done.getOutput().getResult().intValue());
		done = Task.done(null, new Exception());
		Assert.assertTrue(done.isDone());
		Assert.assertFalse(done.isSuccessful());
	}

	@Test
	public void testPriority() {
		Priority p = Priority.URGENT;
		do {
			Priority less = p.less();
			if (less.getValue() == p.getValue())
				break;
			p = less;
		} while (true);
		p = Priority.BACKGROUND;
		do {
			Priority more = p.more();
			if (more.getValue() == p.getValue())
				break;
			p = more;
		} while (true);
	}

}