text:
var config = {};

config.orchestration = {};
/****************************************************************************
 * Specify Orchestration Model
 * Available models are:
 *  - openstack
 *  - cloudstack
 * If you do not want to specify any model, set it to 'none'
 *
 *****************************************************************************/
config.orchestration.Manager = 'openstack';

/****************************************************************************
 * This boolean flag indicates to communicate with Orchestration
 * modules(networkManager, imageManager, computeManager, identityManager,
 * storageManager), should the webServer communicate using the
 * ip/port/authProtocol/apiVersion as specified in this file, or as returned
 * from auth catalog list.
 * Note: config.identityManager.apiVersion is not controlled by this boolean
 * flag.
 *
 * true  - These values should be taken from this config
 *         file.
 * false - These values should be taken from auth catalog list
 *
 *****************************************************************************/
config.serviceEndPointFromConfig = true;

/****************************************************************************
 * This boolean flag specifies wheather region list should be taken from config
 * file or from keystone endpoint
 * true  - If set as true, then keystone endpoint is taken from
 *         config.regions
 * false - If set as false, then keystone endpoint is taken from
 *         config.identityManager
 *
 ****************************************************************************/
config.regionsFromConfig = false;

/****************************************************************************
 * Below are the configs for Api Server and analytics Service type & name as
 * provisioned in keystone
 *
 * apiServiceType - Service Type for apiServer, default value is apiServer
 * opServiceType  - Service Type for analytics, default value is opServer
 *
 * Note: If there are multiple api server or analytices nodes in a specific
 *       region, then provision service type/name as ApiServer0, ApiServer1,
 *       ApiServer2 etc, similarly for analytics node: OpServer0, OpServer1,
 *       OpServer2 etc.
 *
 ****************************************************************************/
config.endpoints = {};
config.endpoints.apiServiceType = 'ApiServer';
config.endpoints.opServiceType = 'OpServer';

/****************************************************************************
 * Mapping to region name with keystone endpoint
 *
 * For example:
 * config.regions.RegionOne = 'http://nodeIp:5000/v2.0';
 * config.regions.RegionTwo = 'http://nodeIp:5000/v3';
 *
 ****************************************************************************/
config.regions = {};
config.regions.RegionOne = 'http://127.0.0.1:5000/v2.0';

/****************************************************************************
 * This boolean flag indicates if serviceEndPointFromConfig is set as false,
 * then to take IP/Port/Protocol/Version information from auth catalog,
 * should publicURL OR internalURL will be used.
 *
 * true  - publicURL in endpoint will be used to retrieve IP/Port/Protocol/
 *         Version information
 * false - internalURL in endpoint will be used to retrieve
 *         IP/Port/Protocol/Version information
 *
 * NOTE: if config.serviceEndPointFromConfig is set as true, then this flag
 *       does not have any effect.
 *
 *****************************************************************************/
config.serviceEndPointTakePublicURL = true;

/****************************************************************************
 * Below are the config options for all Orchestration Modules below:
 *  - networkManager
 *  - imageManager
 *  - computeManager
 *  - identityManager
 *  - storageManager
 *  - cnfg
 *  - analytics
 *
 * Options:
 * ip:
 *      IP to connect to for this Server.
 * port:
 *      Port to connect to for this server
 * authProtocol:
 *      Specify authProtocol either 'http' or 'https'
 * apiVersion:
 *      REST API Version for this server to connect to.
 *      Specify a list of Versions in array notation.
 *      Below are the supported list of apiVersion for the modules as of now:
 *      imageManager    -   ['v1', 'v2']
 *      computeManager  -   ['v1.1', 'v2']
 *      identityManager -   ['v2.0']
 *      storageManager  -   ['v1']
 *
 *      Not applicable for cnfg/analytics as of now
 * strictSSL:
 *      If true, requires certificates to be valid
 * ca:
 *      An authority certificate to check the remote host against,
 *      if you do not want to specify then use ''
 *****************************************************************************/
config.networkManager = {};
config.networkManager.ip = '127.0.0.1';
config.networkManager.port = '9696'
config.networkManager.authProtocol = 'http';
config.networkManager.apiVersion = [];
config.networkManager.strictSSL = false;
config.networkManager.ca = '';

config.imageManager = {};
config.imageManager.ip = '127.0.0.1';
config.imageManager.port = '9292';
config.imageManager.authProtocol = 'http';
config.imageManager.apiVersion = ['v1', 'v2'];
config.imageManager.strictSSL = false;
config.imageManager.ca = '';

config.computeManager = {};
config.computeManager.ip = '127.0.0.1';
config.computeManager.port = '8774';
config.computeManager.authProtocol = 'http';
config.computeManager.apiVersion = ['v1.1', 'v2'];
config.computeManager.strictSSL = false;
config.computeManager.ca = '';

config.identityManager = {};
config.identityManager.ip = '127.0.0.1';
config.identityManager.port = '5000';
config.identityManager.authProtocol = 'http';
/******************************************************************************
 * Note: config.identityManager.apiVersion is not controlled by boolean flag
 * config.serviceEndPointFromConfig. If specified apiVersion here, then these
 * API versions will be used while using REST API to identityManager.
 * If want to use with default apiVersion(v2.0), then can specify it as
 * empty array.
 ******************************************************************************/
config.identityManager.apiVersion = ['v2.0'];
config.identityManager.strictSSL = false;
config.identityManager.ca = '';

config.storageManager = {};
config.storageManager.ip = '127.0.0.1';
config.storageManager.port = '8776';
config.storageManager.authProtocol = 'http';
config.storageManager.apiVersion = ['v1'];
config.storageManager.strictSSL = false;
config.storageManager.ca = '';

// VNConfig API server and port.
config.cnfg = {};
config.cnfg.server_ip = ['127.0.0.1'];
config.cnfg.server_port = '8082';
config.cnfg.authProtocol = 'http';
config.cnfg.strictSSL = false;
config.cnfg.ca = '';
config.cnfg.statusURL = "/global-system-configs";

// Analytics API server and port.
config.analytics = {};
config.analytics.server_ip = ['127.0.0.1'];
config.analytics.server_port = '8081';
config.analytics.authProtocol = 'http';
config.analytics.strictSSL = false;
config.analytics.ca = '';
config.analytics.statusURL = "/analytics/uves/bgp-peers";

//DNS API Server and port.
/* Please note: being introspect port, SSL options for dns should come from
   config.introspect.ssl configuration
 */
config.dns = {};
config.dns.server_ip = ['127.0.0.1'];
config.dns.server_port = '8092';
config.dns.statusURL = "/Snh_PageReq?x=AllEntries%20VdnsServersReq";

// vcenter related parameters
config.vcenter = {};
config.vcenter.server_ip = '127.0.0.1';         //vCenter IP
config.vcenter.server_port = '443';             //Port
config.vcenter.authProtocol = 'https';          //http or https
config.vcenter.datacenter = 'vcenter';          //datacenter name
config.vcenter.dvsswitch = 'vswitch';           //dvsswitch name
config.vcenter.strictSSL = false;               //Validate the certificate or ignore
config.vcenter.ca = '';                         //specify the certificate key file
config.vcenter.wsdl = '/usr/src/contrail/contrail-web-core/webroot/js/vim.wsdl';

/*****************************************************************************
 * The below configurations descibe the SSL options for connecting to different
 * introspect port.
 *
 * enabled:
 *      Boolean flag to enable or disable ssl while connecting to different
 *      introspect port
 * key:
 *      Private key to use for SSL
 * cert:
 *      Public x509 certificate to use
 * ca:
 *      A string, Buffer or array of strings or Buffers of trusted certificates
 *      in PEM format. These are used to authorize connections.
 * strictSSL:
 *      If true, the server certificate is verified against the list of
 *      supplied CAs
 *****************************************************************************/
config.introspect = {};
config.introspect.ssl = {};
config.introspect.ssl.enabled = false;
config.introspect.ssl.key = '';
config.introspect.ssl.cert = '';
config.introspect.ssl.ca = '';
config.introspect.ssl.strictSSL = false;

/* Job Server */
config.jobServer = {};
config.jobServer.server_ip = '127.0.0.1';
config.jobServer.server_port = '3000';

/* Upload/Download Directory */
config.files = {};
config.files.download_path = '/tmp';

/* Cassandra Server */
config.cassandra = {};
config.cassandra.server_ips = ['127.0.0.1'];
config.cassandra.server_port = '9042';
config.cassandra.enable_edit = false;

/* KUE Job Scheduler */
config.kue = {};
config.kue.ui_port = '3002'

/* IP List to listen on */
config.webui_addresses = ['0.0.0.0'];

/* Is insecure access to WebUI?
 * If set as false, then all http request will be redirected
 * to https, if set true, then no https request will be processed, but only http
 * request
 */
config.insecure_access = false;

// HTTP port for NodeJS Server.
config.http_port = '8080';

// HTTPS port for NodeJS Server.
config.https_port = '8143';

// Activate/Deactivate Login.
config.require_auth = false;

/* Number of node worker processes for cluster. */
config.node_worker_count = 1;

/* Number of Parallel Active Jobs with same type */
config.maxActiveJobs = 10;

/* Redis DB index for Web-UI */
config.redisDBIndex = 3;

/* Retry time for reading servers list recursively */
config.CONTRAIL_SERVICE_RETRY_TIME = 300000; //5 minutes

/* WebUI Redis Server */
config.redis_server_port = '6379';
config.redis_server_ip = '127.0.0.1';
config.redis_dump_file = '/var/lib/redis/dump-webui.rdb';
config.redis_password = '';

/* Logo File: Use complete path of logo file location */
config.logo_file = '/usr/src/contrail/contrail-web-core/webroot/img/opencontrail-logo.png';

/* Favicon File: Use complete path of favicon file location */
config.favicon_file = '/usr/src/contrail/contrail-web-core/webroot/img/opencontrail-favicon.ico';

config.featurePkg = {};
/* Add new feature Package Config details below */
config.featurePkg.webController = {};
config.featurePkg.webController.path = '/usr/src/contrail/contrail-web-controller';
config.featurePkg.webController.enable = true;

/* Enable/disable Stat Query Links in Sidebar*/
config.qe = {};
config.qe.enable_stat_queries = false;

/* Configure level of logs, supported log levels are:
 debug, info, notice, warning, error, crit, alert, emerg
 */
config.logs = {};
config.logs.level = 'debug';

/******************************************************************************
 * Boolean flag getDomainProjectsFromApiServer indicates wheather the project
 * list should come from API Server or Identity Manager.
 * If Set
 *      - true, then project list will come from API Server
 *      - false, then project list will come from Identity Manager
 * Default: false
 *
 ******************************************************************************/
config.getDomainProjectsFromApiServer = false;
/*****************************************************************************
 * Boolean flag L2_enable indicates the default forwarding-mode of a network.
 * Allowed values : true / false
 * Set this flag to true if all the networks are to be L2 networks,
 * set to false otherwise.
 *****************************************************************************/
config.network = {};
config.network.L2_enable = false;

