text:
<?php

class Reports_LeadController extends Zend_Controller_Action
{

    public $db;

    function init()
    {
        $this->db = Zend_Registry::get('db');
    }

    /**
     * Links to lead reports
     */
    public function indexAction()
    {
        $form = new Core_Form_Lead_Report;

        if ($this->_request->isPost()) {

            if ($form->isValid($_POST)) {
                /*
                 * Process data
                 */
                $select = $this->db->select();
                $select->from(array('l' => 'lead'),
                            array('leadId', 'firstName', 'lastName', 'companyName', 'mobile'))
                        ->joinLeft(array('ls'=>'leadSource'),
                            'l.leadSourceId = ls.leadSourceId', array('ls.name'=>'name'))
                        ->joinLeft(array('lst'=>'leadStatus'),
                            'l.leadStatusId = lst.leadStatusId', array('lst.name'=>'name'))
                        ->group('l.leadId');
                $name = $this->_getParam('name');
                if (isset($name)) {
                    $select->where('firstName like ?', '%' . $this->_getParam('name') . '%');
                    $select->orWhere('middleName like ?', '%' . $this->_getParam('name') . '%');
                    $select->orWhere('lastName like ?', '%' . $this->_getParam('name') . '%');
                } else {
                    $select->where('firstName like ?', '%' . $this->_getParam('firstName') . '%');
                    $select->where('middleName like ?', '%' . $this->_getParam('middleName') . '%');
                    $select->where('lastName like ?', '%' . $this->_getParam('lastName') . '%');
                }
                $sql = $select->__toString();
                $totalSelect = $this->db->select()->from(
                    array(
                        'tmp' => new Zend_Db_Expr('(' . $sql . ')'), array('count(1)')
                    )
                );
                $totalSelect = "SELECT count(1) from ($sql) totalRecords";

                $totalResult = $this->db->fetchOne($totalSelect);
             echo "Total is $totalResult";
                $result = $this->db->fetchAll($select);
                $this->view->result = $result;

                $this->view->reportGenerated = true;
            } else {
               $form->populate($_POST);

               $this->view->form = $form;
            }

        } else {

           $this->view->form = $form;
        }
    }

    /*
     * Lead reports based on date range
     */
    public function daterangeAction()
    {
        $this->_helper->layout->setLayout('layout_reports');
        $form = new Core_Form_Lead_Report_Type1;

        if ($this->_request->isPost()) {

            if ($form->isValid($_POST)) {
                $leadReport = new Core_Model_Lead_Report;
                $leadReportUserInput = $form->getValues();
                $select = $leadReport->generateSelectObject($leadReportUserInput);
                $leadReportDateRange = new Zend_Session_Namespace('leadReportDateRange');

                /*
                 * The browse action determines the search criteria
                 * based on the reportId
                 * Thus set the reportId using $count
                 */
                $count = 0;
                if (is_array($leadReportDateRange->data)) {
                    $count = count($leadReportDateRange->data);
                }
                $count++;
                $leadReportDateRange->data["{$count}"] = $leadReportUserInput;
                $leadReportDateRange->userInput = $leadReportUserInput;
                $this->view->reportId = $count;

                /*
                 * Clone the $select object
                 * The cloned objects add further where clauses
                 */
                $selectForLeadStatus = clone $select;

                $leadHelper = new Core_Model_Lead_Helper;
                $leadSource = $leadHelper->getLeadSource();

                /*
                 * Generate the report array based on lead source
                 */
                $leadSourceReportSummary = array();
                foreach ($leadSource as $ls){
                    $lsNameSelect = clone $select;
                    $lsName  = $lsNameSelect->where('ls.name = ? ', $ls->name);
                    $totalSelect = "SELECT count(1) from ( " . $lsName->__toString() . " ) totalRecords";
#                    echo $totalSelect; exit(1);
                    $count = $this->db->fetchOne($totalSelect);
                    $newArrayKeyToBeInserted = $ls->name;
                    $leadSourceReportSummary["{$newArrayKeyToBeInserted}"] = $count;
                }

                $this->view->leadSourceReportSummary = $leadSourceReportSummary;

                /* Generate the report array based on lead status
                 *
                 */
                $leadStatus = $leadHelper->getLeadStatus();
                $leadStatusReportSummary = array();
                foreach ($leadStatus as $ls){
                    $lsNameSelect = clone $select;
                    $lsName  = $lsNameSelect->where('lst.name = ? ', $ls->name);
                    $totalSelect = "SELECT count(1) from ( " . $lsName->__toString() . " ) totalRecords";
                    $count = $this->db->fetchOne($totalSelect);
                    $newArrayKeyToBeInserted = $ls->name;
                    $leadStatusReportSummary["{$newArrayKeyToBeInserted}"] = $count;
                }

                $this->view->leadStatusReportSummary = $leadStatusReportSummary;

                /* Generate the report array based on conversion status
                 *
                 */
                $convertSelect = clone $select;
                $convertQuery = $convertSelect->where('l.converted = 1');
                $totalSelect = "SELECT count(1) FROM ( " . $convertQuery->__toString() . " ) totalRecords";
                $count = $this->db->fetchOne($totalSelect);
                $leadConvertedReportSummary['Converted'] = $count;

                $convertSelect = clone $select;
                $convertQuery = $convertSelect->where('l.converted = 0');
                $totalSelect = "SELECT count(1) FROM ( " . $convertQuery->__toString() . " ) totalRecords";
                $count = $this->db->fetchOne($totalSelect);
                $leadConvertedReportSummary['Not Converted'] = $count;

                $this->view->leadConvertedReportSummary = $leadConvertedReportSummary;

            } else {
               $form->populate($_POST);

#               $this->view->form = $form;
            }

        } else {

           $this->view->form = $form;
        }

  #        $this->view->form = $form;
    }

    /**
     * Browse leads online using the select object generated in
     * Date range action before
     */
    public function browseAction()
    {
        $leadReportDateRange = new Zend_Session_Namespace('leadReportDateRange');

        $reportId = $this->_getParam('reportId');
        if (!is_numeric($reportId)) {
            return;
        }
        $userInput = $leadReportDateRange->data["{$reportId}"];

        $leadReport = new Core_Model_Lead_Report;
        $select = $leadReport->generateSelectObject($userInput);

        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
        $paginator->setCurrentPageNumber($this->_getParam('page'));
        $paginator->setItemCountPerPage(25);
        $this->view->paginator = $paginator;
        $this->view->reportId = $reportId;

    }