/******************************************************************************
 * Boolean flag getDomainsFromApiServer indicates wheather the domain
 * list should come from API Server or Identity Manager.
 * If Set
 *      - true, then domain list will come from API Server
 *      - false, then domain list will come from Identity Manager
 * Default: true
 * NOTE: if config.identityManager.apiVersion is set as v2.0, then this flag
 *       does not have any effect, in that case the domain list is retrieved
 *       from API Server.
 *
 *****************************************************************************/
config.getDomainsFromApiServer = false;

config.jsonSchemaPath = "/usr/src/contrail/contrail-web-core/src/serverroot/configJsonSchemas";

// Export this as a module.
module.exports = config;


text:
<?php

namespace Vobla\ServiceConstruction\Builders\AnnotationsBuilder\Processors;

use Vobla\ServiceConstruction\Definition\ServiceDefinition,
    Vobla\ServiceConstruction\Builders\AnnotationsBuilder\Annotations\NotByTypeWiringCandidate,
    Vobla\ServiceConstruction\Builders\AnnotationsBuilder\AnnotationsBuilder;

/**
 * @author Sergei Lissovski <sergei.lissovski@gmail.com>
 */
class TypeProcessor implements Processor
{
    /**
     * {@inheritdoc}
     */
    public function handle(\ReflectionClass $reflClass, ServiceDefinition $serviceDefinition, AnnotationsBuilder $annotationsBuilder)
    {
        $ar = $annotationsBuilder->getAnnotationReader();
        $notByTypeWiringCandidate = $ar->getClassAnnotation($reflClass, NotByTypeWiringCandidate::clazz());
        if ($notByTypeWiringCandidate) {
            $serviceDefinition->setMetaEntry('notByTypeWiringCandidate', true);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#import <UIKit/UIKit.h>

@interface ToolbarViewController : UIViewController <UINavigationBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>
{
	UISegmentedControl		*barStyleSegControl;
	UISwitch				*tintSwitch;
	UISegmentedControl		*buttonItemStyleSegControl;
	UIPickerView			*systemButtonPicker;

	UIToolbar				*toolbar;	// created programmatically, not in IB
	NSArray					*pickerViewArray;
	UIBarButtonSystemItem	currentSystemItem;
}

@property (nonatomic, retain) IBOutlet UISegmentedControl *barStyleSegControl;
@property (nonatomic, retain) IBOutlet UISwitch *tintSwitch;
@property (nonatomic, retain) IBOutlet UISegmentedControl *buttonItemStyleSegControl;
@property (nonatomic, retain) IBOutlet UIPickerView *systemButtonPicker;

@property (nonatomic, retain) UIToolbar	*toolbar;
@property (nonatomic, retain) NSArray *pickerViewArray;

- (IBAction)toggleStyle:(id)sender;
- (IBAction)toggleBarStyle:(id)sender;
- (IBAction)toggleTintColor:(id)sender;

@end


text:
package org.springframework.samples.petclinic.owner;

import java.util.Collection;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

/**
 * Repository class for Owner domain objects All method names are compliant with Spring Data naming
 * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
 *
 * @author Ken Krebs
 * @author Juergen Hoeller
 * @author Sam Brannen
 * @author Michael Isvy
 */
public interface OwnerRepository extends Repository<Owner, Integer> {

    /**
     * Retrieve {@link Owner}s from the data store by last name, returning all owners
     * whose last name starts with the given name.
     * @param lastName Value to search for
     * @return a Collection of matching {@link Owner}s (or an empty Collection if none
     * found)
     */
    @Query("SELECT DISTINCT owner FROM Owner owner left join fetch owner.pets WHERE owner.lastName LIKE :lastName%")
    @Transactional(readOnly = true)
    Collection<Owner> findByLastName(@Param("lastName") String lastName);

    /**
     * Retrieve an {@link Owner} from the data store by id.
     * @param id the id to search for
     * @return the {@link Owner} if found
     */
    @Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
    @Transactional(readOnly = true)
    Owner findById(@Param("id") Integer id);

    /**
     * Save an {@link Owner} to the data store, either inserting or updating it.
     * @param owner the {@link Owner} to save
     */
    void save(Owner owner);

}


text:
/*
 * E_TCPAssignment.hpp
 *
 *  Created on: 2014. 11. 20.
 *      Author: 근홍
 */

#ifndef E_TCPASSIGNMENT_HPP_
#define E_TCPASSIGNMENT_HPP_

#include <E/Networking/E_Networking.hpp>
#include <E/Networking/E_Host.hpp>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <list>

#include <E/E_TimerModule.hpp>

namespace E
{
struct b_sock {
    int fd;
    long addr;
    short port;
};
//typedef struct b_sock_ b_sock;

class TCPAssignment : public HostModule, public NetworkModule, public SystemCallInterface, private NetworkLog, private TimerModule
{
public:
        std::list<struct b_sock> b_sock_map;
private:
	virtual void timerCallback(void* payload) final;
/* custom declare */
	void syscall_socket(UUID syscall, int pid, int param1, int param2);
	void syscall_close(UUID syscall, int pid, int param1);
        void syscall_bind(UUID syscallUUID, int pid, int param1_int, struct sockaddr * param2_ptr, socklen_t param3_int);
        bool is_overlap(b_sock new_sock);
        std::list<struct b_sock>::iterator find_b_sock_by(int fd);
        void syscall_getsockname(UUID syscallUUID, int pid, int fd, struct sockaddr * sock_addr, socklen_t* sock_len);

public:
	TCPAssignment(Host* host);
	virtual void initialize();
	virtual void finalize();
	virtual ~TCPAssignment();
protected:
	virtual void systemCallback(UUID syscallUUID, int pid, const SystemCallParameter& param) final;
	virtual void packetArrived(std::string fromModule, Packet* packet) final;
};

class TCPAssignmentProvider
{
private:
	TCPAssignmentProvider() {}
	~TCPAssignmentProvider() {}
public:
	static HostModule* allocate(Host* host) { return new TCPAssignment(host); }
};

}

#endif /* E_TCPASSIGNMENT_HPP_ */


text:
package org.apache.servicecomb.core.invocation.timeout;

import org.apache.commons.lang3.math.NumberUtils;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.core.invocation.InvocationTimeoutStrategy;
import org.springframework.stereotype.Component;

import com.google.common.base.Ticker;

/**
 * <pre>
 * Cumulative Processing Time
 * not depend on time synchronization
 * but lost network and framework outside of servicecomb processing time
 *
 * consumer: c
 * producer: p
 * ---------------------------------------------------------------
 * | process 2                                                   |
 * |                 c-send(T5)                       c-send(T8) |
 * |                    ↑                               ↑      |
 * | p-start(T3) → c-start(T4) → p-operation(T6) → c-start(T7)|
 * -----↑--------------------------------------------------------
 *      ↑
 * -----↑-----------------
 * |    ↑     process 1  |
 * |  c-send(T2)          |
 * |    ↑                |
 * |  c-start(T1)         |
 * ------------------------
 *
 * T2 timeout: T2 - T1
 * T3 timeout: (T2 - T1) + (T3 - T3)
 * T4 timeout: (T2 - T1) + (T4 - T3)
 * T5 timeout: (T2 - T1) + (T5 - T3)
 * T6 timeout: (T2 - T1) + (T6 - T3)
 * T7 timeout: (T2 - T1) + (T7 - T3)
 * T8 timeout: (T2 - T1) + (T8 - T3)
 * ......
 * </pre>
 */
@Component
public class ProcessingTimeStrategy implements InvocationTimeoutStrategy {
  public static final String NAME = "processing-time";

  // nanoseconds
  // used inside one process
  // not depend on time synchronization
  public static final String CHAIN_START_TIME = "x-scb-process-chain-start";

  // nanoseconds
  // processing time of all previous process
  // transfer between processes
  public static final String CHAIN_PROCESSING = "x-scb-processing-time";

  private Ticker ticker = Ticker.systemTicker();

  public ProcessingTimeStrategy setTicker(Ticker ticker) {
    this.ticker = ticker;
    return this;
  }

  @Override
  public String name() {
    return NAME;
  }

  @Override
  public void start(Invocation invocation) {
    initProcessChainStart(invocation);
    initChainProcessing(invocation);
  }

  private void initProcessChainStart(Invocation invocation) {
    if (invocation.getLocalContext(CHAIN_START_TIME) != null) {
      return;
    }

    invocation.addLocalContext(CHAIN_START_TIME, invocation.getInvocationStageTrace().getStart());
  }

  private void initChainProcessing(Invocation invocation) {
    if (invocation.getLocalContext(CHAIN_PROCESSING) != null) {
      return;
    }

    String contextChainProcessing = invocation.getContext(CHAIN_PROCESSING);
    long chainProcessingTime = NumberUtils.toLong(contextChainProcessing, 0L);
    invocation.addLocalContext(CHAIN_PROCESSING, chainProcessingTime);
  }

  @Override
  public void beforeSendRequest(Invocation invocation) {
    InvocationTimeoutStrategy.super.beforeSendRequest(invocation);

    long processingTime = calculateElapsedNanoTime(invocation);
    invocation.addContext(CHAIN_PROCESSING, Long.toString(processingTime));
  }

  @Override
  public long calculateElapsedNanoTime(Invocation invocation) {
    long chainStartTime = invocation.getLocalContext(CHAIN_START_TIME);
    long previousProcessingTime = invocation.getLocalContext(CHAIN_PROCESSING);
    return ticker.read() - chainStartTime + previousProcessingTime;
  }
}


text:
![](bar_secondary_axis_only_full.png)

Example:

```
/// Bar chart example
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;

/// Example of using only a secondary axis (on the right) for a set of grouped
/// bars.
///
/// Both series plots using the secondary axis due to the measureAxisId of
/// secondaryMeasureAxisId.
///
/// Note: secondary may flip left and right positioning when
/// RTL.flipAxisLocations is set.
class BarChartWithSecondaryAxisOnly extends StatelessWidget {
  static const secondaryMeasureAxisId = 'secondaryMeasureAxisId';
  final List<charts.Series> seriesList;
  final bool animate;

  BarChartWithSecondaryAxisOnly(this.seriesList, {this.animate});

  factory BarChartWithSecondaryAxisOnly.withSampleData() {
    return new BarChartWithSecondaryAxisOnly(
      _createSampleData(),
      // Disable animations for image tests.
      animate: false,
    );
  }

  @override
  Widget build(BuildContext context) {
    return new charts.BarChart(
      seriesList,
      animate: animate,
    );
  }

  /// Create series list with multiple series
  static List<charts.Series<OrdinalSales, String>> _createSampleData() {
    final globalSalesData = [
      new OrdinalSales('2014', 500),
      new OrdinalSales('2015', 2500),
      new OrdinalSales('2016', 1000),
      new OrdinalSales('2017', 7500),
    ];

    return [
      new charts.Series<OrdinalSales, String>(
        id: 'Global Revenue',
        domainFn: (OrdinalSales sales, _) => sales.year,
        measureFn: (OrdinalSales sales, _) => sales.sales,
        data: globalSalesData,
      )
        // Set series to use the secondary measure axis.
        ..setAttribute(charts.measureAxisIdKey, secondaryMeasureAxisId),
    ];
  }
}

/// Sample ordinal data type.
class OrdinalSales {
  final String year;
  final int sales;

  OrdinalSales(this.year, this.sales);
}
```


text:
module Songbooks
  module ViewHelper
    def self.javascripts
      Dir[Songbooks.root.join('public', 'javascripts', 'components', '**', '*.js').to_s].map do |filename|
        filename.sub(Songbooks.root.join('public', 'javascripts/').to_s, '')
      end
    end
  end
end


text:
namespace blink {

class IdleTaskRunner : public WebScheduler::IdleTask {
public:
    explicit IdleTaskRunner(PassOwnPtr<Scheduler::IdleTask> task)
        : m_task(task)
    {
    }

    virtual ~IdleTaskRunner()
    {
    }

    // WebScheduler::IdleTask implementation.
    void run(double deadlineSeconds) override
    {
        (*m_task)(deadlineSeconds);
    }
private:
    OwnPtr<Scheduler::IdleTask> m_task;
};

Scheduler* Scheduler::s_sharedScheduler = nullptr;

void Scheduler::shutdown()
{
    delete s_sharedScheduler;
    s_sharedScheduler = nullptr;
}

Scheduler* Scheduler::shared()
{
    if (!s_sharedScheduler)
        s_sharedScheduler = new Scheduler(Platform::current()->scheduler());
    return s_sharedScheduler;
}

Scheduler::Scheduler(WebScheduler* webScheduler)
    : m_webScheduler(webScheduler)
{
}

Scheduler::~Scheduler()
{
    if (m_webScheduler)
        m_webScheduler->shutdown();
}

void Scheduler::postIdleTask(const TraceLocation& location, PassOwnPtr<IdleTask> idleTask)
{
    if (m_webScheduler)
        m_webScheduler->postIdleTask(WebTraceLocation(location), new IdleTaskRunner(idleTask));
}

bool Scheduler::shouldYieldForHighPriorityWork() const
{
    if (m_webScheduler)
        return m_webScheduler->shouldYieldForHighPriorityWork();
    return false;
}

} // namespace blink


text:
<?php
function add() {
    //Upload your Pokemon (picture)
	$target_dir = "pc/";
	$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

        // flag for checking file
	$upload_check = 1;

	// Check if file already exists
	if (file_exists($target_file)) {
                html_div(100,0,"#ffffff",30);
		echo "Sorry, your Pokemon is already exists.";
                html_div_end();
		$upload_check = 0;
	}

	// Check file size
	if ($_FILES["fileToUpload"]["size"] > 1024000) {
                html_div(100,0,"#ffffff",30);
		echo "Sorry, your Pokemon is too large?!";
                html_div_end();
		$upload_check = 0;
	}
        // for example , these code is for Checking the Filename Extension.
	// You should modify it.
        /*
        if($_FILES["fileToUpload"]["type"]!="image/jpeg"&&$_FILES["fileToUpload"]["type"]!="image/png"&&$_FILES["fileToUpload"]["type"]!="image/gif"){
            $upload_check=0;
        }
        */
	if ($upload_check == 0) {
            html_div(100,0,"#ffffff",30);
	    echo "Sorry, your Pokemon was not uploaded.";
            html_div_end();
	// if everything is ok, try to upload file
	} else {
	    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                html_div(100,0,"#ffffff",30);
		echo "The Pokemon ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
                html_div_end();
	    } else {
                html_div(100,0,"#ffffff",30);
		echo "Sorry, there was an error uploading your Pokemon.";
                html_div_end();
	    }
	}
}

function search($name) {
    //Search engine
	if (file_exists("pc/".$name)) {
            html_div(100,0,"#ffffff",30);
	    echo "Here is your Pokemon";
            html_div_end();
            html_img("http://".$_SERVER['HTTP_HOST']."/pc/".$name);
	}else{
            html_div(100,0,"#ffffff",30);
            echo "Pokemon Not Found.";
            html_div_end();
        }

}

function dashboard() {
    //redirect to search engine
    if(isset($_POST["name"])){
        //search by name
        header("Location: http://".$_SERVER['HTTP_HOST']."/menu.php/upload/search/".$_POST["name"]);
        die();
    }
    // Search / Upload Form template
    include_once("template/up_search.tpl");
    include_once("template/upload.tpl");
    // Pokemon Box list
    html_div(100,0,"#812919",30);
    echo "PokeMon Box";
    html_div_end();
    $PokemonBoxList = scandir("./pc/");
    foreach ($PokemonBoxList as $value) {
        if($value=="."||$value==".."){continue;}
        echo $value."<br>";
    }
}
?>


text:
package org.apache.lucene.codecs.lucene46;

import java.io.IOException;
import java.util.Map;
import java.util.Set;

import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.SegmentInfoReader;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.util.IOUtils;

/**
 * Lucene 4.6 implementation of {@link SegmentInfoReader}.
 *
 * @see Lucene46SegmentInfoFormat
 * @lucene.experimental
 */
public class Lucene46SegmentInfoReader extends SegmentInfoReader {

  /** Sole constructor. */
  public Lucene46SegmentInfoReader() {
  }

  @Override
  public SegmentInfo read(Directory dir, String segment, IOContext context) throws IOException {
    final String fileName = IndexFileNames.segmentFileName(segment, "", Lucene46SegmentInfoFormat.SI_EXTENSION);
    final IndexInput input = dir.openInput(fileName, context);
    boolean success = false;
    try {
      CodecUtil.checkHeader(input, Lucene46SegmentInfoFormat.CODEC_NAME,
                                   Lucene46SegmentInfoFormat.VERSION_START,
                                   Lucene46SegmentInfoFormat.VERSION_CURRENT);
      final String version = input.readString();
      final int docCount = input.readInt();
      if (docCount < 0) {
        throw new CorruptIndexException("invalid docCount: " + docCount + " (resource=" + input + ")");
      }
      final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;
      final Map<String,String> diagnostics = input.readStringStringMap();
      final Set<String> files = input.readStringSet();

      if (input.getFilePointer() != input.length()) {
        throw new CorruptIndexException("did not read all bytes from file \"" + fileName + "\": read " + input.getFilePointer() + " vs size " + input.length() + " (resource: " + input + ")");
      }

      final SegmentInfo si = new SegmentInfo(dir, version, segment, docCount, isCompoundFile, null, diagnostics);
      si.setFiles(files);

      success = true;

      return si;

    } finally {
      if (!success) {
        IOUtils.closeWhileHandlingException(input);
      } else {
        input.close();
      }
    }
  }
}


text:
/*
 * GoogleChrome.h
 */

#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>

@class GoogleChromeApplication, GoogleChromeWindow, GoogleChromeTab, GoogleChromeBookmarkFolder, GoogleChromeBookmarkItem;

/*
 * Standard Suite
 */

// The application's top-level scripting object.
@interface GoogleChromeApplication : SBApplication

- (SBElementArray *) windows;

@property (copy, readonly) NSString *name;  // The name of the application.
@property (readonly) BOOL frontmost;  // Is this the frontmost (active) application?
@property (copy, readonly) NSString *version;  // The version of the application.

- (void) open:(NSArray *)x;  // Open a document.
- (void) quit;  // Quit the application.
- (BOOL) exists:(id)x;  // Verify if an object exists.

@end

// A window.
@interface GoogleChromeWindow : SBObject

- (SBElementArray *) tabs;

@property (copy, readonly) NSString *name;  // The full title of the window.
- (NSInteger) id;  // The unique identifier of the window.
@property NSInteger index;  // The index of the window, ordered front to back.
@property NSRect bounds;  // The bounding rectangle of the window.
@property (readonly) BOOL closeable;  // Whether the window has a close box.
@property (readonly) BOOL minimizable;  // Whether the window can be minimized.
@property BOOL minimized;  // Whether the window is currently minimized.
@property (readonly) BOOL resizable;  // Whether the window can be resized.
@property BOOL visible;  // Whether the window is currently visible.
@property (readonly) BOOL zoomable;  // Whether the window can be zoomed.
@property BOOL zoomed;  // Whether the window is currently zoomed.
@property (copy, readonly) GoogleChromeTab *activeTab;  // Returns the currently selected tab
@property (copy) NSString *mode;  // Represents the mode of the window which can be 'normal' or 'incognito', can be set only once during creation of the window.
@property NSInteger activeTabIndex;  // The index of the active tab.

- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save an object.
- (void) close;  // Close a window.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.
- (void) print;  // Print an object.
- (void) reload;  // Reload a tab.
- (void) goBack;  // Go Back (If Possible).
- (void) goForward;  // Go Forward (If Possible).
- (void) selectAll;  // Select all.
- (void) cutSelection;  // Cut selected text (If Possible).
- (void) copySelection;  // Copy text.
- (void) pasteSelection;  // Paste text (If Possible).
- (void) undo;  // Undo the last change.
- (void) redo;  // Redo the last change.
- (void) stop;  // Stop the current tab from loading.
- (void) viewSource;  // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript;  // Execute a piece of javascript.
- (void) enterPresentationMode;  // Enter presentation mode in window.
- (void) exitPresentationMode;  // Exit presentation mode in window.

@end

/*
 * Chromium Suite
 */

// The application's top-level scripting object.
@interface GoogleChromeApplication (ChromiumSuite)

- (SBElementArray *) bookmarkFolders;

@property (copy, readonly) GoogleChromeBookmarkFolder *bookmarksBar;  // The bookmarks bar bookmark folder.
@property (copy, readonly) GoogleChromeBookmarkFolder *otherBookmarks;  // The other bookmarks bookmark folder.

@end

// A tab.
@interface GoogleChromeTab : SBObject

- (NSInteger) id;  // Unique ID of the tab.
@property (copy, readonly) NSString *title;  // The title of the tab.
@property (copy) NSString *URL;  // The url visible to the user.
@property (readonly) BOOL loading;  // Is loading?

- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save an object.
- (void) close;  // Close a window.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.
- (void) print;  // Print an object.
- (void) reload;  // Reload a tab.
- (void) goBack;  // Go Back (If Possible).
- (void) goForward;  // Go Forward (If Possible).
- (void) selectAll;  // Select all.
- (void) cutSelection;  // Cut selected text (If Possible).
- (void) copySelection;  // Copy text.
- (void) pasteSelection;  // Paste text (If Possible).
- (void) undo;  // Undo the last change.
- (void) redo;  // Redo the last change.
- (void) stop;  // Stop the current tab from loading.
- (void) viewSource;  // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript;  // Execute a piece of javascript.
- (void) enterPresentationMode;  // Enter presentation mode in window.
- (void) exitPresentationMode;  // Exit presentation mode in window.

@end

// A bookmarks folder that contains other bookmarks folder and bookmark items.
@interface GoogleChromeBookmarkFolder : SBObject

- (SBElementArray *) bookmarkFolders;
- (SBElementArray *) bookmarkItems;

- (NSNumber *) id;  // Unique ID of the bookmark folder.
@property (copy) NSString *title;  // The title of the folder.
@property (copy, readonly) NSNumber *index;  // Returns the index with respect to its parent bookmark folder

- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save an object.
- (void) close;  // Close a window.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.
- (void) print;  // Print an object.
- (void) reload;  // Reload a tab.
- (void) goBack;  // Go Back (If Possible).
- (void) goForward;  // Go Forward (If Possible).
- (void) selectAll;  // Select all.
- (void) cutSelection;  // Cut selected text (If Possible).
- (void) copySelection;  // Copy text.
- (void) pasteSelection;  // Paste text (If Possible).
- (void) undo;  // Undo the last change.
- (void) redo;  // Redo the last change.
- (void) stop;  // Stop the current tab from loading.
- (void) viewSource;  // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript;  // Execute a piece of javascript.
- (void) enterPresentationMode;  // Enter presentation mode in window.
- (void) exitPresentationMode;  // Exit presentation mode in window.

@end

// An item consists of an URL and the title of a bookmark
@interface GoogleChromeBookmarkItem : SBObject

- (NSInteger) id;  // Unique ID of the bookmark item.
@property (copy) NSString *title;  // The title of the bookmark item.
@property (copy) NSString *URL;  // The URL of the bookmark.
@property (copy, readonly) NSNumber *index;  // Returns the index with respect to its parent bookmark folder

- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save an object.
- (void) close;  // Close a window.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.
- (void) print;  // Print an object.
- (void) reload;  // Reload a tab.
- (void) goBack;  // Go Back (If Possible).
- (void) goForward;  // Go Forward (If Possible).
- (void) selectAll;  // Select all.
- (void) cutSelection;  // Cut selected text (If Possible).
- (void) copySelection;  // Copy text.
- (void) pasteSelection;  // Paste text (If Possible).
- (void) undo;  // Undo the last change.
- (void) redo;  // Redo the last change.
- (void) stop;  // Stop the current tab from loading.
- (void) viewSource;  // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript;  // Execute a piece of javascript.
- (void) enterPresentationMode;  // Enter presentation mode in window.
- (void) exitPresentationMode;  // Exit presentation mode in window.

@end

@interface GoogleChromeWindow (ChromiumSuite)

@property (readonly) BOOL presenting;  // Whether the window is in presentation mode.

@end


text:
#ifndef SKETCH_3D_RENDER_QUEUE_H
#define SKETCH_3D_RENDER_QUEUE_H

#include "render/RenderQueueItem.h"

#include "system/Platform.h"

#include <vector>
using namespace std;

namespace Sketch3D {

// Forward declaration
class Node;

/**
 * @class RenderQueue
 * Implements a render queue. Each item in the queue is sorted to allow faster drawing.
 * The render queue will also try to batch geometry data if they share the same material and
 * that they are both the same type of vertex buffers (static or dynamic)
 */
class SKETCH_3D_API RenderQueue {
    public:
        /**
         * Constructor
         */
                                    RenderQueue();

        /**
         * Adds a node to the queue. This will actually add all of SurfaceTriangles_t object of the mesh contained by the node, along with its model
         * matrix.
         * @param node The node to render
         * @param layer On which layer are we drawing everything. This option might change render state, such as depth testing
         */
        void                        AddNode(Node* node, Layer_t layer=LAYER_GAME);

        /**
         * Renders the content of the queue. This invalidates the queue by removing all items in the queue.
         */
        void                        Render();

        /**
         * Checks if the render queue is empty or not
         */
        bool                        IsEmpty() const;

    private:
         vector<RenderQueueItem>    items_;         /**< The items in the queue */
         vector<size_t>             itemsIndex_;    /**< This list is the list that get actually sorted. We can then use temporal coherence to have less things to sort on subsequent frames */
};

}

#endif


text:
package okeanos.control.internal.algorithms;

import java.util.LinkedList;
import java.util.List;

import javax.inject.Inject;

import okeanos.control.algorithms.ControlAlgorithm;
import okeanos.control.entities.Configuration;
import okeanos.control.entities.OptimizedRun;
import okeanos.control.entities.PossibleRun;
import okeanos.control.entities.provider.ControlEntitiesProvider;

import org.springframework.stereotype.Component;

/**
 * Represents a no operation control algorithm. That is, all proposed runs are
 * taken as optimized runs.
 *
 * @author Wolfgang Lausenhammer
 */
@Component("LoadOptimizer")
public class LoadOptimizer implements ControlAlgorithm {

	/** The control entities provider. */
	private ControlEntitiesProvider controlEntitiesProvider;

	/**
	 * Instantiates a new no operation control algorithm.
	 *
	 * @param controlEntitiesProvider
	 *            the control entities provider
	 */
	@Inject
	public LoadOptimizer(
			final ControlEntitiesProvider controlEntitiesProvider) {
		this.controlEntitiesProvider = controlEntitiesProvider;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * okeanos.control.algorithms.ControlAlgorithm#findBestConfiguration(okeanos
	 * .control.entities.Configuration)
	 */
	@Override
	public List<OptimizedRun> findBestConfiguration(
			final Configuration currentConfiguration) {
		List<PossibleRun> possibleRuns = currentConfiguration
				.getPossibleRunsConfiguration().getPossibleRuns();
		List<OptimizedRun> runsOptimized = new LinkedList<>();

		for (PossibleRun currentPossibleRun : possibleRuns) {
			OptimizedRun currentOptimizedRun = controlEntitiesProvider
					.getNewOptimizedRun();
			currentOptimizedRun.setStartTime(currentPossibleRun
					.getEarliestStartTime());
			currentOptimizedRun.setNeededSlots(currentPossibleRun
					.getNeededSlots());

			runsOptimized.add(currentOptimizedRun);
		}

		return runsOptimized;
	}
}


text:
<?xml version="1.0"?>
<document>
<properties>
<title>AJPv13</title>
<author email="danmil@shore.net">danmil@shore.net</author>
<author email="jfrederic.clere@fujitsu-siemens.com">Jean-Frederic Clere</author>
<date>$Date: 2003/10/16 07:37:56 $</date>
</properties>

The original document was written by
Dan Milstein, <author email="danmil@shore.net">danmil@shore.net</author>
on December 2000. The present document is generated out of an xml file
to allow a more easy integration in the Tomcat documentation.

This describes the Apache JServ Protocol version 1.3 (hereafter
ajp13).  There is, apparently, no current documentation of how the
protocol works.  This document is an attempt to remedy that, in order to
make life easier for maintainers of JK, and for anyone who wants to
port the protocol somewhere (into jakarta 4.x, for example).

I am not one of the designers of this protocol -- I believe that Gal
Shachor was the original designer.  Everything in this document is derived
from the actual implementation I found in the tomcat 3.x code.  I hope it
is useful, but I can't make any grand claims to perfect accuracy.  I also
don't know why certain design decisions were made.  Where I was able, I've
offered some possible justifications for certain choices, but those are
only my guesses.  In general, the C code which Shachor wrote is very clean
and comprehensible (if almost totally undocumented).  I've cleaned up the
Java code, and I think it's reasonably readable.

According to email from Gal Shachor to the jakarta-dev mailing list,
the original goals of JK (and thus ajp13) were to extend
mod_jserv and ajp12 by (I am only including the goals which
relate to communication between the web server and the servlet container):

 Increasing performance (speed, specifically).

 Adding support for SSL, so that isSecure() and
       geScheme() will function correctly within the servlet
       container.  The client certificates and cipher suite will be
       available to servlets as request attributes.

The ajp13 protocol is packet-oriented.  A binary format was
presumably chosen over the more readable plain text for reasons of
performance.  The web server communicates with the servlet container over
TCP connections.  To cut down on the expensive process of socket creation,
the web server will attempt to maintain persistent TCP connections to the
servlet container, and to reuse a connection for multiple request/response
cycles.

Once a connection is assigned to a particular request, it will not be
used for any others until the request-handling cycle has terminated.  In
other words, requests are not multiplexed over connections.  This makes
for much simpler code at either end of the connection, although it does
cause more connections to be open at once.

Once the web server has opened a connection to the servlet container,
the connection can be in one of the following states:

 Idle
 No request is being handled over this connection.

 Assigned
 The connecton is handling a specific request.

Once a connection is assigned to handle a particular request, the basic
request informaton (e.g. HTTP headers, etc) is sent over the connection in
a highly condensed form (e.g. common strings are encoded as integers).
Details of that format are below in Request Packet Structure. If there is a
body to the request (content-length > 0), that is sent in a separate
packet immediately after.

At this point, the servlet container is presumably ready to start
processing the request.  As it does so, it can send the
following messages back to the web server:

SEND_HEADERS
Send a set of headers back to the browser.

SEND_BODY_CHUNK
Send a chunk of body data back to the browser.

GET_BODY_CHUNK
Get further data from the request if it hasn't all
  been transferred yet.  This is necessary because the packets have a fixed
  maximum size and arbitrary amounts of data can be included the body of a
  request (for uploaded files, for example).  (Note: this is unrelated to
  HTTP chunked tranfer).

END_RESPONSE
 Finish the request-handling cycle.

Each message is accompanied by a differently formatted packet of data.  See
Response Packet Structures below for details.

There is a bit of an XDR heritage to this protocol, but it differs in
lots of ways (no 4 byte alignment, for example).

Byte order: I am not clear about the endian-ness of the individual
bytes.  I'm guessing the bytes are little-endian, because that's what XDR
specifies, and I'm guessing that sys/socket library is magically making
that so (on the C side).  If anyone with a better knowledge of socket calls
can step in, that would be great.

There are four data types in the protocol: bytes, booleans, integers and
strings.

Byte

A single byte.

Boolean

A single byte, 1 = true, 0 = false.  Using other non-zero values as
  true (i.e. C-style) may work in some places, but it won't in
  others.

Integer

A number in the range of 0 to 2^16 (32768).  Stored in 2 bytes with
  the high-order byte first.

String

A variable-sized string (length bounded by 2^16). Encoded with the
  length packed into two bytes first, followed by the string (including the
  terminating '\0').  Note that the encoded length does not include
  the trailing '\0' -- it is like strlen.  This is a touch
  confusing on the Java side, which is littered with odd autoincrement
  statements to skip over these terminators.  I believe the reason this was
  done was to allow the C code to be extra efficient when reading strings
  which the servlet container is sending back -- with the terminating \0
  character, the C code can pass around references into a single buffer,
  without copying.  If the \0 was missing, the C code would have to copy
  things out in order to get its notion of a string.

<subsection name="Packet Size">

According to much of the code, the max packet
size is 8 * 1024 bytes (8K).  The actual length of the packet is encoded in the
header.

</subsection>

<subsection name="Packet Headers">

Packets sent from the server to the container begin with
0x1234.  Packets sent from the container to the server begin
with AB (that's the ASCII code for A followed by the ASCII
code for B).  After those first two bytes, there is an integer (encoded as
above) with the length of the payload.  Although this might suggest that
the maximum payload could be as large as 2^16, in fact, the code sets the
maximum to be 8K.

    Packet Format (Server->Container)

    Byte
    0
    1
    2
    3
    4...(n+3)

    Contents
    0x12
    0x34
    Data Length (n)
    Data

    Packet Format (Container->Server)

    Byte
    0
    1
    2
    3
    4...(n+3)

    Contents
    A
    B
    Data Length (n)
    Data

 For most packets, the first byte of the
payload encodes the type of message.  The exception is for request body
packets sent from the server to the container -- they are sent with a
standard packet header (0x1234 and then length of the packet), but without
any prefix code after that (this seems like a mistake to me).

The web server can send the following messages to the servlet container:

    Code
    Type of Packet
    Meaning

    2
    Forward Request
    Begin the request-processing cycle with the following data

    7
    Shutdown
    The web server asks the container to shut itself down.

    8
    Ping
    The web server asks the container to take control (secure login phase).

    10
    CPing
    The web server asks the container to respond quickly with a CPong.

The servlet container can send the following types of messages to the web
server:

    Code
    Type of Packet
    Meaning

    3
    Send Body Chunk
    Send a chunk of the body from the servlet container to the web
    server (and presumably, onto the browser).

    4
    Send Headers
    Send the response headers from the servlet container to the web
    server (and presumably, onto the browser).

    5
    End Response
    Marks the end of the response (and thus the request-handling cycle).

    6
    Get Body Chunk
    Get further data from the request if it hasn't all been transferred
    yet.

    9
    CPong Reply
    The reply to a CPing request

Each of the above messages has a different internal structure, detailed below.

</subsection>

For messages from the server to the container of type "Forward Request":

<source>
AJP13_FORWARD_REQUEST :=
    prefix_code      (byte) 0x02 = JK_AJP13_FORWARD_REQUEST
    method           (byte)
    protocol         (string)
    req_uri          (string)
    remote_addr      (string)
    remote_host      (string)
    server_name      (string)
    server_port      (integer)
    is_ssl           (boolean)
    num_headers      (integer)
    request_headers *(req_header_name req_header_value)
    attributes      *(attribut_name attribute_value)
    request_terminator (byte) OxFF
</source>

The request_headers have the following structure:

<source>
req_header_name :=
    sc_req_header_name | (string)  [see below for how this is parsed]

sc_req_header_name := 0xA0xx (integer)

req_header_value := (string)
</source>

The attributes are optional and have the following structure:

<source>
attribute_name := (string)

attribute_value := (string)

</source>

Not that the all-important header is "content-length', because it
determines whether or not the container looks for another packet
immediately.

Detailed description of the elements of Forward Request.

<subsection name="request_prefix">

For all requests, this will be 2.
See above for details on other prefix codes.

</subsection>

<subsection name="method">

The HTTP method, encoded as a single byte:

Command Name	Code

OPTIONS	1

GET	2

HEAD	3

POST	4

PUT	5

DELETE	6

TRACE	7

PROPFIND	8

PROPPATCH	9

MKCOL	10

COPY	11

MOVE	12

LOCK	13

UNLOCK	14

ACL	15

REPORT	16

VERSION-CONTROL	17

CHECKIN	18

CHECKOUT	19

UNCHECKOUT	20

SEARCH	21

MKWORKSPACE	22

UPDATE	23

LABEL	24

MERGE	25

BASELINE_CONTROL	26

MKACTIVITY	27

</subsection>

<subsection  name="protocol, req_uri, remote_addr, remote_host, server_name, server_port, is_ssl">

  These are all fairly self-explanatory.  Each of these is required, and
  will be sent for every request.

</subsection>

<subsection name="Headers">

  The structure of request_headers is the following:
  First, the number of headers num_headers is encoded.
  Then, a series of header name req_header_name / value
  req_header_value pairs follows.
  Common header names are encoded as integers,
  to save space.  If the header name is not in the list of basic headers,
  it is encoded normally (as a string, with prefixed length).  The list of
  common headers sc_req_header_nameand their codes
  is as follows (all are case-sensitive):

Name	Code value	Code name

accept	0xA001	SC_REQ_ACCEPT

accept-charset	0xA002	SC_REQ_ACCEPT_CHARSET

accept-encoding	0xA003	SC_REQ_ACCEPT_ENCODING

accept-language	0xA004	SC_REQ_ACCEPT_LANGUAGE

authorization	0xA005	SC_REQ_AUTHORIZATION

connection	0xA006	SC_REQ_CONNECTION

content-type	0xA007	SC_REQ_CONTENT_TYPE

content-length	0xA008	SC_REQ_CONTENT_LENGTH

cookie	0xA009	SC_REQ_COOKIE

cookie2	0xA00A	SC_REQ_COOKIE2

host	0xA00B	SC_REQ_HOST

pragma	0xA00C	SC_REQ_PRAGMA

referer	0xA00D	SC_REQ_REFERER

user-agent	0xA00E	SC_REQ_USER_AGENT

  The Java code that reads this grabs the first two-byte integer and if
  it sees an '0xA0' in the most significant
  byte, it uses the integer in the second byte as an index into an array of
  header names.  If the first byte is not '0xA0', it assumes that the
  two-byte integer is the length of a string, which is then read in.

  This works on the assumption that no header names will have length
  greater than 0x9999 (==0xA000 - 1), which is perfectly reasonable, though
  somewhat arbitrary. (If you, like me, started to think about the cookie
  spec here, and about how long headers can get, fear not -- this limit is
  on header names not header values.  It seems unlikely that
  unmanageably huge header names will be showing up in the HTTP spec any time
  soon).

  Note: The content-length header is extremely
  important.  If it is present and non-zero, the container assumes that
  the request has a body (a POST request, for example), and immediately
  reads a separate packet off the input stream to get that body.

</subsection>

<subsection name="Optional Information">

  The list of attributes prefixed with a ?
  (e.g. ?context) are all optional.  For each, there is a
  single byte code to indicate the type of attribute, and then a string to
  give its value.  They can be sent in any order (thogh the C code always
  sends them in the order listed below).  A special terminating code is
  sent to signal the end of the list of optional attributes. The list of
  byte codes is:

Information	Code Value	Note

context	0x01	Not currently implemented

servlet_path	0x02	Not currently implemented

remote_user	0x03

auth_type	0x04

query_string	0x05

jvm_route	0x06

ssl_cert	0x07

ssl_cipher	0x08

ssl_session	0x09

req_attribute	0x0A

terminator	0xFF

  The context and servlet_path are not currently
  set by the C code, and most of the Java code completely ignores whatever
  is sent over for those fields (and some of it will actually break if a
  string is sent along after one of those codes).  I don't know if this is
  a bug or an unimplemented feature or just vestigial code, but it's
  missing from both sides of the connection.

  The remote_user and auth_type presumably refer
  to HTTP-level authentication, and communicate the remote user's username
  and the type of authentication used to establish their identity (e.g. Basic,
  Digest).  I'm not clear on why the password isn't also sent, but I don't
  know HTTP authentication inside and out.

  The query_string, ssl_cert,
  ssl_cipher, and ssl_session refer to the
  corresponding pieces of HTTP and HTTPS.

  The jvm_route, as I understand it, is used to support sticky
  sessions -- associating a user's sesson with a particular Tomcat instance
  in the presence of multiple, load-balancing servers.  I don't know the
  details.

  Beyond this list of basic attributes, any number of other attributes can
  be sent via the req_attribute code (0x0A).  A pair of strings
  to represent the attribute name and value are sent immediately after each
  instance of that code.  Environment values are passed in via this method.

  Finally, after all the attributes have been sent, the attribute terminator,
  0xFF, is sent.  This signals both the end of the list of attributes, and
  also then end of the Request Packets as a whole.

The server can also send a shutdown packet.  To ensure some
basic security, the container will only actually do the shutdown if the
request comes from the same machine on which it's hosted.

</subsection>

For messages which the container can send back to the server.

<source>
AJP13_SEND_BODY_CHUNK :=
  prefix_code   3
  chunk_length  (integer)
  chunk        *(byte)

AJP13_SEND_HEADERS :=
  prefix_code       4
  http_status_code  (integer)
  http_status_msg   (string)
  num_headers       (integer)
  response_headers *(res_header_name header_value)

res_header_name :=
    sc_res_header_name | (string)   [see below for how this is parsed]

sc_res_header_name := 0xA0 (byte)

header_value := (string)

AJP13_END_RESPONSE :=
  prefix_code       5
  reuse             (boolean)

AJP13_GET_BODY_CHUNK :=
  prefix_code       6
  requested_length  (integer)
</source>

Details:

<subsection name="Send Body Chunk">

  The chunk is basically binary data, and is sent directly back to the browser.

</subsection>

<subsection name="Send Headers">

  The status code and message are the usual HTTP things (e.g. "200" and "OK").
  The response header names are encoded the same way the request header names are.
  See above for details about how the the
  codes are distinguished from the strings.  The codes for common headers are:

Name	Code value

Content-Type	0xA001

Content-Language	0xA002

Content-Length	0xA003

Date	0xA004

Last-Modified	0xA005

Location	0xA006

Set-Cookie	0xA007

Set-Cookie2	0xA008

Servlet-Engine	0xA009

Status	0xA00A

WWW-Authenticate	0xA00B

  After the code or the string header name, the header value is immediately
  encoded.

</subsection>

<subsection name="End Response">

  Signals the end of this request-handling cycle.  If the
  reuse flag is true (==1), this TCP connection can now be used to
  handle new incoming requests.  If reuse is false (anything
  other than 1 in the actual C code), the connection should be closed.

</subsection>

<subsection name="Get Body Chunk">

  The container asks for more data from the request (If the body was
  too large to fit in the first packet sent over or when the request is
  chuncked).
  The server will send a body packet back with an amount of data which is
  the minimum of the request_length,
  the maximum send body size (8186 (8 Kbytes - 6)), and the
  number of bytes actually left to send from the request body.

  If there is no more data in the body (i.e. the servlet container is
  trying to read past the end of the body), the server will send back an
  "empty" packet, which is a body packet with a payload length of 0.
  (0x12,0x34,0x00,0x00)

</subsection>

 What happens if the request headers > max packet size?  There is no
provision to send a second packet of request headers in case there are more
than 8K (I think this is correctly handled for response headers, though I'm
not certain).  I don't know if there is a way to get more than 8K worth of
data into that initial set of request headers, but I'll bet there is
(combine long cookies with long ssl information and a lot of environment
variables, and you should hit 8K easily).  I think the connector would just
fail before trying to send any headers in this case, but I'm not certain.

 What about authentication?  There doesn't seem to be any authentication
of the connection between the web server and the container.  This strikes
me as potentially dangerous.

</document>


text:
'''\
Print month view of calendar
'''

__date__ = '2017/04/08'

import time
import calendar

localtime = time.localtime(time.time())
now = time.strftime('%Y-%m-%d %H:%M:%S', localtime)

if __name__ == '__main__':
    print(now)
    #https://docs.python.org/3/glossary.html#term-named-tuple
    print(localtime)
    #https://docs.python.org/3/library/time.html#time.struct_time
    print(calendar.month(localtime.tm_year, localtime.tm_mon))
    print('Life is short, Python more.')


text:
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.OData;
using Microsoft.WindowsAzure.Mobile.Service;
using BeerDrinkin.Service.DataObjects;
using BeerDrinkin.Service.Models;
using Microsoft.WindowsAzure.Mobile.Service.Security;

namespace BeerDrinkin.Service.Controllers
{
    [AuthorizeLevel(AuthorizationLevel.User)]
    public class ReviewItemController : TableController<ReviewItem>
    {
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            base.Initialize(controllerContext);
            BeerDrinkinContext context = new BeerDrinkinContext();
            //Enable SoftDelete to simplify offline sync
            DomainManager = new EntityDomainManager<ReviewItem>(context, Request, Services, enableSoftDelete: true);
        }

        // GET tables/ReviewItem
        public IQueryable<ReviewItem> GetAllReviewItems()
        {
            return Query();
        }

        // GET tables/ReviewItem/48D68C86-6EA6-4C25-AA33-223FC9A27959
        public SingleResult<ReviewItem> GetReviewItem(string id)
        {
            return Lookup(id);
        }

        // PATCH tables/ReviewItem/48D68C86-6EA6-4C25-AA33-223FC9A27959
        public Task<ReviewItem> PatchReviewItem(string id, Delta<ReviewItem> patch)
        {
            return UpdateAsync(id, patch);
        }

        // POST tables/ReviewItem
        public async Task<IHttpActionResult> PostReviewItem(ReviewItem item)
        {
            ReviewItem current = await InsertAsync(item);
            return CreatedAtRoute("Tables", new { id = current.Id }, current);
        }

        // DELETE tables/ReviewItem/48D68C86-6EA6-4C25-AA33-223FC9A27959
        public Task DeleteReviewItem(string id)
        {
            return DeleteAsync(id);
        }
    }
}


text:
var assert = require('assert');
var sinon  = require('sinon');
var rewire = require('rewire');

var storage = rewire("../lib/storage");
var storage_mock = {
	get: sinon.spy(),
	set: sinon.spy(),
	hset: sinon.spy(),
	hmset: sinon.spy(),
	hmget: sinon.spy(),
	hkeys: sinon.spy(),
	hdel: sinon.spy(),
	hgetall: sinon.spy(),
	exists: sinon.spy()
}

suite('storage', function(){
	setup(function(){

		storage.__set__("storageconfig", {});
		storage.__set__("log", {});
		storage.__set__("storage", storage_mock);

	});

	suite('get', function(){
		test('should call get on redis storage module', function () {
			storage.get('key', function () {});

			sinon.assert.calledOnce(storage_mock.get);
			sinon.assert.calledWith(storage_mock.get, 'key', sinon.match.func);
		});
	});

	suite('set', function(){
		test('should call set on redis storage module', function () {
			storage.set('key', 123, function () {});

			sinon.assert.calledOnce(storage_mock.set);
			sinon.assert.calledWith(storage_mock.set, 'key', 123, sinon.match.func);
		});
	});

	suite('hset', function(){
		test('should call hset on redis storage module', function () {
			storage.hset('hash', 'key', 123, function () {});

			sinon.assert.calledOnce(storage_mock.hset);
			sinon.assert.calledWith(storage_mock.hset, 'hash', 'key', 123, sinon.match.func);
		});
	});

	suite('hmset', function(){
		test('should call hmset on redis storage module', function () {
			storage.hmset('hash', {a: 123}, function () {});

			sinon.assert.calledOnce(storage_mock.hmset);
			sinon.assert.calledWith(storage_mock.hmset, 'hash', sinon.match.object, sinon.match.func);
		});
	});

	suite('hmget', function(){
		test('should call hmget on redis storage module', function () {
			storage.hmget('hash', [123], function () {});

			sinon.assert.calledOnce(storage_mock.hmget);
			sinon.assert.calledWith(storage_mock.hmget, 'hash', sinon.match.array, sinon.match.func);
		});
	});

	suite('hkeys', function(){
		test('should call hkeys on redis storage module', function () {
			storage.hkeys('hash', function () {});

			sinon.assert.calledOnce(storage_mock.hkeys);
			sinon.assert.calledWith(storage_mock.hkeys, 'hash', sinon.match.func);
		});
	});

	suite('hdel', function(){
		test('should call hdel on redis storage module', function () {
			storage.hdel('hash', ['key'], function () {});

			sinon.assert.calledOnce(storage_mock.hdel);
			sinon.assert.calledWith(storage_mock.hdel, 'hash', sinon.match.array, sinon.match.func);
		});
	});

	suite('hgetall', function(){
		test('should call hgetall on redis storage module', function () {
			storage.hgetall('hash', function () {});

			sinon.assert.calledOnce(storage_mock.hgetall);
			sinon.assert.calledWith(storage_mock.hgetall, 'hash', sinon.match.func);
		});
	});

	suite('exists', function(){
		test('should call exists on redis storage module', function () {
			storage.exists('key', function () {});

			sinon.assert.calledOnce(storage_mock.exists);
			sinon.assert.calledWith(storage_mock.exists, 'key', sinon.match.func);
		});
	});
});


text:
using System;
using System.Globalization;
using System.Text;

namespace Google.Api.Gax.Json
{
    // Note: this is internal for the moment, allowing us to commit it without exposing it until
    // we're ready. Libraries using this will temporarily use InternalsVisibleTo to access it, but that
    // will be removed before they are fully released (by which point this type must be public).

    /// <summary>
    /// Utility class for generating JSON. This class doesn't perform much in the way of validity
    /// checks - that's left as the responsibility of the caller. However, it allows values and properties
    /// to be written in a simple, chainable way, without the caller needing to worry about adding commas.
    /// </summary>
    internal sealed class JsonBuilder
    {
        /// <summary>
        /// The JSON representation of the first 160 characters of Unicode.
        /// Empty strings are replaced by the static constructor.
        /// </summary>
        private static readonly string[] CommonRepresentations = {
          // C0 (ASCII and derivatives) control characters
          "\\u0000", "\\u0001", "\\u0002", "\\u0003",  // 0x00
          "\\u0004", "\\u0005", "\\u0006", "\\u0007",
          "\\b",     "\\t",     "\\n",     "\\u000b",
          "\\f",     "\\r",     "\\u000e", "\\u000f",
          "\\u0010", "\\u0011", "\\u0012", "\\u0013",  // 0x10
          "\\u0014", "\\u0015", "\\u0016", "\\u0017",
          "\\u0018", "\\u0019", "\\u001a", "\\u001b",
          "\\u001c", "\\u001d", "\\u001e", "\\u001f",
          // Escaping of " and \ are required by www.json.org string definition.
          // Escaping of < and > are required for HTML security.
          "", "", "\\\"", "", "",        "", "",        "",  // 0x20
          "", "", "",     "", "",        "", "",        "",
          "", "", "",     "", "",        "", "",        "",  // 0x30
          "", "", "",     "", "\\u003c", "", "\\u003e", "",
          "", "", "",     "", "",        "", "",        "",  // 0x40
          "", "", "",     "", "",        "", "",        "",
          "", "", "",     "", "",        "", "",        "",  // 0x50
          "", "", "",     "", "\\\\",    "", "",        "",
          "", "", "",     "", "",        "", "",        "",  // 0x60
          "", "", "",     "", "",        "", "",        "",
          "", "", "",     "", "",        "", "",        "",  // 0x70
          "", "", "",     "", "",        "", "",        "\\u007f",
          // C1 (ISO 8859 and Unicode) extended control characters
          "\\u0080", "\\u0081", "\\u0082", "\\u0083",  // 0x80
          "\\u0084", "\\u0085", "\\u0086", "\\u0087",
          "\\u0088", "\\u0089", "\\u008a", "\\u008b",
          "\\u008c", "\\u008d", "\\u008e", "\\u008f",
          "\\u0090", "\\u0091", "\\u0092", "\\u0093",  // 0x90
          "\\u0094", "\\u0095", "\\u0096", "\\u0097",
          "\\u0098", "\\u0099", "\\u009a", "\\u009b",
          "\\u009c", "\\u009d", "\\u009e", "\\u009f"
        };