    public function csvexportAction()
    {
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

        $leadReportDateRange = new Zend_Session_Namespace('leadReportDateRange');
        $reportId = trim($this->_getParam('reportId'));

        $userInput = $leadReportDateRange->data["{$reportId}"];

        $leadReport = new Core_Model_Lead_Report;
        $select = $leadReport->generateSelectObject();

        $result = $this->db->fetchAll($select, array(), Zend_Db::FETCH_ASSOC);

        $file = '';
        $file .= "Sl. no., First Name, Middele Name, Last Name, Created,";
        $file .= "Updated, Source, Status, Assign To,Branch";
        $file .= PHP_EOL;

        foreach ($result as $row) {
            $line = '';
            $date = new Zend_Date();
            $date->setTimestamp($row['created']);
            $row['created'] = $date->toString();

            if ($row['updated']) {
                $date->setTimestamp($row['updated']);
                $row['updated'] = $date->toString();
            }
            foreach ($row as $item) {
                $escapeSpecialChar = str_replace("\r\n", "", $item);
                $escapeSpecialChar = str_replace(",", " ", $escapeSpecialChar);
                $escapeSpecialChar = str_replace('"', '""', $escapeSpecialChar);
                $escapeSpecialChar = '"' . $escapeSpecialChar . '",';
               $line .= $escapeSpecialChar;
            }
            $file .= $line . PHP_EOL;
        }

        $this->getResponse()->setHeader('Content-Type', 'application/csv')
                            ->setHeader('Content-disposition', 'attachment; filename=leadreport.csv')
                            ->appendBody($file);
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--

    Copyright 2005 Sakai Foundation Licensed under the
    Educational Community License, Version 2.0 (the "License"); you may
    not use this file except in compliance with the License. You may
    obtain a copy of the License at

    http://www.osedu.org/licenses/ECL-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an "AS IS"
    BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
    or implied. See the License for the specific language governing
    permissions and limitations under the License.

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:rsf="http://ponder.org.uk/rsf" xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Add Item Control Renderer:</title>
    <!-- this JS needed to make the pulldown work correctly - ../content/js/evalUtils.js -->
</head>
<body>

<!-- html template for the text item renderer -AZ -->
<div rsf:id="render_add_item_control:" style="display:inline;">
	<form rsf:id="add-item-form" name="add_item_form">
		<select rsf:id="add-item-classification" id="add-item-classification-selection">
			<option value="render_scaled_item.html" selected="selected">Scaled/Survey</option>
			<option value="render_text_item.html">Short Answer/Essay</option>
			<option value="render_header_item.html">Text Header</option>
		</select>
		<input rsf:id="add-item-button" id="add-item-button" type="button" value="Add"
			onclick="EvalSystem.operateSelectLink(this.id, 'add-item-classification-selection')" />
	</form>
</div>

</body>
</html>

redpajama_set_name: RedPajamaGithub


text:
class Nagira < Sinatra::Base

  ##
  # Parse nagios files.
  #
  # Note: *.parse methods are monkey-patched here (if you have required
  # 'lib/nagira' above) to set min parsing interval to avoid file paring
  # on each HTTP request. File is parsed only if it was changed and if
  # it was parsed more then 60 (default) seconds ago. See
  # +lib/nagira/timed_parse.rb+ for mor more info.
  #
  # In development mode use files located under +./test/data+
  # directory. This allows to do development on the host where Nagios is
  # notinstalled. If you want to change this edit configuration in
  # config/environment.rb file.
  #
  # See also comments in config/default.rb file regarding nagios_cfg,
  # status_cfg, objects_cfg.
  #
  # @method   parse_nagios_files
  # @overload before("Parse Nagios files")
  before do
    Logger.log("BackgroundParser is not running", :warning) if
      BackgroundParser.configured? && BackgroundParser.dead?

    Parser.parse

    @status = Parser.status['hosts']
    @objects = Parser.objects

    #
    # Add plural keys to use ActiveResource with Nagira
    #
    @objects.keys.each do |singular|
      @objects[singular.to_s.pluralize.to_sym] = @objects[singular]
    end
  end

  ##
  # @method     clear_instance_data
  # @overload before("clear data")
  #
  # Clear values onf instance variables before start.
  #
  before do
    @data = []
    @format = @output = nil
  end

  ##
  # @method     strip_extensions
  # @overload before("detect format")
  #
  # Detect and strip output format extension
  #
  # Strip extension (@format) from HTTP route and set it as instance
  # variable @format. Valid formats are .xml, .json, .yaml. If format
  # is not specified, it is set to default format
  # (Nagira.settings.format).
  #
  # \@format can be assigned one of the symbols: :xml, :json, :yaml.
  #
  # = Examples
  #
  #     GET /_objects              # => default format
  #     GET /_objects.json         # => :json
  #     GET /_status/_list.yaml    # => :yaml
  #
  before do
    request.path_info.sub!(/#{settings.format_extensions}/, '')
    @format = ($1 || settings.format).to_sym
    content_type "application/#{@format.to_s}"
  end

  ##
  # @method   detect_ar_type
  # @overload before('detect ActiveResource mode')
  #
  # Detect if this a request for ActiveResource PATH
  #
  before do
    @active_resource = request.path_info =~ %r{^#{Nagira::AR_PREFIX}/}
  end

  ##
  # @method   strip_output_type
  # @overload before('detect output mode')
  #
  # Detect output mode modifier
  #
  # Detect and strip output type from HTTP route. Full list of
  # output types is +:list+, +:state+ or +:full+, corresponding to
  # (+/list, +/state+, +/full+ routes).
  #
  # Output type defined by route modifier appended to the end of HTTP
  # route. If no output type specfied it is set to +:full+. Output
  # mode can be followed by format extension (+.json+, +.xml+ or
  # +.yaml+).
  #
  # = Examples
  #
  #     GET /_objects/_list     # => :list
  #     GET /_status/_state     # => :state
  #     GET /_status/:hostname  # => :full
  #     GET /_status            # => :normal
  #
  before do
    request.path_info.sub!(/\/_(list|state|full)$/, '')
    @output = ($1 || :normal).to_sym
  end

  ##
  # @method find_jsonp_callback
  # @overload before('find callback name')
  #
  # Detects if request is using jQuery JSON-P and sets @callback
  # variable. @callback variable is used if after method and prepends
  # JSON data with callback function name.
  #
  # = Example
  #
  #      GET /_api?callback=jQuery12313123123 # @callback == jQuery12313123123
  #
  # JSONP support is based on the code from +sinatra/jsonp+ Gem
  # https://github.com/shtirlic/sinatra-jsonp.
  #
  before do
    if @format == :json
      ['callback','jscallback','jsonp','jsoncallback'].each do |x|
        @callback = params.delete(x) unless @callback
      end
    end
  end

  # @method parse_input_data
  # @overload before("Parse PUT request body")
  #
  # Process the data before on each HTTP request.
  #
  # @return [Array] @input Sets @input instance variable.
  #
  before do
    if request.put?
      data = request.body.read
      @input = case @format
              when :json then JSON.parse    data
              when :xml  then Hash.from_xml data
              when :yaml then YAML.load     data
              end
      # Make sure we always return an Array
      @input = [@input] if @input.is_a? Hash
      @input
    end
  end

end


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <?php
        if (isset($meta_data) && count($meta_data) > 0) {
            ?>
            <meta name='title' content="<?php echo $meta_data['meta_title'] ?>">
            <meta name='keywords' content="<?php echo $meta_data['meta_keyword'] ?>">
            <meta name='description' content="<?php echo $meta_data['meta_description'] ?>">
            <title><?php echo $meta_data['meta_title'] ?></title>
            <?php
        }
        else
        {
            ?>
            <title>Habby</title>
            <?php
        }
        ?>

        <link rel="stylesheet" type="text/css" href="<?php echo DEFAULT_CSS_PATH . "bootstrap.css" ?>"/>

        <link href="https://fonts.googleapis.com/css?family=Noto+Sans|Roboto+Mono" rel="stylesheet">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" href="<?php echo DEFAULT_CSS_PATH . "style.css" ?>"/>
        <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Lato:400,100,300,700,900' rel='stylesheet' type='text/css'>
        <link href="https://fonts.googleapis.com/css?family=Quicksand:300,400,700" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Philosopher:400,400i,700,700i" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,300,400,500,600,700,800,900" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="<?php echo DEFAULT_CSS_PATH . "narola.css" ?>"/>

            <?php
            $language = $this->session->userdata('language');
//            echo $language;
            ?>

                            <img src="<?php echo DEFAULT_IMAGE_PATH . "logo.png" ?>" class="img-responsive logo_img2">

                                    <form class="" role="form" method="post" action="<?php echo base_url() . "login" ?>">

                                                <input type="text" class="form-control" name="login_email" id="login_email" placeholder="<?php echo lang('E-mail'); ?>" value="<?php echo set_value('login_email'); ?>">

                                                <input type="password" class="form-control" name="password" id="pwd" placeholder="<?php echo lang('Password'); ?>">

                                                <input type="submit" class="login_btn" value="<?php echo lang('Login'); ?>">

                                                    <select class="selectpicker" data-style="btn-info">
                                                        <option value="eng" <?php echo ($language == 'english') ? 'selected' : "" ?>><?php echo lang('English') ?></option>
                                                        <option value="fr" <?php echo ($language == 'french') ? 'selected' : "" ?>><?php echo lang('French') ?></option>
                                                        <option value="ru" <?php echo ($language == 'russian') ? 'selected' : "" ?>><?php echo lang('Russian') ?></option>
                                                    </select>

                                                        <input type="checkbox" name="remember_me" value="1" > <?php echo lang('Keep me logged in'); ?>

                                                    <a href="<?php echo base_url() . "user/forgot_password" ?>"><?php echo lang("I've forgotten my password"); ?>

                                    </form>

                <?php
                $message = $this->session->flashdata('message');
                if (!empty($message) && isset($message)) {
                    ($message['class'] != '') ? $message['class'] : '';
                    echo '
' . $message['message'] . '
';
                }

                $all_errors = validation_errors();
                if (isset($all_errors) && !empty($all_errors)) {
                    echo '
' . $all_errors . '
';
                }
                ?>

            <?php
            if (isset($body) && !empty($body)) {
                echo $body;
            }
            ?>


text:
package com.gyg9.android.task.delayedrunner;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * To work on unit tests, switch the Test Artifact in the Build Variants view.
 */
public class ExampleUnitTest {
	@Test
	public void addition_isCorrect() throws Exception {
		assertEquals(4, 2 + 2);
	}
}


text:
<?php
$this->breadcrumbs=array(
	'News',
);

$this->menu=array(
	array('label'=>'Create News', 'url'=>array('create')),
	array('label'=>'Manage News', 'url'=>array('admin')),
);
?>

News

<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); ?>


text:
/*	$NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $	*/

/*-
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * William Jolitz.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
 * $FreeBSD$
 */

#include <machine/asm.h>
#include <sys/syscall.h>
#include <machine/swi.h>

#define SYSTRAP(x)							\
			mov ip, r7;					\
			ldr r7, =SYS_ ## x;				\
			swi 0;						\
			mov r7, ip

#define	CERROR		_C_LABEL(cerror)
#define	CURBRK		_C_LABEL(curbrk)

#define _SYSCALL_NOERROR(x)						\
	ENTRY(__CONCAT(__sys_, x));					\
	.weak _C_LABEL(x);						\
	.set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x));			\
	.weak _C_LABEL(__CONCAT(_,x));					\
	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
	SYSTRAP(x)

#define _SYSCALL(x)							\
	_SYSCALL_NOERROR(x);						\
	it	cs;							\
	bcs PIC_SYM(CERROR, PLT)

#define SYSCALL(x)							\
	_SYSCALL(x)

#define PSEUDO(x)							\
	ENTRY(__CONCAT(__sys_, x));					\
	.weak _C_LABEL(__CONCAT(_,x));					\
	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
	SYSTRAP(x);							\
	it	cs;							\
	bcs PIC_SYM(CERROR, PLT);					\
	RET

#define RSYSCALL(x)							\
	_SYSCALL(x);							\
	RET