        static JsonBuilder()
        {
            for (int i = 0; i < CommonRepresentations.Length; i++)
            {
                if (CommonRepresentations[i] == "")
                {
                    CommonRepresentations[i] = ((char) i).ToString();
                }
            }
        }

        private readonly StringBuilder _builder;
        private bool _trailingComma = false;
        private int _depth = 0;

        /// <summary>
        /// Constructs a new instance using the specified <see cref="StringBuilder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="StringBuilder"/> to append to. Must not be null.</param>
        internal JsonBuilder(StringBuilder builder)
        {
            _builder = GaxPreconditions.CheckNotNull(builder, nameof(builder));
        }

        /// <summary>
        /// Constructs a new instance with a new <see cref="StringBuilder"/>.
        /// </summary>
        internal JsonBuilder() : this(new StringBuilder())
        {
        }

        /// <summary>
        /// Writes the start of an object to the builder.
        /// </summary>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder StartObject()
        {
            _builder.Append('{');
            _trailingComma = false;
            _depth++;
            return this;
        }

        /// <summary>
        /// Writes the start of an array to the builder.
        /// </summary>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder StartArray()
        {
            _builder.Append('[');
            _trailingComma = false;
            _depth++;
            return this;
        }

        /// <summary>
        /// Writes the end of an array to the builder.
        /// </summary>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder EndArray()
        {
            StripTrailingComma();
            _builder.Append(']');
            GaxPreconditions.CheckState(_depth > 0, "Attempted to end more objects than started");
            _depth--;
            MaybeAppendComma();
            return this;
        }

        /// <summary>
        /// Writes the end of an object to the builder.
        /// </summary>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder EndObject()
        {
            StripTrailingComma();
            _builder.Append('}');
            GaxPreconditions.CheckState(_depth > 0, "Attempted to end more objects than started");
            _depth--;
            MaybeAppendComma();
            return this;
        }

        /// <summary>
        /// Writes a string value to the builder, escaping it if necessary.
        /// </summary>
        /// <param name="value">The value to write. May be null.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Value(string value)
        {
            WriteString(value);
            MaybeAppendComma();
            return this;
        }

        /// <summary>
        /// Writes a Boolean value to the builder.
        /// </summary>
        /// <param name="value">The value to write.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Value(bool value)
        {
            _builder.Append(value ? "true" : "false");
            MaybeAppendComma();
            return this;
        }

        /// <summary>
        /// Writes a numeric value to the builder.
        /// </summary>
        /// <param name="value">The value to write.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Value(double value)
        {
            // TODO: We could take the protobuf approach of appending a string value instead...
            GaxPreconditions.CheckArgument(!double.IsNaN(value) && !double.IsInfinity(value), nameof(value), "Cannot format infinite/NaN values in JSON");
            _builder.Append(value.ToString("r", CultureInfo.InvariantCulture));
            MaybeAppendComma();
            return this;
        }