	.globl  CERROR


text:
import angular from "angular";
import {registerComponents, registerStores} from "../common/module-utils";

import userAgentInfoStore from "./services/user-agent-info-store";
import userService from "./services/user-service";
import userStore from "./services/user-store";
import userPreferenceStore from "./services/user-preference-store";
import userPickList from "./components/user-pick-list/user-pick-list";

import hasRole from "./directives/has-role";
import hasRoleForEntityKind from "./directives/has-role-for-entity-kind";
import unlessRole from "./directives/unless-role";
import Routes from "./routes";
import * as _ from "lodash";
import {checkIsEntityRef} from "../common/checks";

export const lastViewedMeasurableCategoryKey = "main.measurable-category.list.lastCategory";
export const appLogicalFlowFilterExcludedTagIdsKey = "main.app-view.logical-flow.filter.excludedTagIds";
export const groupLogicalFlowFilterExcludedTagIdsKey = "main.group-views.logical-flow.filter.excludedTagIds";
export const favouriteAssessmentDefinitionIdsKey = "main.app-view.assessment-rating.favouriteAssessmentDefnIds";
export const lastViewedFlowTabKey = "main.app-view.data-flows.lastTab";

export function mkAssessmentDefinitionsIdsBaseKey(entityReference) {
    checkIsEntityRef(entityReference);
    return `${favouriteAssessmentDefinitionIdsKey}.${_.camelCase(entityReference.kind)}`;
}

export default () => {
    const module = angular.module("waltz.user", []);

    module
        .config(Routes);

    registerStores(module, [userStore, userPreferenceStore]);
    registerComponents(module, [userPickList]);

    module
        .service("UserAgentInfoStore", userAgentInfoStore)
        .service("UserService", userService);

    module
        .directive("waltzHasRole", hasRole)
        .directive("waltzHasRoleForEntityKind", hasRoleForEntityKind)
        .directive("waltzUnlessRole", unlessRole);

    return module.name;
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2010-2015 Senthil Maruthaiappan
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  ~
  ~
  -->

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="propertyConfigurer"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>classpath:test.properties</value>
        </property>
    </bean>

    <!--test user -->
    <bean id="TEST_USER_CONTEXT" class="org.qamatic.mintleaf.oracle.OracleDbContext"
          primary="true">
        <constructor-arg>
            <bean class="org.apache.commons.dbcp2.BasicDataSource">
                <property name="url" value="${test_db.url}"/>
                <property name="username" value="${test_db.username}"/>
                <property name="password" value="${test_db.password}"/>
                <property name="validationQuery" value="Select 1 from dual"/>
                <property name="testOnBorrow" value="true"/>
                <property name="testOnReturn" value="true"/>
                <property name="accessToUnderlyingConnectionAllowed">
                    <value>true</value>
                </property>
            </bean>
        </constructor-arg>
    </bean>

    <!--admin user to create test user / schema-->
    <bean id="ADMIN_USER_CONTEXT" class="org.qamatic.mintleaf.oracle.OracleDbContext"
          primary="true">
        <constructor-arg>
            <bean class="org.apache.commons.dbcp2.BasicDataSource">
                <property name="url" value="${admin_db.url}"/>
                <property name="username" value="${admin_db.username}"/>
                <property name="password" value="${admin_db.password}"/>
                <property name="validationQuery" value="Select 1 from dual"/>
                <property name="testOnBorrow" value="true"/>
                <property name="testOnReturn" value="true"/>
                <property name="accessToUnderlyingConnectionAllowed">
                    <value>true</value>
                </property>
            </bean>
        </constructor-arg>
    </bean>

</beans>

        <!--db.url=jdbc:oracle:thin:@<hostname>:1521:TESTORCL-->


text:
using Ds3.Helpers.Streams;
using NUnit.Framework;
using System.IO;
using System.Text;

namespace TestDs3.Helpers.Streams
{
    [TestFixture]
    internal class TestObjectRequestStream
    {
        [Test]
        public void TestTotalByteRead()
        {
            var inlineStream = new MemoryStream(Encoding.UTF8.GetBytes("abcdefghij"));
            var stream = new ObjectRequestStream(inlineStream, 0, 10);
            var requestStream = new byte[10];

            Assert.AreEqual(0, stream.Position);
            Assert.AreEqual(0, stream.GetTotalBytesRead());

            stream.Read(requestStream, 0,  10);

            Assert.AreEqual(10, stream.Position);
            Assert.AreEqual(10, stream.GetTotalBytesRead());

            stream.Position = 0;

            Assert.AreEqual(0, stream.Position);
            Assert.AreEqual(0, stream.GetTotalBytesRead());
        }
    }
}


text:
#include <assert.h>

#include <array>

#include "cl_inputmap_generator.h"
#include "SceneGraph/uberv2material.h"
#include "SceneGraph/inputmaps.h"

using namespace Baikal;

const std::string header = "#ifndef INPUTMAPS_CL\n#define INPUTMAPS_CL\n\n";
const std::string footer = "#endif\n\n";

const std::string float4_selector_header =
    "float4 GetInputMapFloat4(uint input_id, DifferentialGeometry const* dg, GLOBAL InputMapData const* restrict input_map_values, TEXTURE_ARG_LIST)\n{\n"
    "\tswitch(input_id)\n\t{\n";
const std::string float4_selector_footer = "\t}\n\treturn 0.0f;\n}\n";

const std::string float_selector_header =
    "float GetInputMapFloat(uint input_id, DifferentialGeometry const* dg, GLOBAL InputMapData const* restrict input_map_values, TEXTURE_ARG_LIST)\n{\n"
    "\treturn GetInputMapFloat4(input_id, dg, input_map_values, TEXTURE_ARGS).x;\n"
    "}\n";

void CLInputMapGenerator::Generate(const Collector& input_map_collector, const Collector& input_map_leaf_collector)
{
    m_source_code = header;
    m_read_functions.clear();
    m_float4_selector = float4_selector_header;
    m_float_selector = float_selector_header;

    m_generated_inputs.clear();

    // We need to guarantee order. So sort it by id using map
    std::map <uint32_t, InputMap::Ptr> inputs;

    auto mat_iter = input_map_collector.CreateIterator();
    for (; mat_iter->IsValid(); mat_iter->Next())
    {
        auto input = mat_iter->ItemAs<InputMap>();
        inputs.insert(std::make_pair(input->GetId(), input));
    }

    for (auto &input : inputs)
    {
        GenerateSingleInput(input.second, input_map_leaf_collector);
    }

    m_source_code += m_read_functions;
    m_source_code += m_float4_selector + float4_selector_footer;
    m_source_code += float_selector_header;
    m_source_code += footer;
}

void CLInputMapGenerator::GenerateSingleInput(std::shared_ptr<Baikal::InputMap> input, const Collector& input_map_leaf_collector)
{
    if (m_generated_inputs.find(input->GetId()) != m_generated_inputs.end()) return;

    std::string input_id = std::to_string(input->GetId());

    //Generate code for selectors
    m_float4_selector += "\t\tcase " + input_id + ": return ReadInputMap" + input_id + "(dg, input_map_values, TEXTURE_ARGS);\n";
    m_float_selector += "\t\tcase " + input_id + ": return ReadInputMap" + input_id + "(dg, input_map_values, TEXTURE_ARGS).x;\n";

    m_read_functions += "float4 ReadInputMap" + input_id + "(DifferentialGeometry const* dg, GLOBAL InputMapData const* restrict input_map_values, TEXTURE_ARG_LIST)\n{\n"
        "\treturn (float4)(\n\t";

    GenerateInputSource(input, input_map_leaf_collector);

    m_read_functions += "\t);\n}\n";

    m_generated_inputs.insert(input->GetId());
}

void CLInputMapGenerator::GenerateInputSource(std::shared_ptr<Baikal::InputMap> input, const Collector& input_map_leaf_collector)
{
    switch (input->m_type)
    {

        case InputMap::InputMapType::kConstantFloat:
        {
            int32_t index = input_map_leaf_collector.GetItemIndex(input);

            m_read_functions += "((float4)(input_map_values[" + std::to_string(index) + "].float_value.value, 0.0f))\n";
            break;
        }
        case InputMap::InputMapType::kConstantFloat3:
        {
            int32_t index = input_map_leaf_collector.GetItemIndex(input);

            m_read_functions += "((float4)(input_map_values[" + std::to_string(index) + "].float_value.value, 0.0f))\n";
            break;
        }
        case InputMap::InputMapType::kSampler:
        {
            int32_t index = input_map_leaf_collector.GetItemIndex(input);

            m_read_functions += "Texture_Sample2D(dg->uv, TEXTURE_ARGS_IDX(input_map_values[" + std::to_string(index) + "].int_values.idx))\n";
            break;
        }
        case InputMap::InputMapType::kSamplerBumpmap:
        {
            int32_t index = input_map_leaf_collector.GetItemIndex(input);

            m_read_functions += "(float4)(Texture_SampleBump(dg->uv, TEXTURE_ARGS_IDX(input_map_values[" + std::to_string(index) + "].int_values.idx)), 1.0f)\n";
            break;
        }
        // Two inputs
        case InputMap::InputMapType::kAdd:
        {
            InputMap_Add *i = static_cast<InputMap_Add*>(input.get());

            m_read_functions += "(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t)\n\t + \n\t(\n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kSub:
        {
            InputMap_Sub *i = static_cast<InputMap_Sub*>(input.get());

            m_read_functions += "(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t)\n\t - \n\t(\n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kMul:
        {
            InputMap_Mul *i = static_cast<InputMap_Mul*>(input.get());

            m_read_functions += "(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t)\n\t * \n\t(\n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kDiv:
        {
            InputMap_Div *i = static_cast<InputMap_Div*>(input.get());

            m_read_functions += "(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t)\n\t / \n\t(\n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kMin:
        {
            InputMap_Min *i = static_cast<InputMap_Min*>(input.get());

            m_read_functions += "min(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kMax:
        {
            InputMap_Max *i = static_cast<InputMap_Max*>(input.get());

            m_read_functions += "max(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kDot3:
        {
            InputMap_Dot3 *i = static_cast<InputMap_Dot3*>(input.get());

            m_read_functions += "((float4)(dot(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  ".xyz\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += ".xyz\t), 0.0f, 0.0f, 0.0f))\n";
            break;
        }
        case InputMap::InputMapType::kDot4:
        {
            InputMap_Dot4 *i = static_cast<InputMap_Dot4*>(input.get());

            m_read_functions += "((float4)(dot(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t), 0.0f, 0.0f, 0.0f))\n";
            break;
        }
        case InputMap::InputMapType::kCross3:
        {
            InputMap_Cross3 *i = static_cast<InputMap_Cross3*>(input.get());

            m_read_functions += "((float4)(cross(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  ".xyz\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += ".xyz\t), 0.0f))\n";
            break;
        }
        case InputMap::InputMapType::kCross4:
        {
            InputMap_Cross4 *i = static_cast<InputMap_Cross4*>(input.get());

            m_read_functions += "cross(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kPow:
        {
            InputMap_Pow *i = static_cast<InputMap_Pow*>(input.get());

            m_read_functions += "pow(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += ".x\t)\n";
            break;
        }
        case InputMap::InputMapType::kMod:
        {
            InputMap_Mod *i = static_cast<InputMap_Mod*>(input.get());

            m_read_functions += "fmod(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        //Single input
        case InputMap::InputMapType::kSin:
        {
            InputMap_Sin *i = static_cast<InputMap_Sin*>(input.get());

            m_read_functions += "sin(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kCos:
        {
            InputMap_Cos *i = static_cast<InputMap_Cos*>(input.get());

            m_read_functions += "cos(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kTan:
        {
            InputMap_Tan *i = static_cast<InputMap_Tan*>(input.get());

            m_read_functions += "tan(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kAsin:
        {
            InputMap_Asin *i = static_cast<InputMap_Asin*>(input.get());

            m_read_functions += "asin(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kAcos:
        {
            InputMap_Acos *i = static_cast<InputMap_Acos*>(input.get());

            m_read_functions += "acos(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kAtan:
        {
            InputMap_Atan *i = static_cast<InputMap_Atan*>(input.get());

            m_read_functions += "atan(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kLength3:
        {
            InputMap_Length3 *i = static_cast<InputMap_Length3*>(input.get());

            m_read_functions += "(float4)(length(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += ".xyz\t), 0.0f, 0.0f, 0.0f)\n";
            break;
        }
        case InputMap::InputMapType::kNormalize3:
        {
            InputMap_Normalize3 *i = static_cast<InputMap_Normalize3*>(input.get());

            m_read_functions += "(float4)(normalize(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += ".xyz\t), 0.0f)\n";
            break;
        }
        case InputMap::InputMapType::kFloor:
        {
            InputMap_Floor *i = static_cast<InputMap_Floor*>(input.get());

            m_read_functions += "floor(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kAbs:
        {
            InputMap_Abs *i = static_cast<InputMap_Abs*>(input.get());

            m_read_functions += "fabs(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        // Specials
        case InputMap::InputMapType::kLerp:
        {
            InputMap_Lerp *i = static_cast<InputMap_Lerp*>(input.get());

            m_read_functions += "mix(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions +=  "\t, \n\t\t";
            GenerateInputSource(i->GetControl(), input_map_leaf_collector);
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kSelect:
        {
            InputMap_Select *i = static_cast<InputMap_Select*>(input.get());
            static const std::vector<std::string> selection_to_text = { ".x", ".y", ".z", ".w" };
            assert(static_cast<uint32_t>(i->GetSelection()) < selection_to_text.size());

            m_read_functions += "(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions +=  selection_to_text[static_cast<uint32_t>(i->GetSelection())];
            m_read_functions += "\n\t)\n";
            break;
        }
        case InputMap::InputMapType::kShuffle:
        {
            InputMap_Shuffle *i = static_cast<InputMap_Shuffle*>(input.get());
            auto mask = i->GetMask();

            m_read_functions += "shuffle(\n\t\t";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions += "\t, \n\t\t";
            m_read_functions += "(uint4)(" + std::to_string(mask[0]) + ", " + std::to_string(mask[1]) + ", " + std::to_string(mask[2]) + ", " + std::to_string(mask[3]) + ")\n";
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kShuffle2:
        {
            InputMap_Shuffle2 *i = static_cast<InputMap_Shuffle2*>(input.get());
            auto mask = i->GetMask();

            m_read_functions += "shuffle2(\n\t\t";
            GenerateInputSource(i->GetA(), input_map_leaf_collector);
            m_read_functions += "\t, \n\t\t";
            GenerateInputSource(i->GetB(), input_map_leaf_collector);
            m_read_functions += "\t, \n\t\t";
            m_read_functions += "(uint4)(" + std::to_string(mask[0]) + ", " + std::to_string(mask[1]) + ", " + std::to_string(mask[2]) + ", " + std::to_string(mask[3]) + ")\n";
            m_read_functions += "\t)\n";
            break;
        }
        case InputMap::InputMapType::kMatMul:
        {
            InputMap_MatMul *i = static_cast<InputMap_MatMul*>(input.get());

            auto mat4 = i->GetMatrix();

            m_read_functions += "matrix_mul_vector4(\n\t\t";
            //Generate matrix
            m_read_functions += "matrix_from_rows(\n\t\t\t";
            m_read_functions += "make_float4(" +
                std::to_string(mat4.m00) + ", " +
                std::to_string(mat4.m01) + ", " +
                std::to_string(mat4.m02) + ", " +
                std::to_string(mat4.m03) + "), \n\t\t\t";
            m_read_functions += "make_float4(" +
                std::to_string(mat4.m10) + ", " +
                std::to_string(mat4.m11) + ", " +
                std::to_string(mat4.m12) + ", " +
                std::to_string(mat4.m13) + "), \n\t\t\t";
            m_read_functions += "make_float4(" +
                std::to_string(mat4.m20) + ", " +
                std::to_string(mat4.m21) + ", " +
                std::to_string(mat4.m22) + ", " +
                std::to_string(mat4.m23) + "), \n\t\t\t";
            m_read_functions += "make_float4(" +
                std::to_string(mat4.m30) + ", " +
                std::to_string(mat4.m31) + ", " +
                std::to_string(mat4.m32) + ", " +
                std::to_string(mat4.m33) + ")),\n\t\t(";
            GenerateInputSource(i->GetArg(), input_map_leaf_collector);
            m_read_functions +=  "\t)\n\t)";
            break;
        }
        case InputMap::InputMapType::kRemap:
        {
            InputMap_Remap *i = static_cast<InputMap_Remap*>(input.get());
            //mix(float3(dest.x), float3(dest.y), (val - src.x) / (src.y - src.x))
            m_read_functions += "mix((float4)(\n\t\t";
            GenerateInputSource(i->GetDestinationRange(), input_map_leaf_collector);
            m_read_functions += ".x)\t, \n\t\t(float4)(\n\t\t";
            GenerateInputSource(i->GetDestinationRange(), input_map_leaf_collector);
            m_read_functions += ".y)\t, \n\t\t((\n\t\t";
            GenerateInputSource(i->GetData(), input_map_leaf_collector);
            m_read_functions += ") - \n\t\t(\n\t\t";
            GenerateInputSource(i->GetSourceRange(), input_map_leaf_collector);
            m_read_functions += ".x)) / \n\t\t((\n\t\t";
            GenerateInputSource(i->GetSourceRange(), input_map_leaf_collector);
            m_read_functions += ".y)  - \n\t\t(\n\t\t";
            GenerateInputSource(i->GetSourceRange(), input_map_leaf_collector);
            m_read_functions += ".x)))\t\n";
            break;
        }

    }
}


text:
#region

using System.Collections.Generic;

#endregion

namespace StrikeNET.V2.Responses
{
    public class TorrentSearchResponse
    {
        public List<TorrentSearchResult> Torrents { get; set; }
    }
}


text:
import random
import struct
from collections import OrderedDict

from generator.actions import Actions, Variable

class Deck():
	SIZE_OF_DECK = 52
	DIAMONDS = 1
	SPADES = 2
	HEARTS = 3
	CLUBS = 4
	face_value = [
		0,
		2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
		2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
		2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
		2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

	def __init__(self, size, prng):
		self.SIZE_OF_DECK = size
		self.prng = prng
		self.card_names = ["NC"]
		suits = ["D", "S", "H", "C"]
		cards = [ '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
		for suit in suits:
			for card in cards:
				self.card_names.append(card+suit)

	def shuffle(self):
		self.deck = range(self.SIZE_OF_DECK)
		for i in range(0, self.SIZE_OF_DECK):
			j = self.prng.random_in_range(0, i)
			self.deck[i]= self.deck[j]
			self.deck[j] = i+1
		self.deck.reverse()

	def draw(self):
		try:
			return self.deck.pop()
		except IndexError:
			print "Index Error drawing from empty deck"
			return 0

	def get_suit(self, card):
		if ((card <= 0) or (card > self.SIZE_OF_DECK + 1)):
			return 0;
		elif (card < 14):
			return self.DIAMONDS
		elif (card < 27):
			return self.SPADES
		elif (card < 40):
			return self.HEARTS
		else:
			return self.CLUBS

	def get_names(self, hand):
		s = ''
		for card in hand:
			s += self.card_names[card] + ' '
		return s

	def cmp_face_value(self, x,y):
		if (self.face_value[x] > self.face_value[y]):
			return 1
		elif (self.face_value[x] == self.face_value[y]):
			return 0
		else:
			return -1

	def count_matching(self, card, hand):
		count = 0
		for each in hand:
			if (self.cmp_face_value(card, each)==0):
				count += 1
		return count

	def blackjack_total(self, hand):
		total = 0
		aces = 0
		for card in hand:
			if (self.face_value[card] == 14):
				aces += 1
			elif (self.face_value[card] >= 10):
				total += 10
			else:
				total += self.face_value[card]
		while (aces > 0):
			if ((total + (aces-1) + 11) <= 21):
				total += 11
				aces -= 1
			else:
				total += 1
				aces -= 1

		return total

class CasinoPollGenerator(Actions):

	def start(self):
		self.state["players"] = []
		self.state["current_player"] = None
		self.state["payouts"] = OrderedDict([("SLOTS_COLUMN_MATCH", 4),
									("SLOTS_ROW_MATCH", 4),
									("POKER_ROYAL_FLUSH", 500),
									("POKER_STRAIGHT_FLUSH", 200),
									("POKER_FLUSH", 40),
									("POKER_FOUR_OF_A_KIND", 100),
									("POKER_FULL_HOUSE", 50),
									("POKER_TWO_PAIR",10),
									("POKER_THREE_OF_A_KIND", 20),
									("POKER_JACKS_OR_BETTER", 10),
									("POKER_STRAIGHT",30),
									("BLACKJACK_PUSH", 10),
									("BLACKJACK_BLACKJACK", 25),
									("BLACKJACK_WIN", 20)])

		self.read(delim=':', expect="Enter your name:")
		if (self.chance(0.1)):
			# Hidden config interface
			name = "71db10261c"
			self.write(name + '\n')
			self.read(delim='\n', expect="Hello, {}!\n".format(name))
			self.read(delim='\n', expect="Access Granted")
			self.config()
		else:
			# Normal login
			name = data = ''.join(chr(random.randint(ord('!'),ord('~'))) for _ in range(random.randint(1,64)))
			self.write(name + '\n')
			self.read(delim='\n', expect="Hello, {}!\n".format(name))

		# Setup prng
		self.prng = Prng()
		seed = 0
		for i in range(0, len(name)):
			seed = (((seed << 8) & 0xffffffffffffffffL) | ((seed >> 56) ^ (ord(name[i]) & 0xff))) & 0xffffffffffffffffL

		self.prng.sprng(seed)
		self.deck = Deck(52, self.prng)

	def config(self):
		self.state["payouts"] = OrderedDict([("SLOTS_COLUMN_MATCH", random.randint(0,4)),
									("SLOTS_ROW_MATCH", random.randint(0,4)),
									("POKER_ROYAL_FLUSH", random.randint(0,500)),
									("POKER_STRAIGHT_FLUSH", random.randint(0,200)),
									("POKER_FLUSH", random.randint(0,40)),
									("POKER_FOUR_OF_A_KIND", random.randint(0,100)),
									("POKER_FULL_HOUSE",random.randint(0, 50)),
									("POKER_TWO_PAIR", random.randint(0,10)),
									("POKER_THREE_OF_A_KIND", random.randint(0,20)),
									("POKER_JACKS_OR_BETTER", random.randint(0,10)),
									("POKER_STRAIGHT", random.randint(0,30)),
									("BLACKJACK_PUSH", random.randint(0,10)),
									("BLACKJACK_BLACKJACK", random.randint(0,25)),
									("BLACKJACK_WIN", random.randint(0,20))])

		numbers = self.state["payouts"].values()
		data = struct.pack("<" + "i"*len(numbers), *numbers)
		encoded = ''
		lookup = "!@#$%^&+=:><|?~*"
		for each in data:
			encoded += lookup[ord(each)&0xf]
			encoded += lookup[ord(each)>>4]

		self.write(struct.pack("<i", len(encoded)))
		self.write(encoded)

	def menu(self):
		self.read(delim='\n', expect='\n')
		self.read(delim='\n', expect="1. Play Blackjack\n")
		self.read(delim='\n', expect="2. Play Poker\n")
		self.read(delim='\n', expect="3. Play Slots\n")
		self.read(delim='\n', expect="4. Enter a Players Club Number\n")
		self.read(delim='\n', expect="5. Register a new Player\n")
		self.read(delim='\n', expect="6. Show Player Status\n")
		self.read(delim='\n', expect="7. Show All Players\n")
		self.read(delim='\n', expect="8. Exit\n")
		self.read(delim=':', expect="Select a number:")

	def blackjack(self):
		self.write("1\n")
		self.read(delim='\n', expect="Play Blackjack\n")

		player = {"name":"", "number":0, "wallet":0, "b_score":0, "p_score":0, "s_score":0}

		if (self.state["current_player"] != None):
			player = self.state["players"][self.state["current_player"]]

		if (player["wallet"]>=10):
			player["wallet"] -= 10
		player["b_score"] += 50

		self.deck.shuffle()
		playerhand = []
		playerhand.append(self.deck.draw())
		dealerhand = []
		dealerhand.append(self.deck.draw())
		playerhand.append(self.deck.draw())
		dealerhand.append(self.deck.draw())

		self.read(delim='\n', expect="D: * " + self.deck.get_names([dealerhand[1]]))
		self.read(delim='\n', expect="P: " + self.deck.get_names(playerhand))

		result = ""
		if (self.deck.blackjack_total(dealerhand) == 21):
			if (self.deck.blackjack_total(playerhand) == 21):
				result = "Dealer Blackjack! Player Blackjack! You Tie :/"
				player["wallet"] += self.state["payouts"]["BLACKJACK_PUSH"]
			else:
				result = "Dealer Blackjack! You Lose!"
		elif (self.deck.blackjack_total(playerhand) == 21):
			result = "Blackjack! You Win!"
			player["wallet"] += self.state["payouts"]["BLACKJACK_BLACKJACK"]

		else:
			# Play Player Hand
			while (self.deck.blackjack_total(playerhand) < 17):
				self.read(delim=':', expect="Enter h for hit or s for stand:")
				self.write("h\n")
				playerhand.append(self.deck.draw())
				self.read(delim='\n', expect="P: " + self.deck.get_names(playerhand))
			if (self.deck.blackjack_total(playerhand)>21):
				self.read(delim='\n', expect="Bust")
			else:
				self.read(delim=':', expect="Enter h for hit or s for stand:")
				self.write("s\n")

			# Play Dealer Hand
			self.read(delim='\n', expect="D: " + self.deck.get_names(dealerhand))
			while (self.deck.blackjack_total(dealerhand) < 17):
				dealerhand.append(self.deck.draw())
				self.read(delim='\n', expect="D: " + self.deck.get_names(dealerhand))

			if (self.deck.blackjack_total(playerhand) > 21):
				result = "Player Bust. You Lose."
			elif (self.deck.blackjack_total(dealerhand) > 21):
				result = "Dealer Bust. You Win."
				player["wallet"] += self.state["payouts"]["BLACKJACK_WIN"]
			elif (self.deck.blackjack_total(dealerhand) > self.deck.blackjack_total(playerhand)):
				result = "You Lose."
			elif (self.deck.blackjack_total(dealerhand) == self.deck.blackjack_total(playerhand)):
				result = "Push."
				player["wallet"] += self.state["payouts"]["BLACKJACK_PUSH"]
			else:
				result = "You Win."
				player["wallet"] += self.state["payouts"]["BLACKJACK_WIN"]
			self.read(delim='\n', expect="P:{} D:{}".format(self.deck.blackjack_total(playerhand), self.deck.blackjack_total(dealerhand)))
		self.read(delim='\n', expect=result)
		if (self.state["current_player"] != None):
			self.state["players"][self.state["current_player"]] = player

		self.menu()
		self.show_status()

	def poker(self):
		self.write("2\n")
		self.read(delim='\n', expect='Play Poker')
		player = {"name":"", "number":0, "wallet":0, "b_score":0, "p_score":0, "s_score":0}

		if (self.state["current_player"] != None):
			player = self.state["players"][self.state["current_player"]]

		if (player["wallet"]>=5):
			player["wallet"] -= 5

		player["p_score"] += 100
		self.deck.shuffle()
		# Draw hand
		hand = []
		for i in range(5):
			hand.append(self.deck.draw())

		self.read(delim='\n', expect=self.deck.get_names(hand))
		# Hold none
		self.read(delim='\n', expect="Enter cards to hold by number (ex: 13 or 12345). Others will be replaced.")
		self.write("\n")
		# Draw new hand
		hand = []
		for i in range(5):
			hand.append(self.deck.draw())

		self.read(delim='\n', expect=self.deck.get_names(hand))

		result = ""
		hand.sort()
		# Process results
		if ((self.deck.get_suit(hand[0]) == self.deck.get_suit(hand[1])) and
		(self.deck.get_suit(hand[0]) == self.deck.get_suit(hand[2])) and
		(self.deck.get_suit(hand[0]) == self.deck.get_suit(hand[3])) and
		(self.deck.get_suit(hand[0]) == self.deck.get_suit(hand[4]))):
			if (self.deck.face_value[hand[0]]==10):
				result = "Royal Flush!"
				player["wallet"] += self.state["payouts"]["POKER_ROYAL_FLUSH"]
			elif (hand[4] == hand[0] + 4):
				result = "Straight Flush!"
				player["wallet"] += self.state["payouts"]["POKER_STRAIGHT_FLUSH"]
			else:
				result = "Flush!"
				player["wallet"] += self.state["payouts"]["POKER_FLUSH"]
		else:
			hand.sort(self.deck.cmp_face_value)
			pair = 0
			i = 0
			while (i<4):
				if (self.deck.count_matching(hand[i], hand) == 4):
					result = "Four of a kind!"
					player["wallet"] += self.state["payouts"]["POKER_FOUR_OF_A_KIND"]
					i = i + 4
				elif (self.deck.count_matching(hand[i], hand) == 3):
					if (pair == 1):
						if (result == "Jacks or better!"):
							player["wallet"] -= self.state["payouts"]["POKER_JACKS_OR_BETTER"]
						result = "Full House!"
						player["wallet"] += self.state["payouts"]["POKER_FULL_HOUSE"]
					else:
						result = "Three of a kind!"
						player["wallet"] += self.state["payouts"]["POKER_THREE_OF_A_KIND"]
					i = i + 3
				elif (self.deck.count_matching(hand[i], hand) == 2):
					if (pair == 1):
						if (result == "Jacks or better!"):
							player["wallet"] -= self.state["payouts"]["POKER_JACKS_OR_BETTER"]
						player["wallet"] += self.state["payouts"]["POKER_TWO_PAIR"]
						result = "Two Pair!"
					elif (result == "Three of a kind!"):
						result = "Full House!"
						player["wallet"] -= self.state["payouts"]["POKER_THREE_OF_A_KIND"]
						player["wallet"] += self.state["payouts"]["POKER_FULL_HOUSE"]
					else:
						pair = 1
						if (self.deck.cmp_face_value(9, hand[i]) == -1):
							result = "Jacks or better!"
							player["wallet"] += self.state["payouts"]["POKER_JACKS_OR_BETTER"]
					i = i + 2
				else:
					i = i + 1

		if ((result == "") and (pair == 0)):
			if (self.deck.face_value[hand[4]] == self.deck.face_value[hand[0]] + 4):
				result = "Straight!"
				player["wallet"] += self.state["payouts"]["POKER_STRAIGHT"]

		if (result == ""):
			result = "You Lose!"

		self.read(delim='\n', expect=result)

		# Draw new hand
		hand = []
		for i in range(5):
			hand.append(self.deck.draw())

		self.deck.shuffle()
		self.read(delim='\n', expect=".*\n", expect_format="pcre")
		self.read(delim='\n', expect="Enter cards to hold by number (ex: 13 or 12345). Others will be replaced.")
		self.write('q\n')

		if (self.state["current_player"] != None):
			self.state["players"][self.state["current_player"]] = player

		self.menu()
		self.show_status()

	def slots(self):
		self.write('3\n')
		rows = random.randint(2, 5)
		self.read(delim='\n', expect="Play Slots")
		player = {"name":"", "number":0, "wallet":0, "b_score":0, "p_score":0, "s_score":0}
		if (self.state["current_player"] != None):
			player = self.state["players"][self.state["current_player"]]

		if (player["wallet"]>=2):
			player["wallet"] -= 2
		player["s_score"]+= 1

		self.read(delim=':', expect="Enter number of rows (2 to 5):")
		self.write(str(rows) + '\n')
		max_char = ord('/')
		if (rows == 3):
			max_char = ord('!') + 6
		elif (rows == 4):
			max_char = ord('!') + 4
		elif (rows == 5):
			max_char = ord('!') + 2

		board = []
		for i in range(rows):
			line = []
			for j in range(rows):
				line.append(self.prng.random_in_range(ord('!'), max_char))
			board.append(line)

		for j in range(rows):
			line = ''
			for i in range(rows):
				line += '{} '.format(chr(board[i][j]))
			self.read(delim='\n', expect=line + '\n')

		for i in range(rows):
			for j in range(rows)[1:]:
				if (board[i][j] != board[i][0]):
					break;
				if (j == rows - 1):
					self.read(delim='\n', expect='Column match: {}!'.format(i))
					player["wallet"] += self.state["payouts"]["SLOTS_COLUMN_MATCH"]

		for j in range(rows):
			for i in range(rows)[1:]:
				if (board[i][j] != board[0][j]):
					break
				if (i == rows - 1):
					self.read(delim='\n', expect='Row match: {}!'.format(j))
					player["wallet"] += self.state["payouts"]["SLOTS_ROW_MATCH"]

		self.read(delim=':', expect="Enter q to quit, any other key to play again:")
		self.write('q\n')
		if (self.state["current_player"] != None):
			self.state["players"][self.state["current_player"]] = player

		self.menu()
		self.show_status()

	def lookup_player(self, number):
		for i in range(len(self.state["players"])):
			if self.state["players"][i]["number"] == number:
				return i
		return None

	def enter_players_club(self):
		self.write("4\n")
		self.read(delim=":", expect="Enter Player Number")
		if ((len(self.state["players"]) == 0) or self.chance(0.2)):
			rand = random.randint(0, 0xffffffff)
			while (self.lookup_player(rand)!= None):
				rand = random.randint(0, 0xffffffff)
			self.write(str(rand) + '\n')
			self.read(delim='\n', expect="Player not found")
			self.state["current_player"] = None
		else:
			self.state["current_player"] = random.randint(0, len(self.state["players"])-1)
			player =self.state["players"][self.state["current_player"]]
			self.write(str(player["number"]) + '\n')
			self.read(delim='\n', expect="Hello, {}!".format(player["name"]))

	def player_stats(self, player):
		self.read(delim='\n', expect="Player Name: " + player["name"])
		self.read(delim='\n', expect="Player Number: " + str(player["number"]))
		self.read(delim='\n', expect="Blackjack Score: " + str(player["b_score"]))
		self.read(delim='\n', expect="Poker Score: " + str(player["p_score"]))
		self.read(delim='\n', expect="Slots Score: " + str(player["s_score"]))
		self.read(delim='\n\n', expect="Player Wallet Balance: " + str(player["wallet"]))

	def register_player(self):
		self.write("5\n")
		self.read(delim=':', expect="Register a new Player\nEnter your name")
		names = ["Aragorn son of Arathorn", "Arwen Undomiel", "Bilbo Baggins", "Boromir", "Denethor", "Elrond, Lord of Rivendell", "Eomer", "Eowyn", "Faramir", "Frodo Baggins", "Galadriel",
		"Gandalf", "Gimli", "Gollum", "Haldir", "Isildur", "Legolas", "Merry", "Pippin", "Sam", "Saruman", "Theoden", "Treebeard", "Wormtongue" ]
		name = names[random.randint(0, len(names) - 1)]
		self.write(name + '\n')
		self.read(delim=':', expect="How much cash do you want to spend?")
		wallet = random.randint(0, 1000)
		self.write(str(wallet) + '\n')
		number = self.prng.prng() & 0x7fffffff
		self.state["players"].insert(0, {"name":name, "number":number, "wallet":wallet, "b_score":0, "p_score":0, "s_score":0})
		if self.state["current_player"] != None:
			self.state["current_player"] += 1
		self.player_stats(self.state["players"][0])

	def show_status(self):
		self.write("6\n")
		if (self.state["current_player"] == None):
			self.read(delim='\n', expect="Player does not exist")
		else:
			self.player_stats(self.state["players"][self.state["current_player"]])

	def leaderboard(self):
		self.write("7\n")
		self.read(delim='\n', expect="Show All Players")
		for each in self.state["players"]:
			self.player_stats(each)

	def exit(self):
		self.write("8\n")
		self.read(delim='\n')
		self.write("y\n")
		self.read(delim='\n', expect=".*", expect_format="pcre")

class Prng():

	COEFFICIENT_A_64 = 12
	COEFFICIENT_B_64 = 25
	COEFFICIENT_C_64 = 27
	MULTIPLIER_64 = 1803442709493370165
	COEFFICIENT_A_1024 = 27
	COEFFICIENT_B_1024 = 13
	COEFFICIENT_C_1024 = 46
	MULTIPLIER_1024 = 1865811235122147685

	def __init__(self):
		self.state = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
		self.position = 0

	def sprng(self, seed):

		state_64 = seed & 0xffffffffffffffffL
		for i in range(16):
			state_64 ^= (state_64 >> self.COEFFICIENT_A_64)& 0xffffffffffffffffL
			state_64 ^= (state_64 << self.COEFFICIENT_B_64)& 0xffffffffffffffffL
			state_64 ^= (state_64 >> self.COEFFICIENT_C_64)& 0xffffffffffffffffL
			self.state[i] = (state_64 *self.MULTIPLIER_64)& 0xffffffffffffffffL
		self.position = 0

	def prng(self):

		state0 = self.state[self.position]
		self.position = (self.position +1) % 16
		state1 = self.state[self.position]

		state1 ^= (state1 << self.COEFFICIENT_A_1024)& 0xffffffffffffffffL
		state1 ^= (state1 >> self.COEFFICIENT_B_1024)& 0xffffffffffffffffL
		state0 ^= (state0 >> self.COEFFICIENT_C_1024)& 0xffffffffffffffffL
		self.state[self.position] = (state0 ^ state1)& 0xffffffffffffffffL
		return (self.state[self.position] * self.MULTIPLIER_1024)& 0xffffffffffffffffL

	def random_in_range(self, min, max):

		if (max <= min):
			return 0
		range = max - min + 1
		scale_factor = 0xffffffff / range
		#discard numbers that would cause bias
		while True:
			rand_uint = self.prng() & 0xffffffff
			if (rand_uint < (scale_factor * range)):
				break

		return (rand_uint / scale_factor + min)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Peziza replicata Tode

### Remarks
null


text:
it("should import the correct modules", () => {
	return import("./module").then(({ test }) => test());
});


text:
package atkafasi.solutions;

import java.util.List;

import atkafasi.model.data.ParseResultPojo;
import atkafasi.model.instructions.Instructions;

public class HorizontalLines implements Solution {

    @Override
    public List<Instructions> solve(ParseResultPojo frameData) {
        return null;
    }
}


text:
package io.swagger.codegen;

import io.airlift.airline.Cli;
import io.airlift.airline.Help;
import io.swagger.codegen.cmd.ConfigHelp;
import io.swagger.codegen.cmd.Generate;
import io.swagger.codegen.cmd.Langs;
import io.swagger.codegen.cmd.Meta;

/**
 * User: lanwen
 * Date: 24.03.15
 * Time: 17:56
 * <p>
 * Command line interface for swagger codegen
 * use `swagger-codegen-cli.jar help` for more info
 *
 * @since 2.1.3-M1
 */
public class SwaggerCodegen {

    public static void main(String[] args) {
        @SuppressWarnings("unchecked")
        Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("swagger-codegen-cli")
                .withDescription("Swagger code generator CLI. More info on swagger.io")
                .withDefaultCommand(Langs.class)
                .withCommands(
                        Generate.class,
                        Meta.class,
                        Langs.class,
                        Help.class,
                        ConfigHelp.class
                );

        builder.build().parse(args).run();
    }
}


text:
/*
 * This file now contains only the definitions needed for the
 * meta table.
 *
 */

#ifndef __DB_H__
#define __DB_H__

#include "sys.h"
#include "bif.h"

#include "erl_db_util.h" /* Flags */
#include "erl_db_hash.h" /* DbTableHash */
#include "erl_db_tree.h" /* DbTableTree */
/*TT*/

Uint erts_get_ets_misc_mem_size(void);

/*
 * So, the structure for a database table, NB this is only
 * interesting in db.c.
 */
union db_table {
    DbTableCommon common; /* Any type of db table */
    DbTableHash hash;     /* Linear hash array specific data */
    DbTableTree tree;     /* AVL tree specific data */
    /*TT*/
};

#define DB_DEF_MAX_TABS 2053 /* Superseeded by environment variable
				"ERL_MAX_ETS_TABLES" */
#define ERL_MAX_ETS_TABLES_ENV "ERL_MAX_ETS_TABLES"

void init_db(void);
int erts_db_process_exiting(Process *, ErtsProcLocks);
void db_info(int, void *, int);
void erts_db_foreach_table(void (*)(DbTable *, void *), void *);
void erts_db_foreach_offheap(DbTable *,
			     void (*func)(ErlOffHeap *, void *),
			     void *);

extern int user_requested_db_max_tabs; /* set in erl_init */
extern int erts_ets_realloc_always_moves;  /* set in erl_init */
extern int erts_ets_always_compress;  /* set in erl_init */
extern Export ets_select_delete_continue_exp;
extern Export ets_select_count_continue_exp;
extern Export ets_select_continue_exp;
extern erts_smp_atomic_t erts_ets_misc_mem_size;

Eterm erts_ets_colliding_names(Process*, Eterm name, Uint cnt);

#endif

#if defined(ERTS_WANT_DB_INTERNAL__) && !defined(ERTS_HAVE_DB_INTERNAL__)
#define ERTS_HAVE_DB_INTERNAL__

#include "erl_alloc.h"

/*
 * _fnf : Failure Not Fatal (same as for erts_alloc/erts_realloc/erts_free)
 * _nt  : No Table (i.e. memory not associated with a specific table)
 */

#define ERTS_DB_ALC_MEM_UPDATE_(TAB, FREE_SZ, ALLOC_SZ)			\
do {									\
    erts_aint_t sz__ = (((erts_aint_t) (ALLOC_SZ))			\
			- ((erts_aint_t) (FREE_SZ)));			\
    ASSERT((TAB));							\
    erts_smp_atomic_add_nob(&(TAB)->common.memory_size, sz__);		\
} while (0)

#define ERTS_ETS_MISC_MEM_ADD(SZ) \
  erts_smp_atomic_add_nob(&erts_ets_misc_mem_size, (SZ));

ERTS_GLB_INLINE void *erts_db_alloc(ErtsAlcType_t type,
				    DbTable *tab,
				    Uint size);
ERTS_GLB_INLINE void *erts_db_alloc_fnf(ErtsAlcType_t type,
					DbTable *tab,
					Uint size);
ERTS_GLB_INLINE void *erts_db_alloc_nt(ErtsAlcType_t type, Uint size);
ERTS_GLB_INLINE void *erts_db_alloc_fnf_nt(ErtsAlcType_t type, Uint size);

#if ERTS_GLB_INLINE_INCL_FUNC_DEF

ERTS_GLB_INLINE void *
erts_db_alloc(ErtsAlcType_t type, DbTable *tab, Uint size)
{
    void *res = erts_alloc(type, size);
    ERTS_DB_ALC_MEM_UPDATE_(tab, 0, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_alloc_fnf(ErtsAlcType_t type, DbTable *tab, Uint size)
{
    void *res = erts_alloc_fnf(type, size);
    if (!res)
	return NULL;
    ERTS_DB_ALC_MEM_UPDATE_(tab, 0, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_alloc_nt(ErtsAlcType_t type, Uint size)
{
    void *res = erts_alloc(type, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_alloc_fnf_nt(ErtsAlcType_t type, Uint size)
{
    void *res = erts_alloc_fnf(type, size);
    if (!res)
	return NULL;
    return res;
}

#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */

ERTS_GLB_INLINE void *erts_db_realloc(ErtsAlcType_t type,
				      DbTable *tab,
				      void *ptr,
				      Uint old_size,
				      Uint size);
ERTS_GLB_INLINE void *erts_db_realloc_fnf(ErtsAlcType_t type,
					  DbTable *tab,
					  void *ptr,
					  Uint old_size,
					  Uint size);
ERTS_GLB_INLINE void *erts_db_realloc_nt(ErtsAlcType_t type,
					 void *ptr,
					 Uint old_size,
					 Uint size);
ERTS_GLB_INLINE void *erts_db_realloc_fnf_nt(ErtsAlcType_t type,
					     void *ptr,
					     Uint old_size,
					     Uint size);

#if ERTS_GLB_INLINE_INCL_FUNC_DEF

ERTS_GLB_INLINE void *
erts_db_realloc(ErtsAlcType_t type, DbTable *tab, void *ptr,
		Uint old_size, Uint size)
{
    void *res;
    ASSERT(!ptr || old_size == ERTS_ALC_DBG_BLK_SZ(ptr));
    res = erts_realloc(type, ptr, size);
    ERTS_DB_ALC_MEM_UPDATE_(tab, old_size, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_realloc_fnf(ErtsAlcType_t type, DbTable *tab, void *ptr,
		    Uint old_size, Uint size)
{
    void *res;
    ASSERT(!ptr || old_size == ERTS_ALC_DBG_BLK_SZ(ptr));
    res = erts_realloc_fnf(type, ptr, size);
    if (!res)
	return NULL;
    ERTS_DB_ALC_MEM_UPDATE_(tab, old_size, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_realloc_nt(ErtsAlcType_t type, void *ptr,
		   Uint old_size, Uint size)
{
    void *res;
    ASSERT(!ptr || old_size == ERTS_ALC_DBG_BLK_SZ(ptr));
    res = erts_realloc(type, ptr, size);
    return res;
}

ERTS_GLB_INLINE void *
erts_db_realloc_fnf_nt(ErtsAlcType_t type, void *ptr,
		       Uint old_size, Uint size)
{
    void *res;
    ASSERT(!ptr || old_size == ERTS_ALC_DBG_BLK_SZ(ptr));
    res = erts_realloc_fnf(type, ptr, size);
    if (!res)
	return NULL;
    return res;
}

#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */

ERTS_GLB_INLINE void erts_db_free(ErtsAlcType_t type,
				  DbTable *tab,
				  void *ptr,
				  Uint size);

ERTS_GLB_INLINE void erts_db_free_nt(ErtsAlcType_t type,
				     void *ptr,
				     Uint size);

#if ERTS_GLB_INLINE_INCL_FUNC_DEF

ERTS_GLB_INLINE void
erts_db_free(ErtsAlcType_t type, DbTable *tab, void *ptr, Uint size)
{
    ASSERT(ptr != 0);
    ASSERT(size == ERTS_ALC_DBG_BLK_SZ(ptr));
    ERTS_DB_ALC_MEM_UPDATE_(tab, size, 0);

    ASSERT(((void *) tab) != ptr
	   || erts_smp_atomic_read_nob(&tab->common.memory_size) == 0);

    erts_free(type, ptr);
}

ERTS_GLB_INLINE void
erts_db_free_nt(ErtsAlcType_t type, void *ptr, Uint size)
{
    ASSERT(ptr != 0);
    ASSERT(size == ERTS_ALC_DBG_BLK_SZ(ptr));

    erts_free(type, ptr);
}

#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */

#undef ERTS_DB_ALC_MEM_UPDATE_

#endif /* #if defined(ERTS_WANT_DB_INTERNAL__) && !defined(ERTS_HAVE_DB_INTERNAL__) */


text:
class PeopleController < ApplicationController

  respond_to :html

  # GET /people
  def index
    @people = Person.all
    respond_with(@people)
  end

  # GET /people/:id
  def show
    @person = Person.find(params[:id])
    respond_with(@person)
  end

  # GET /people/new
  def new
    @person = Person.new
    respond_with(@person)
  end

  # GET /people/:id/edit
  def edit
    @person = Person.find(params[:id])
    respond_with(@person)
  end

  # POST /people
  def create
    @person = Person.create(attributes)
    respond_with(@person)
  end

  # PUT /people/:id
  def update
    @person = Person.find(params[:id])
    @person.attributes = attributes
    @person.save
    respond_with(@person)
  end

  # DELETE /people/:id
  def destroy
    @person = Person.find(params[:id])
    @person.destroy
    respond_with(@person)
  end

private

  def attributes
    params.require(:person).permit(:name, :phone, :email, :url)
  end

end


text:
import unittest
from base64 import b64encode
import six

from airflow import configuration
from airflow import models
from airflow.contrib.operators.ssh_operator import SSHOperator
from airflow.models import DAG, TaskInstance
from airflow.settings import Session
from airflow.utils import timezone
from airflow.utils.timezone import datetime

TEST_DAG_ID = 'unit_tests'
DEFAULT_DATE = datetime(2017, 1, 1)

def reset(dag_id=TEST_DAG_ID):
    session = Session()
    tis = session.query(models.TaskInstance).filter_by(dag_id=dag_id)
    tis.delete()
    session.commit()
    session.close()

reset()

class SSHOperatorTest(unittest.TestCase):
    def setUp(self):
        configuration.load_test_config()
        from airflow.contrib.hooks.ssh_hook import SSHHook
        hook = SSHHook(ssh_conn_id='ssh_default')
        hook.no_host_key_check = True
        args = {
            'owner': 'airflow',
            'start_date': DEFAULT_DATE,
            'provide_context': True
        }
        dag = DAG(TEST_DAG_ID + 'test_schedule_dag_once', default_args=args)
        dag.schedule_interval = '@once'
        self.hook = hook
        self.dag = dag

    def test_hook_created_correctly(self):
        TIMEOUT = 20
        SSH_ID = "ssh_default"
        task = SSHOperator(
            task_id="test",
            command="echo -n airflow",
            dag=self.dag,
            timeout=TIMEOUT,
            ssh_conn_id="ssh_default"
        )
        self.assertIsNotNone(task)

        task.execute(None)

        self.assertEqual(TIMEOUT, task.ssh_hook.timeout)
        self.assertEqual(SSH_ID, task.ssh_hook.ssh_conn_id)

    def test_json_command_execution(self):
        configuration.conf.set("core", "enable_xcom_pickling", "False")
        task = SSHOperator(
            task_id="test",
            ssh_hook=self.hook,
            command="echo -n airflow",
            do_xcom_push=True,
            dag=self.dag,
        )

        self.assertIsNotNone(task)

        ti = TaskInstance(
            task=task, execution_date=timezone.utcnow())
        ti.run()
        self.assertIsNotNone(ti.duration)
        self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'),
                         b64encode(b'airflow').decode('utf-8'))

    def test_pickle_command_execution(self):
        configuration.conf.set("core", "enable_xcom_pickling", "True")
        task = SSHOperator(
            task_id="test",
            ssh_hook=self.hook,
            command="echo -n airflow",
            do_xcom_push=True,
            dag=self.dag,
        )

        self.assertIsNotNone(task)

        ti = TaskInstance(
            task=task, execution_date=timezone.utcnow())
        ti.run()
        self.assertIsNotNone(ti.duration)
        self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'), b'airflow')

    def test_command_execution_with_env(self):
        configuration.conf.set("core", "enable_xcom_pickling", "True")
        task = SSHOperator(
            task_id="test",
            ssh_hook=self.hook,
            command="echo -n airflow",
            do_xcom_push=True,
            dag=self.dag,
        )

        self.assertIsNotNone(task)

        ti = TaskInstance(
            task=task, execution_date=timezone.utcnow())
        ti.run()
        self.assertIsNotNone(ti.duration)
        self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'), b'airflow')

    def test_no_output_command(self):
        configuration.conf.set("core", "enable_xcom_pickling", "True")
        task = SSHOperator(
            task_id="test",
            ssh_hook=self.hook,
            command="sleep 1",
            do_xcom_push=True,
            dag=self.dag,
        )

        self.assertIsNotNone(task)

        ti = TaskInstance(
            task=task, execution_date=timezone.utcnow())
        ti.run()
        self.assertIsNotNone(ti.duration)
        self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'), b'')

    def test_arg_checking(self):
        import os
        from airflow.exceptions import AirflowException
        conn_id = "conn_id_for_testing"
        TIMEOUT = 5
        os.environ['AIRFLOW_CONN_' + conn_id.upper()] = "ssh://test_id@localhost"

        # Exception should be raised if neither ssh_hook nor ssh_conn_id is provided
        if six.PY2:
            self.assertRaisesRegex = self.assertRaisesRegexp
        with self.assertRaisesRegex(AirflowException,
                                    "Cannot operate without ssh_hook or ssh_conn_id."):
            task_0 = SSHOperator(task_id="test", command="echo -n airflow",
                                 timeout=TIMEOUT, dag=self.dag)
            task_0.execute(None)

        # if ssh_hook is invalid/not provided, use ssh_conn_id to create SSHHook
        task_1 = SSHOperator(
            task_id="test_1",
            ssh_hook="string_rather_than_SSHHook",  # invalid ssh_hook
            ssh_conn_id=conn_id,
            command="echo -n airflow",
            timeout=TIMEOUT,
            dag=self.dag
        )
        try:
            task_1.execute(None)
        except Exception:
            pass
        self.assertEqual(task_1.ssh_hook.ssh_conn_id, conn_id)

        task_2 = SSHOperator(
            task_id="test_2",
            ssh_conn_id=conn_id,  # no ssh_hook provided
            command="echo -n airflow",
            timeout=TIMEOUT,
            dag=self.dag
        )
        try:
            task_2.execute(None)
        except Exception:
            pass
        self.assertEqual(task_2.ssh_hook.ssh_conn_id, conn_id)

        # if both valid ssh_hook and ssh_conn_id are provided, ignore ssh_conn_id
        task_3 = SSHOperator(
            task_id="test_3",
            ssh_hook=self.hook,
            ssh_conn_id=conn_id,
            command="echo -n airflow",
            timeout=TIMEOUT,
            dag=self.dag
        )
        try:
            task_3.execute(None)
        except Exception:
            pass
        self.assertEqual(task_3.ssh_hook.ssh_conn_id, self.hook.ssh_conn_id)

if __name__ == '__main__':
    unittest.main()


text:
package sun.jvmstat.perfdata.monitor;

import sun.jvmstat.monitor.MonitorException;

/**
 * Exception indicating that an unexpected type was encountered for
 * the type field of a PerfData entry in a HotSpot PerfData buffer.
 *
 * @author Brian Doherty
 * @since 1.5
 */
public class MonitorTypeException extends MonitorException {

    /**
     * Constructs a MonitorTypeException with
     * null  as its error detail message.
     */
     public MonitorTypeException() {
         super();
     }

    /**
     * Constructs an MonitorTypeException with the specified
     * detail message. The error message string s can later be
     * retrieved by the {@link java.lang.Throwable#getMessage}
     * method of class java.lang.Throwable.
     *
     * @param s the detail message.
     */
    public MonitorTypeException(String s) {
        super(s);
    }
}


text:
/*
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio - Supersim
 * This is the public Twilio REST API.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package openapi

import (
	"encoding/json"
	"fmt"
	"net/url"
	"strings"

	"github.com/twilio/twilio-go/client"
)

// Fetch a Network resource.
func (c *ApiService) FetchNetwork(Sid string) (*SupersimV1Network, error) {
	path := "/v1/Networks/{Sid}"
	path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)

	data := url.Values{}
	headers := make(map[string]interface{})

	resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	ps := &SupersimV1Network{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}

	return ps, err
}

// Optional parameters for the method 'ListNetwork'
type ListNetworkParams struct {
	// The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read.
	IsoCountry *string `json:"IsoCountry,omitempty"`
	// The 'mobile country code' of a country. Network resources with this `mcc` in their `identifiers` will be read.
	Mcc *string `json:"Mcc,omitempty"`
	// The 'mobile network code' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read.
	Mnc *string `json:"Mnc,omitempty"`
	// How many resources to return in each list page. The default is 50, and the maximum is 1000.
	PageSize *int `json:"PageSize,omitempty"`
	// Max number of records to return.
	Limit *int `json:"limit,omitempty"`
}

func (params *ListNetworkParams) SetIsoCountry(IsoCountry string) *ListNetworkParams {
	params.IsoCountry = &IsoCountry
	return params
}
func (params *ListNetworkParams) SetMcc(Mcc string) *ListNetworkParams {
	params.Mcc = &Mcc
	return params
}
func (params *ListNetworkParams) SetMnc(Mnc string) *ListNetworkParams {
	params.Mnc = &Mnc
	return params
}
func (params *ListNetworkParams) SetPageSize(PageSize int) *ListNetworkParams {
	params.PageSize = &PageSize
	return params
}
func (params *ListNetworkParams) SetLimit(Limit int) *ListNetworkParams {
	params.Limit = &Limit
	return params
}

// Retrieve a single page of Network records from the API. Request is executed immediately.
func (c *ApiService) PageNetwork(params *ListNetworkParams, pageToken, pageNumber string) (*ListNetworkResponse, error) {
	path := "/v1/Networks"

	data := url.Values{}
	headers := make(map[string]interface{})

	if params != nil && params.IsoCountry != nil {
		data.Set("IsoCountry", *params.IsoCountry)
	}
	if params != nil && params.Mcc != nil {
		data.Set("Mcc", *params.Mcc)
	}
	if params != nil && params.Mnc != nil {
		data.Set("Mnc", *params.Mnc)
	}
	if params != nil && params.PageSize != nil {
		data.Set("PageSize", fmt.Sprint(*params.PageSize))
	}

	if pageToken != "" {
		data.Set("PageToken", pageToken)
	}
	if pageNumber != "" {
		data.Set("Page", pageNumber)
	}

	resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	ps := &ListNetworkResponse{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}

	return ps, err
}

// Lists Network records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.
func (c *ApiService) ListNetwork(params *ListNetworkParams) ([]SupersimV1Network, error) {
	response, errors := c.StreamNetwork(params)

	records := make([]SupersimV1Network, 0)
	for record := range response {
		records = append(records, record)
	}

	if err := <-errors; err != nil {
		return nil, err
	}

	return records, nil
}

// Streams Network records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.
func (c *ApiService) StreamNetwork(params *ListNetworkParams) (chan SupersimV1Network, chan error) {
	if params == nil {
		params = &ListNetworkParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))

	recordChannel := make(chan SupersimV1Network, 1)
	errorChannel := make(chan error, 1)

	response, err := c.PageNetwork(params, "", "")
	if err != nil {
		errorChannel <- err
		close(recordChannel)
		close(errorChannel)
	} else {
		go c.streamNetwork(response, params, recordChannel, errorChannel)
	}

	return recordChannel, errorChannel
}

func (c *ApiService) streamNetwork(response *ListNetworkResponse, params *ListNetworkParams, recordChannel chan SupersimV1Network, errorChannel chan error) {
	curRecord := 1

	for response != nil {
		responseRecords := response.Networks
		for item := range responseRecords {
			recordChannel <- responseRecords[item]
			curRecord += 1
			if params.Limit != nil && *params.Limit < curRecord {
				close(recordChannel)
				close(errorChannel)
				return
			}
		}

		record, err := client.GetNext(c.baseURL, response, c.getNextListNetworkResponse)
		if err != nil {
			errorChannel <- err
			break
		} else if record == nil {
			break
		}

		response = record.(*ListNetworkResponse)
	}

	close(recordChannel)
	close(errorChannel)
}

func (c *ApiService) getNextListNetworkResponse(nextPageUrl string) (interface{}, error) {
	if nextPageUrl == "" {
		return nil, nil
	}
	resp, err := c.requestHandler.Get(nextPageUrl, nil, nil)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	ps := &ListNetworkResponse{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, nil
}


text:
//
//  Data.hpp
//  TagBufCPP
//
//  Created by hejunqiu on 16/9/2.
//  Copyright © 2016年 CHE. All rights reserved.
//

#ifndef DATA_HPP
#define DATA_HPP

#include "Object.hpp"
#include "Range.hpp"
#include "iterator"
#include <functional>
#include <iosfwd>

CC_BEGIN

class Data : public Object
{
public:
    using iterator = _CC::iterator<byte *>;
    using const_iterator = _CC::iterator<const byte *>;
    using reverse_iterator = _CC::reverse_iterator<iterator>;
    using const_reverse_iterator = _CC::reverse_iterator<const_iterator>;
public:
    explicit Data(uinteger capacity = 0) NOEXCEPT;
    explicit Data(const void *bytes, uinteger length) NOEXCEPT;
    explicit Data(const vector<byte> &bytes) NOEXCEPT;
    explicit Data(vector<byte> &&bytes) NOEXCEPT;
    explicit Data(const string &aString) NOEXCEPT;
    explicit Data(const Data &data) NOEXCEPT;
    explicit Data(Data &&data) NOEXCEPT;

    ~Data() NOEXCEPT override;

    uinteger length() const NOEXCEPT;
    uinteger capacity() const NOEXCEPT;
    void clear() NOEXCEPT;
    void resize(uinteger nszie) NOEXCEPT;

    void deleteBytesInRange(Range range) NOEXCEPT(false);

    Data& operator=(const Data &rhs) NOEXCEPT;
    Data& operator=(const std::vector<byte> &rhs) NOEXCEPT;
    Data& operator=(const char *utf8String) NOEXCEPT(false);
    Data& operator=(const std::string &rhs) NOEXCEPT;

    Data& operator+=(const Data &rhs) NOEXCEPT;
    Data& operator+=(const byte rhs) NOEXCEPT;

    Data& append(const void *bytes, uinteger length) NOEXCEPT(false);
    Data& append(const Data &data) NOEXCEPT;
    Data& append(const vector<byte> &data) NOEXCEPT;
    Data& append(const string &aString) NOEXCEPT;

    void insert(byte b, uinteger pos) NOEXCEPT(false);
    void insert(const void *b, uinteger length, uinteger pos) NOEXCEPT(false);
    void insert(const Data &data, uinteger pos) NOEXCEPT(false);
    void insert(const vector<byte> &data, uinteger pos) NOEXCEPT(false);
    void insert(const string &aString, uinteger pos) NOEXCEPT(false);

    void replace(Range range, const Data &data) NOEXCEPT(false);
    void replace(Range range, const void *data, uinteger length) NOEXCEPT(false);
    void resetInRange(Range range) NOEXCEPT(false);

    byte operator[](const uinteger idx) const NOEXCEPT(false);
    byte& operator[](const uinteger idx) NOEXCEPT(false);

	byte *data() NOEXCEPT;
	const byte *data() const NOEXCEPT;

    friend std::ostream& operator<<(std::ostream& os, const Data &data) NOEXCEPT;
    friend std::ostream& operator<<(std::ostream& os, const shared_ptr<Data> &data) NOEXCEPT;
    friend std::ostream& operator<<(std::ostream& os, const Data *data) NOEXCEPT;

    // C++ STL style iterator
    iterator begin() _NOEXCEPT
    { return iterator(__get_pointer()); }

    const_iterator begin() const _NOEXCEPT
    { return const_iterator(__get_pointer()); }
    const_iterator cbegin() const _NOEXCEPT
    { return begin(); }

    iterator end() _NOEXCEPT
    { return iterator(__get_pointer() + length()); }
    const_iterator end() const _NOEXCEPT
    { return const_iterator(__get_pointer() + length()); }
    const_iterator cend() const _NOEXCEPT
    { return end(); }

    reverse_iterator rbegin() _NOEXCEPT
    { return reverse_iterator(end()); }
    const_reverse_iterator rbegin() const _NOEXCEPT
    { return const_reverse_iterator(end()); }
    const_reverse_iterator crbegin() const _NOEXCEPT
    { return rbegin(); }

    reverse_iterator rend() _NOEXCEPT
    { return reverse_iterator(begin()); }
    const_reverse_iterator rend() const _NOEXCEPT
    { return const_reverse_iterator(begin()); }
    const_reverse_iterator crend() const _NOEXCEPT
    { return rend(); }
private:
    byte * __get_pointer() _NOEXCEPT;
    const byte * __get_pointer() const _NOEXCEPT;
};

CC_END
#endif /* DATA_HPP */


text:
<?php
    defined('BASEPATH') OR exit('No direct script access allowed');
    foreach ($isi as $key) {
      // $key['foto'];
    }
?>

<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Dashboard Teacher</title>

        <link href="<?= base_url(); ?>assets/fonts/css/font-awesome.min.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/bootstrap.min.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/animate.min.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/custom.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/icheck/flat/green.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/datatables/tools/css/dataTables.tableTools.css" rel="stylesheet">
        <link href="<?= base_url(); ?>assets/css/fullscreenmodal/bootstrap-modal-carousel.min.css" rel="stylesheet">

                            <a href="<?= base_url(); ?>dashboard" class="site_title"> Teacher's Site

                                <img src="<?= $key['foto']; ?>" alt="..." class="img-circle profile_img">

                                Welcome,
<?= $key['nama_guru']; ?>

                                         Data Pribadi

<a href="<?= base_url(); ?>dashboard/master_profile_guru">Profile

<a href="<?= base_url(); ?>dashboard/master_akun_guru">Akun

<a href="<?= base_url(); ?>dashboard/pilih_tahun">Penilaian

<a href="<?= base_url(); ?>dashboard/master_jadwal_guru">Jadwal Mengajar

                                            <?php
                                                foreach ($isi2 as $key_isi2) {
                                                    if(isset($key_isi2['employee_id'])) {
                                            ?>

<a href="<?= base_url(); ?>dashboard/master_walikelas_data_siswa">Daftar Siswa ( Wali kelas )

<a href="<?= base_url(); ?>dashboard/tahun_wali">Report Siswa ( Wali kelas )

                                            <?php
                                                    }
                                                }
                                            ?>

                                        <img src="<?= $key['foto'] ?>" alt="">John Doe

                                            Profile

                                                Settings

                                            <a href="<?= base_url(); ?>dashboard/logout">
                                                Log Out

                                        <?= $contents ?>

Gentelella Alela! a Bootstrap 3 template by Kimlabs. |
                                  Gentelella Alela!