        /// <summary>
        /// Writes a name/value property pair to the builder for a string value.
        /// </summary>
        /// <param name="name">The name of the property. Must not be null.</param>
        /// <param name="value">The value of the property. May be null.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Property(string name, string value) => PropertyName(name).Value(value);

        /// <summary>
        /// Writes a name/value property pair to the builder for a Boolean value.
        /// </summary>
        /// <param name="name">The name of the property. Must not be null.</param>
        /// <param name="value">The value of the property.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Property(string name, bool value) => PropertyName(name).Value(value);

        /// <summary>
        /// Writes a name/value property pair to the builder for a numeric value.
        /// </summary>
        /// <param name="name">The name of the property. Must not be null.</param>
        /// <param name="value">The value of the property.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder Property(string name, double value) => PropertyName(name).Value(value);

        /// <summary>
        /// Writes a property name to the builder, so that an array or object value may then be written.
        /// </summary>
        /// <param name="name">The name of the property. Must not be null.</param>
        /// <returns>A reference to the same <see cref="JsonBuilder"/> the method was called on, for chaining.</returns>
        internal JsonBuilder PropertyName(string name)
        {
            GaxPreconditions.CheckNotNull(name, nameof(name));
            WriteString(name);
            _builder.Append(':');
            return this;
        }

        /// <summary>
        /// Returns the string representation of the underlying <see cref="StringBuilder"/>.
        /// If this builder was created with an existing StringBuilder instance, any data written earlier
        /// will be included in the result.
        /// </summary>
        /// <returns>The string representation of the builder.</returns>
        public override string ToString() => _builder.ToString();

        private void StripTrailingComma()
        {
            if (_trailingComma)
            {
                _builder.Length--;
                _trailingComma = false;
            }
        }

        private void MaybeAppendComma()
        {
            if (_depth > 0)
            {
                _builder.Append(',');
            }
            _trailingComma = true;
        }

        private void WriteString(string value)
        {
            if (value == null)
            {
                _builder.Append("null");
                return;
            }

            _builder.Append('"');

            for (int i = 0; i < value.Length; i++)
            {
                char c = value[i];
                if (c < 0xa0)
                {
                    _builder.Append(CommonRepresentations[c]);
                    continue;
                }
                if (char.IsHighSurrogate(c))
                {
                    // Encountered first part of a surrogate pair.
                    // Check that we have the whole pair, and encode both parts as hex.
                    i++;
                    if (i == value.Length || !char.IsLowSurrogate(value[i]))
                    {
                        throw new ArgumentException("String contains low surrogate not followed by high surrogate");
                    }
                    HexEncodeUtf16CodeUnit(c);
                    HexEncodeUtf16CodeUnit(value[i]);
                    continue;
                }
                else if (char.IsLowSurrogate(c))
                {
                    throw new ArgumentException("String contains high surrogate not preceded by low surrogate");
                }
                switch ((uint) c)
                {
                    // These are not required by json spec
                    // but used to prevent security bugs in javascript.
                    case 0xfeff:  // Zero width no-break space
                    case 0xfff9:  // Interlinear annotation anchor
                    case 0xfffa:  // Interlinear annotation separator
                    case 0xfffb:  // Interlinear annotation terminator

                    case 0x00ad:  // Soft-hyphen
                    case 0x06dd:  // Arabic end of ayah
                    case 0x070f:  // Syriac abbreviation mark
                    case 0x17b4:  // Khmer vowel inherent Aq
                    case 0x17b5:  // Khmer vowel inherent Aa
                        HexEncodeUtf16CodeUnit(c);
                        break;

                    default:
                        if ((c >= 0x0600 && c <= 0x0603) ||  // Arabic signs
                            (c >= 0x200b && c <= 0x200f) ||  // Zero width etc.
                            (c >= 0x2028 && c <= 0x202e) ||  // Separators etc.
                            (c >= 0x2060 && c <= 0x2064) ||  // Invisible etc.
                            (c >= 0x206a && c <= 0x206f))
                        {
                            HexEncodeUtf16CodeUnit(c);
                        }
                        else
                        {
                            // No handling of surrogates here - that's done earlier
                            _builder.Append(c);
                        }
                        break;
                }
            }
            _builder.Append('"');
        }

        private const string Hex = "0123456789abcdef";
        private void HexEncodeUtf16CodeUnit(char c)
        {
            _builder.Append("\\u");
            _builder.Append(Hex[(c >> 12) & 0xf]);
            _builder.Append(Hex[(c >> 8) & 0xf]);
            _builder.Append(Hex[(c >> 4) & 0xf]);
            _builder.Append(Hex[(c >> 0) & 0xf]);
        }
    }
}


text:
module TransactionsHelper

	def transaction_params
	  params.require(:transaction).permit(:friend_email, :amount, :description, :borrower, :private_trans)
	end

end


text:
provides a mechanism to support standalone processes

# Code Examples #

a daytime server module, run in a standalone process.

http://tengine.taobao.org/examples/ngx_proc_daytime_module

# Examples #

    processes {
        process echo {
            eho_str "hello, world";
            echo on;
            listen 8888;
            count 1;
            priority 1;
            delay_start 10s;
            respawn off;
        }

        process example {
            count 1;
            priority 0;
            delay_start 0s;
            respawn on;
        }
    }

# Directives #

## process ##

Syntax: **process** `name { }`

Default: `none`

Context: `processes`

## count ##

Syntax: **count** `num`

Default: `1`

Context: `process`

Specify the number of processes which will be forked.

## priority ##

Syntax: **priority** `num`

Default: `0`

Context: `process`

Priority is a value in the range -20 to 20. Lower priorities cause more favorable scheduling.

## delay\_start ##

Syntax: **delay\_start** `time`

Default: `300ms`

Context: `process`

The directive specifies the time to wait before process starts.

## respawn ##

Syntax: **respawn** `on | off`

Default: `on`

Context: `process`

The directive specifies whether the process will be restarted by nginx when it encounters some errors and exits.


text:
/**
 * A wrapper for assessments that call a component to determine
 * the test outcome.
 */
var EventComponent = require('EventComponent');

var ScriptOnmousemove = {
  run: function (test, options) {
    options = options || {
      selector: '[onmousemove]',
      correspondingEvent: 'onkeypress',
      searchEvent: 'onmousemove'
    };
    EventComponent(test, options);
  },

  meta: {
    testability: 1,
    title: {
      en: 'Any element with an \"onmousemove\" attribute should have a keyboard-related action as well',
      nl: 'Elk element met een \"onmousemove\"-attribuut moet een vergelijkbare actie hebben die kan worden uitgevoerd met een toetsenbord'
    },
    description: {
      en: 'If an element has an \"onmousemove\" attribute it should have a keyboard-related action as well.',
      nl: 'Als een element een \"onmousemove\"-attribuut heeft, moet het een vergelijkbare actie hebben die kan worden uitgevoerd met een toetsenbord.'
    },
    guidelines: {
      508: [
        'l'
      ],
      wcag: {
        '2.1.1': {
          techniques: [
            'G90',
            'SCR2',
            'SCR20'
          ]
        },
        '2.1.3': {
          techniques: [
            'G90',
            'SCR20'
          ]
        }
      }
    },
    tags: [
      'javascript'
    ]
  }
};
module.exports = ScriptOnmousemove;


text:
"""
Created on Fri Jun 27 10:42:40 2014

@author: Isaiah Bell
"""
import math

'''THIS WORKS: DONT TOUCH**********************************************'''

def magnitude(vec):
    vec = list(vec)
    temp = math.sqrt(sum(i**2 for i in vec))
    return temp

class Quaternion(object):

    @classmethod
    def inverse(cls,quat):
        # find the conjugate and divde by magnitude
        n = magnitude(quat)
        quat = list(quat) # cats to list so we can modify terms
        quat[0] =  quat[0]/n
        quat[1] = -quat[1]/n
        quat[2] = -quat[2]/n
        quat[3] = -quat[3]/n
        return quat

    @classmethod
    def multiply(cls,quatA,quatB):
        result =  [quatA[0]*quatB[0]-quatA[1]*quatB[1]-quatA[2]*quatB[2]-quatA[3]*quatB[3],
                   quatA[1]*quatB[0]+quatA[0]*quatB[1]-quatA[3]*quatB[2]+quatA[2]*quatB[3],
                   quatA[2]*quatB[0]+quatA[3]*quatB[1]+quatA[0]*quatB[2]-quatA[1]*quatB[3],
                   quatA[3]*quatB[0]-quatA[2]*quatB[1]+quatA[1]*quatB[2]+quatA[0]*quatB[3]]
        return result

    @classmethod
    def rotation(cls,vector,quaternion):
        # first turn vector into a quaternion if it is not already one
        if len(vector) == 3:
            vector = list(vector) #cast to list so we can insert
            vector.insert(0,0) # insert a 0 for the real part of the quaternion
        else:
            assert len(vector) == 4 # make sure vector is a quaternion
        # compose the sandwitch product
        # calculate the inverse of the quaternion
        inverse = cls.inverse(quaternion)
        # compose the left side of sandwich
        left = cls.multiply(quaternion,vector)
        # multiply the left with the inverse
        result = cls.multiply(left,inverse) #returns a list
        #remove the first value which will be zero for real rotations
        result.pop(0)
        return result

    @classmethod
    def compose_quaternion(cls,angle,axis): #angle in radians
        # make sure we are working with a three vector
        assert len(axis) == 3
        # check vector and ensure it is unit vector
        PRACTICALLY_ZERO = 0.000000001
        if 1.0 - PRACTICALLY_ZERO < magnitude(axis) < 1.0 + PRACTICALLY_ZERO:
            normed_axis = [float(x) for x in axis]
        else:
            mag = magnitude(axis)
            normed_axis = [float(x/mag) for x in axis]
        quat = [0,0,0,0]
        quat[0] = math.cos(angle/2)
        quat[1] = math.sin(angle/2)*normed_axis[0]
        quat[2] = math.sin(angle/2)*normed_axis[1]
        quat[3] = math.sin(angle/2)*normed_axis[2]
        return quat

'''END OF THIS WORKS**********************************************'''

PRACTICALLY_ZERO = 0.000000001

def check_orthagonal(vectorA,vectorB):
    assert len(vectorA) == len (vectorB)
    dot = lambda x,y: sum(x[i]*y[i] for i,v in enumerate(x))
    if abs(dot(vectorA,vectorB)) < PRACTICALLY_ZERO:
        return True # the vectors are orthagonal
    else:
        return False # the vectors are not orthagonal

def cross_product(vector_A, vector_B):
    try:
        # allow 2D and 3D vectors to be mixed
        # cross product is only defined for 2,3 and 7 dimensions
        assert 2 <= len(vector_A) <= 3,'Invalid rank: Vector_A must be 2 or 3-vector'
        assert 2 <= len(vector_B) <= 3,'Invalid rank: Vector_B must be 2 or 3-vector'
    except AssertionError as error:
        #if we get here someone passed in a bad vector
        #print error, '\n'
        return None, None
    else:
        if len(vector_A) == 2:
            vector_A = list(vector_A) # cast to list so we can modify
            vector_A.append(0) # convert to 3 vector
        if len(vector_B) == 2:
            vector_B = list(vector_B) # cast to list so we can modify
            vector_B.append(0) # convert to 3 vector
        # normalize the vectors
        # for shorter typing later we use one letter names for the normalized vectors
        A = [x/magnitude(vector_A) for x in vector_A]
        B = [x/magnitude(vector_B) for x in vector_B]
        # this works on all vectors, what we will do with it will only work with unit vectors
        cross_product = [A[1]*B[2]-A[2]*B[1],
                         A[2]*B[0]-A[0]*B[2],
                         A[0]*B[1]-A[1]*B[0]]
        angle = math.asin(magnitude(cross_product))
        return cross_product, angle

def generate_basis(n): # where n is normal vector of the body frame
    '''Calculate basis of vector space using quaternions.

    Parameters:
    ===============
            n = normal vector in coordinates of Inertial Frame,
            does not have to a unit vector (although unit vectors are prefered)
    Operation:
    ===============
        Compose the quaternion by taking the cross-product **k** x **n**
        If the angle is small < 5 degrees then we rotate our reference
        frame about the y-axis by 45 degrees using a quaternion to
        make **k'**. Then we compute **k'** x **n** and compose a second
        quaternion. \n
        Once the coordinate transformations are defined, the
        unit vectors of the body reference frame are computed and returned
        in inertial refrence frame coordinates.\n

    '''

    k = (0,0,1)
    basis = [[1,0,0],[0,1,0],[0,0,1]]

    cross, angle = cross_product(k, n)
    #the existance of axis k prime will be the flag to control which computation we do
    k_prime = None
    if abs(angle) < 0.2:
        #create another rotation quaternion
        reference_quaternion = Quaternion.compose_quaternion(math.pi/4,(0,1,0))
        k_prime =  Quaternion.rotation(n, reference_quaternion)
        #redefine cross and the angle for the final step
        cross, angle = cross_product(k_prime, n)
        final_quaternion = Quaternion.compose_quaternion(angle,cross)

    else:
        # if we did not get close than angle and cross are the first value calculated
        final_quaternion = Quaternion.compose_quaternion(angle,cross)
    # if we calculated a second axis we rotate our coordinate system by the reference quaternion first
    if k_prime:
        # redefine our basis rotated 45 degrees about y-axis
        basis = [Quaternion.rotation(i,reference_quaternion) for i in basis]
    # make the final rotation
    new_basis = [Quaternion.rotation(i,final_quaternion) for i in basis]

    return (new_basis,final_quaternion)

def decompose_vector(vector,basis):
    '''Convert vector into basis unit vectors

    Parameters:
    ==============
        vector = (x,y,z) vector in global coordinates you wish to convert
                 local coordinates
        basis = [[x1, y1, z1], [x2, y2, z3], [x3, y3, z3]] in which are
                 the **UNIT VECTORS** of the basis you are converting to.
                 These really should be unit vectors unless you are doing
                 crazy.
    '''
    dot = lambda x,y: sum(x[i]*y[i] for i,v in enumerate(x))
    components = [dot(unit_vec,vector) for unit_vec in basis]
    return components


text:
package com.blazebit.persistence.parser.util;

import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Calendar;

/**
 * @author Christian Beikov
 * @since 1.6.0
 */
public class ZonedDateTimeTypeConverter extends TypeUtils.AbstractLiteralFunctionTypeConverter<ZonedDateTime> {

    public static final TypeConverter<?> INSTANCE = new ZonedDateTimeTypeConverter();
    private static final long serialVersionUID = 1L;

    private ZonedDateTimeTypeConverter() {
        super("literal_zoned_date_time");
    }

    public ZonedDateTime convert(Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof java.util.Date) {
            java.util.Date date = (java.util.Date) value;
            return ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
        } else if (value instanceof Calendar) {
            Calendar calendar = (Calendar) value;
            return ZonedDateTime.ofInstant(calendar.toInstant(), calendar.getTimeZone().toZoneId());
        } else if (value instanceof String) {
            return ZonedDateTime.ofInstant(java.sql.Timestamp.valueOf((String) value).toInstant(), ZoneId.systemDefault());
        }
        throw unknownConversion(value, ZonedDateTime.class);
    }

    @Override
    public String toString(ZonedDateTime value) {
        value = value.withZoneSameInstant(ZoneOffset.UTC);
        return TypeUtils.jdbcTimestamp(
                value.getYear(),
                value.getMonthValue(),
                value.getDayOfMonth(),
                value.getHour(),
                value.getMinute(),
                value.getSecond(),
                value.getNano()
        );
    }

    @Override
    public void appendTo(ZonedDateTime value, StringBuilder stringBuilder) {
        value = value.withZoneSameInstant(ZoneOffset.UTC);
        TypeUtils.appendJdbcTimestamp(
                stringBuilder,
                value.getYear(),
                value.getMonthValue(),
                value.getDayOfMonth(),
                value.getHour(),
                value.getMinute(),
                value.getSecond(),
                value.getNano()
        );
    }
}


text:
layout: default
title: About
---

I'm IT Healthcare Service Developer.

Ritsumeikan University. Pharmaceutical Student.

* [Twitter](https://twitter.com/aritaku03)
* [Facebook](https://www.facebook.com/?ref=logo)


text:
css-adapter
===========

##### css adapter, to handle different adaptation of the equipment.

## Getting Started
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

    npm install css-adapter
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

	adapter:{
        options:{
            "compile":"",
            "dpi":{
                "max-width":"1200px",
                "standard":1024,
                "broad":{

                },
                "narrow":{

                }
            },
            "units":{
                "em":0.5
            },
            "others":{

            },
            "mins":{

            },
            "maxs":{

            },
            "prefixs":['-webkit-','-moz-','-ms-','-o-'],
            'adapters':{
                'attrs':['border-image','border-radius','box-shadow','background-origin','background-clip','background-size','display','box-sizing','box-pack','box-flex','transform','transform-origin','animation','transition'],
                'vals':{
                    'display':'box'
                }
            }
        },
        /*dist:{
            src:["samples/test4.css"],
            dest:"samples/test4.adapter.css"
        }*/
        /*dist:{
            files:_FILES
        }*/
        dist:{
            files:grunt.file.expandMapping(['*samples.css','!samples*.adapter.css'], '', {
                rename: function(base,file) {

                    return file.replace(/\.css/i,'.adapter.css');
                }
            })
        }
    }

	grunt.loadNpmTasks('css-adapter');

#### You can use it in combination with the grunt-contrib-watch,like this:
    watch:{
        scripts:{
            files:['samples/*.css','!samples/*.adapter.css'],
            tasks:['adapter'],
            options:{
                debounceDelay:200,
                interrupt:true
            }
        }
    }

    grunt.loadNpmTasks('grunt-contrib-watch');

##Settings
    "compile"(""|"all"|"standard"|"broad"|"narrow"):Debug and easy to view the results,
    "dpi":{//about dpi set,minimum width ,maximum width, and for the specific dpi value
        "min-width":
        "max-width":
        "standard":
        "broad":{
            "1200":{

            }
        },
        "narrow":{
            "320":{

            }
        }
    },
    "units":{//for the digit units,like px,em, and %
        "px":20,
        "em":0.5
    },
    "others":{//
        "margin-top":10
    },
    "mins":{
        "font-weight":100
    },
    "maxs":{
        "font-weight":900
    },
    "prefixs":['-webkit-','-moz-','-ms-','-o-'],
    'adapters':{
        'attrs':['border-radius'],//-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px;
        'vals':{
            'display':'box'//display:-webkit-box;display:-moz-box;display:-ms-box;display:-o-box;
        }
    }


text:
<?php

namespace CUDiM\PAGES\Plugin\Admin;
use const CUDiM\PAGES\Plugin\SLUG;

// Load admin section functions
require_once plugin_dir_path( __FILE__ ) . 'section-analytics.php';
require_once plugin_dir_path( __FILE__ ) . 'section-embedder.php';
require_once plugin_dir_path( __FILE__ ) . 'section-toolbar.php';
require_once plugin_dir_path( __FILE__ ) . 'update.php';

// Add the PAGES Plugin submenu item to the network wide Settings menu
add_action( 'network_admin_menu', __NAMESPACE__ . '\\add_admin_menu' );
// Add an action link to the settings page from plugins list
add_filter( 'network_admin_plugin_action_links_' . SLUG . '/' . SLUG . '.php', __NAMESPACE__ . '\\add_action_links' );
// Add a network admin notice action hook
add_action( 'network_admin_notices', __NAMESPACE__ . '\\add_admin_notice' );
// Add hooks for initializing settings sections
add_action( 'admin_init', __NAMESPACE__ . '\\Analytics\\init' );
add_action( 'admin_init', __NAMESPACE__ . '\\Embedder\\embedder_init' );
add_action( 'admin_init', __NAMESPACE__ . '\\Embedder\\shortcodes_init' );
add_action( 'admin_init', __NAMESPACE__ . '\\Toolbar\\init' );
// Add handler for the network wide settings form
add_action( 'network_admin_edit_pages_plugin_settings', __NAMESPACE__ . '\\update_pages_plugin_settings' );

/**
 * Register the menu item for this plugin in the WordPress admin menu.
 */
function add_admin_menu() {
	add_submenu_page(
		'settings.php',                                // Parent slug: use `settings.php` for network wide Settings submenu
		__( 'PAGES Settings', 'pages-plugin' ),        // Page title
		__( 'PAGES Settings', 'pages-plugin' ),        // Menu title
		'manage_network_options',                      // Capability
		'pages-plugin',                                // Menu slug
		__NAMESPACE__ . '\\display_plugin_admin_page'  // Callback
	);
}

/**
 * Add an action link to plugin settings from the plugins list.
 *
 * @var      array  $links  Currently registered links passed to the hook.
 * @return   array  Merged array with a settings link appended to $links.
 */
function add_action_links( $links ) {
	// Create the action link
	$new_links = [
		'settings' => sprintf( '%s',
			network_admin_url( 'settings.php?page=' . SLUG ),
			__( 'Settings', 'pages-plugin' )
		),
	];
	// Merge the link into the $links array and return it
	return array_merge( $links, $new_links );
}

/**
 * Display a network admin notice if analytics id is empty.
 */
function add_admin_notice() {
	if ( get_site_option( 'pages_analytics_tracking_enabled' ) && get_site_option( 'pages_analytics_tracking_id' ) == '' ) {
		printf( '

' . __( 'PAGES Analytics will not work properly until you provide a tracking id on the settings page.', 'pages-plugin' ) . '

',
			network_admin_url( 'settings.php?page=' . SLUG )
		);
	}
}

/**
 * Render the settings page for this plugin by including external markup.
 */
function display_plugin_admin_page() {
	require_once plugin_dir_path( __FILE__ ) . 'display.php';
}