text:
% The MIT License (MIT)
%
% Copyright (c) 2014 Frederik Vanggaard

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

clc, clear all, close all;

% Removing prwaitbar to reduce computation time
% prwaitbar off

% Surpress warnings
prwarning(0);

%open file and load in data to Idat
fid = fopen('Skin_NonSkin.txt');
Idat = textscan(fid, '%f%f%f%f','delimiter',' ');
fclose(fid);

%Seperate data from classifier.
data=[Idat{1} Idat{2} Idat{3}];

% Generate prdata
prdat = prdataset(data, Idat{4}, 'featlab',['blue ';'green';'red  '], 'lablist',['skin   ';'nonskin']);

% Generate training set and data set with a 80-20% ratio.
trainSize = round(length(data)*0.8);
[prtrain, prtest]=gendat(prdat,trainSize);

% Get a smaller sample of data from the prtest set. For some calculations
% the test set is too big and MATLAB runs out of memory.
dataSmall = datasample([data Idat{4}],1000);

% Generate small set of prdata.
prdatSmall = prdataset([dataSmall(:,1) dataSmall(:,2) dataSmall(:,3)], dataSmall(:,4), 'featlab',['blue ';'green';'red  '], 'lablist',['skin   ';'nonskin']);

%% Plot components in a scatter plot against each other.
% Computation time: 7.130323 seconds
colors = {'blue' 'green' 'red'};
figure;
for i=2:3,
    for j=1:i-1,
        if(j==1&&i==3)
            subplot(3,1,3)
        else
            subplot(3,1,j)
        end
        scatterd(prtrain(:,[i j]),'legend')
        title(sprintf('Feature %s vs. %s',colors{i},colors{j}))
        % Reverse the plot order. Plot skin on top on non-skin.
        set(gca,'Children',flipud(get(gca,'Children')));
    end
end

% Skin (blue +) is more grouped together in all three scenarios then
% nonskin (red *). Tentative analysis would suggest that blue (+) is
% skin and the red (*) is nonskin. The red (*) data is more spread out of
% some clusters seem random whereas blue (+) is grouped.

%% Correlation between components
[R, P] = corrcoef(prtrain.data);
% The P matrix shows a correlation of R by random chance.
% If p < 0.05 the correlation is significant.
% Since all values of P are less than 0.05 the values of R are
% significantly correlated.

%% Principal Component Analysis (p. 216)
classes = {'prtrain', 'prdatSmall'};
for i=1:length(classes)
    if strcmp(classes{i},'prtrain')
        [v,frac] = pcam(prtrain,0);
    elseif strcmp(classes{i},'prdatSmall')
        [v,frac] = pcam(prdatSmall,0);
    end
    figure
    plot(v)
    title(['Cumulative Eigenvalues (' classes{i} ')'])
    ylabel('Percentage of Explained Variance')
    xlabel('No of Principle Components')
end

figure
for i=1:length(classes)
% Plot the PCA scaled to the mean
    if strcmp(classes{i},'prtrain')
        w= pcam(prtrain,2);
        XR = prtrain*w;
    elseif strcmp(classes{i},'prdatSmall')
        w= pcam(prdatSmall,2);
        XR = prdatSmall*w;
    end

    subplot(2,1,i)
    scatterd(XR,'legend')
% Reverse the plot order. Plot skin on top on non-skin.
    set(gca,'Children',flipud(get(gca,'Children')));

% Plot the unit vectors of the components overlayed the PCA
    hold on;
% Unit Vectors are very small, therefor they are scaled my a factor of 50,
% so they are visible without zooming.
    factor = 50;
    for j=1:3,
        line([0 w.data.rot(j,1)*factor],[0 w.data.rot(j,2)*factor],'lineWidth',2,'color','g')
        text(w.data.rot(j,1)*factor,w.data.rot(j,2)*factor,['   '  w.data.lablist_in(j,:)])
    end
    scatter(w.data.rot(:,1)*factor,w.data.rot(:,2)*factor,'*k')
    xlabel('Component 1')
    ylabel('Component 2')
    title(['Principal Component Analysis Plot (' classes{i} ')']);
end

% Looking at the skin (blue +) it is possible to see based on the unit
% vectors that the red color channel is dominent, whereas the blue color
% channel is much less present. For the nonskin (red *) this is opposite,
% there we have green and blue and the dominent color channel and red as
% less present one.

%% Principal Component Analysis plot
varLabels={'Blue','Green','Red'};
classes = {'prtrain', 'prdatSmall'};
figure;
for i=1:length(classes)
    subplot(2,1,i);
    if strcmp(classes{i},'prtrain')
        [R, P] = corrcoef(prtrain.data);
    elseif strcmp(classes{i},'prdatSmall')
        [R, P] = corrcoef(prdatSmall.data);
    end
    R = [R R(:,end); R(end,1:end) R(end,end)];
    pcolor(R); axis xy; grid on; colorbar;
% Create place for labels showing dimension
    set(gca,'YTick',[1:length(varLabels)]+0.5,'YTickLabel',varLabels,'FontSize',12);
    set(gca,'XTick',[1:length(varLabels)]+0.5,'XTickLabel',varLabels,'FontSize',12);
    title(['Correlation Coefficients Plot (' classes{i} ')'],'fontSize',20);
end

% Both the prtrain and prdatSmall is drawn in a subplot. By looking at the
% plot and each of their R values, the correlation coefficients are
% virtually the same, even though the dataset has been reduced from 245057
% to 1000.

%% Feature Selection (201-202)
[wfs R]=featselm(prtrain,ldc([]),'forward',2);
figure;
scatterd(prtrain*wfs,'legend');
title(['forward: ' num2str(+wfs{1})]);
set(gca,'Children',flipud(get(gca,'Children')));

% Using featselm we extract the two important features from the dataset
% using the wrapper method for linear distriminant analysis and the forward
% search. The two selected features are Red and Blue. If plottet without using
% Feature Selection Red and Green would be selected.

%% Clustering (226)

for i=2:15
    tic
    [idx]=prkmeans(prdatSmall,i);
    figure;
    scatter(prdatSmall(:,3),prdatSmall(:,1),[],idx);
    title([num2str(i) ' Groups'])
    toc
end
% Plotting the training set with clusters from 2 to 15.
% Since the Feature Selection said that feature 1 (red) and feature 3
% (blue) were the most important ones, we plot them vs each other and try
% and determine 15 different clusters.

%% Gap Statistics
% Computation time: 193.713183 seconds

eva = evalclusters(prdatSmall.data,'kmeans','gap','KList',[1:15])
figure;
plot(eva)

% Evalclusters takes the training set and automatically finds out how many
% clusters are optimal from 1 to 10. This unfortunately crashes matlab
% because it runs out of memory (takes up >8GB!). So somehow we need to do
% some manual clustering.

% Edit: Since we have created a smaller dataset to work with (prdatSmall)
% we can use the evalclusters on that set. Using up to 15 clusters we try
% and see what the optimal number of clusers would be.

% Result shows that 13 clusters would be optimal on a number from 1 to 15.
% Even though MATLAB says 13 clusters is optimal, this is not the case when
% looking at the actual data. The way MATLAB determines the clusters are
% not working well with this dataset.

%% Classification
% Computation time: 160.6440 seconds.

% The big part is classification, we are going to use both parametric (ldc,
% qdc, nmc fisherc) and non-parametric (dtc, svc, parzenc, knnc)
% classifiers. Some classifiers cannot run with the original dataset
% (prdat), so they will run with the scaled down dataset (prdatSmall).

r_width=1; c_r=2;
pol_ord=2; c_p=1;

class_modes={'ldc', 'qdc', 'dtc', 'parzenc', 'fisherc', 'nmc','svc', 'knnc'};

for i=1:length(class_modes)
    tic
    A=prdat(:,[3 1]);
    subplot(3,3,i);
    if (strcmp(class_modes{i},'parzenc') ~=1 || strcmp(class_modes{i},'perlc') ~=1 || strcmp(class_modes{i},'knnc') ~=1)
        scatterd(A,'legend');
    end
    if strcmp(class_modes{i},'ldc')
% LDC(parametric): Linear method. Assumes normal densities with equal
% covariance matrices.
        plotc(A*ldc);
        [e,ce,nlab_out]= prcrossval(prtrain,ldc([]),4);
        ac(i)=1-e;
        title(['Linear Bayes Normal (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'qdc')
% QDC(parametric): Quadratic method, nonlinear boundaries. Can have
% different covariance matrices.
        plotc(A*qdc);
        [e,ce,nlab_out]= prcrossval(prtrain,qdc([]),4);
        ac(i)=1-e;
        title(['Quadratic Bayes Normal (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'dtc')
% DTC(non-parametric): Creates a decision tree and organizes a series of
% test questions and conditions to create tree structure.
        plotc(A*dtc);
        [e,ce,nlab_out]= prcrossval(prtrain,dtc([]),4);
        ac(i)=1-e;
        title(['Decision Tree (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'svc')
% SVC(non-parametric): An SVM classifies data by finding the best
% hyperplane that separates all data points of one class from those of the
% other class. The best hyperplane for an SVM means the one with the
% largest margin between the two classes. The SVM can be linear (straight
% line between the classes) or e.g. polynomial to support curved separation.
        A=prdatSmall(:,[3 1]);
        scatterd(A,'legend');
        plotc(A*svc(proxm('p',3)));
        [e,ce,nlab_out]= prcrossval(prdatSmall,svc(proxm('p',3)),4);
        ac(i)=1-e;
        title(['Support Vector Machine, polynomial kernel (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'fisherc')
% Fisherc(parametric): Equivalent to LDC. fisherc can be formulated as a
% least squares problem. Should give the same result with a binary dataset,
% but with multiple classes a difference can occur. May not find a
% separating hyperplane if classes are linearly separable
        plotc(fisherc(A));
        [e,ce,nlab_out]= prcrossval(prtrain,fisherc([]),4);
        ac(i)=1-e;
        title(['Least Square Linear Discriminant (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'udc')
% Exclude UDC because we are not sure what it actually does.
        plotc(udc(A));
        [e,ce,nlab_out]= prcrossval(prtrain,udc,4);
        ac(i)=1-e;
        title(['Uncorrelated normal based quadratic Bayes (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'nmc')
% NMC(parametric): Assigns to observations the label of the class of
% training samples whose mean is closest to the observation.
        plotc(nmc(A));
        [e,ce,nlab_out]= prcrossval(prtrain,nmc([]),4);
        ac(i)=1-e;
        title(['Nearest Mean (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'parzenc')
% Parzenc(non-parametric): given kernel function, the technique
% approximates a given training set distribution via a linear combination
% of kernels centered on the observed points
        A=prdatSmall(:,[3 1]);
        scatterd(A,'legend');
        plotc(parzenc(A,1));
        [e,ce,nlab_out]= prcrossval(prdatSmall,parzenc,4);
        ac(i)=1-e;
        title(['Parzen (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    elseif strcmp(class_modes{i},'knnc')
% KNNC(non-parametric): KNNC assumes that objects closer to each other are
% more likely to be related than objects far from each other. The way in
% which the algorithm decides which of the points from the training set
% are similar enough to be considered when choosing the class to predict
% for a new observation is to pick the k closest data points to the new
% observation, and to take the most common class among these.
        A=prdatSmall(:,[3 1]);
        scatterd(A,'legend');
        plotc(knnc(A));
        [e,ce,nlab_out]= prcrossval(prdatSmall,knnc,4);
        ac(i)=1-e;
        title(['K-Nearest Neighbor (' class_modes{i} '), Ac: ' num2str(ac(i))]);
    end
    if (strcmp(class_modes{i},'parzenc') || strcmp(class_modes{i},'svc') || strcmp(class_modes{i},'knnc'))
        C{i}=confmat(prdatSmall.nlab,nlab_out);
    else
        C{i}=confmat(prtrain.nlab,nlab_out);
    end
    toc
end


text:
var path = require('path');
var chai = require('chai');
var expect = chai.expect;
var assert = require('should');
var log = '';
var expectedLog = 'starting up...startedready up...wait for change...changed';

describe("api-chain creates a chainable api from async javascript", function() {

    var myApi;

    it("has a create method that accepts an object hash of functions", function() {

        myApi = require('../api-chain').create({
            log: function(msg, next) {
                this._log = this._log || '';
                this._log += msg;
                next();
            },
            readyUp: function(next) {
                this._log += 'ready up...';
                setTimeout(function() {
                    next();
                }, 200);

            },
            exit: function(done, next) {
                done.bind(this)(next);
            }
        });

        describe("using the created chainable api", function() {

            it("will make methods chainable", function() {
                myApi.log('starting up...')
                .set('test', 'starting up...');
            });

            it("has a set method for setting arbitrary properties", function () {
                var log = myApi._log;
                myApi.set('_log', log + 'started');
            });

            it("has a built-in wait method", function () {
                myApi.wait(200).readyUp();
            });

            it("has a built-in method for chaining dynamic async functions", function (done) {
                myApi.chain(function(next) {
                    setTimeout(function () {
                        // call next has to resolve the object
                        next();
                        // let mocha know this test is complete
                        done();
                    }, 200);
                });
            });

            it("has a built-in until method to wait until a callback returns true", function (done) {

                var x = 0;
                setTimeout(function () {
                        x = 1;
                    }, 200);

                function changed() {
                    return x !== 0;
                }
                myApi
                    .log('wait for change...')
                    .until(changed)
                    .log('changed')
                    .exit(function (resolve) {
                        expect(this._log).to.eql(expectedLog);
                        done();
                    });
            });
        });

    });
});

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>UVLogFormatter Protocol Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1333)">

				IJKMediaPlayer-static

				UCloud

Index

Hierarchy

							On This Page

							<select id="jump-to">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<optgroup label="Instance Methods">

		<option value="//api/name/didaddToLogger:">- didaddToLogger:</option>

		<option value="//api/name/didaddToLogger:inQueue:">- didaddToLogger:inQueue:</option>

		<option value="//api/name/formatLogMessage:NS_SWIFT_NAME:">- formatLogMessage:NS_SWIFT_NAME:</option>

		<option value="//api/name/willRemoveFromLogger:">- willRemoveFromLogger:</option>

	</optgroup>

</select>

UVLogFormatter Protocol Reference

	Conforms to
	NSObject

	Declared in
	UVLog.h

Overview

This protocol describes the behavior of a log formatter

– formatLogMessage:NS_SWIFT_NAME:
required method

Formatters may optionally be added to any logger.
This allows for increased flexibility in the logging environment.
For example, log messages for log files may be formatted differently than log messages for the console.

- (NSString *__nullable)formatLogMessage:(UVLogMessage *)logMessage NS_SWIFT_NAME

Discussion

For more information about formatters, see the “Custom Formatters” page:
Documentation/CustomFormatters.md

The formatter may also optionally filter the log message by returning nil,
in which case the logger will not log the message.

Declared In

UVLog.h

– didaddToLogger:

A single formatter instance can be added to multiple loggers.
These methods provides hooks to notify the formatter of when it’s added/removed.

- (void)didaddToLogger:(id<UVLogger>)logger

Discussion

This is primarily for thread-safety.
If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),
it could possibly use these hooks to switch to thread-safe versions of the code.

Declared In

UVLog.h

– didaddToLogger:inQueue:

A single formatter instance can be added to multiple loggers.

These methods provides hooks to notify the formatter of when it’s added/removed.
*

This is primarily for thread-safety.

If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.

Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),

it could possibly use these hooks to switch to thread-safe versions of the code or use dispatch_set_specific()
.* to add its own specific values.
*

- (void)didaddToLogger:(id<UVLogger>)logger inQueue:(dispatch_queue_t)queue

Declared In

UVLog.h

– willRemoveFromLogger:

See the above description for didaddToLogger:

- (void)willRemoveFromLogger:(id<UVLogger>)logger

Declared In

UVLog.h

Copyright © 2017 UCloud. All rights reserved. Updated: 2017-04-18

Generated by appledoc 2.2.1 (build 1333).


text:
package tastytest

class CurriedCtorOld[A](i: Int)(val s: String)(val a: A)


text:
package com.hardik.javase;

/*
 * This is simple java variables example.
 * Declare one variable called number.
 * Assign value 500 and print number variable.
 * Then multiply number with 2 and print variable.
 */
public class Variables {

	public static void main(String[] args) {

		int number; // Declare variable as Integer type.
		number = 500; // Assign value to variable

		System.out.println("Number Before: " + number); // Print variable

		number *= 2; // Multiply variable with 2

		System.out.println("Number After: " + number);
	}
}


text:
import './QueueFactory'

import './Commands/QueueWorkCommand'

const path = require('path')

export function QueueProvider(app, { factoryClass, queueClass, ...classes } = {}) {
	app.config.loadDefault('queue', path.join(__dirname, '../config/queue.json'))

	factoryClass = factoryClass || QueueFactory
	app.queue = new factoryClass(app, { queueClass })

	if (!app.cli.isNil) {
		app.cli.register([classes.queueWorkCommandClass || QueueWorkCommand])
	}

	if (app.queue.stateful && !app.http.isNil) {
		app.routes.group(
			{
				prefix: app.config.get('queue.stateful.route'),
				controller:
					classes.queueControllerClass ||
					require('./Controllers/QueueController').QueueController,
			},
			routes => {
				routes.get(':job', 'status')
			},
		)
	}
}

QueueProvider.shutdown = app => app.queue.destroy()
QueueProvider.priority = 60000


text:
module GoTransverseTractApi

  module Order

    class People

      #
      # @param {Hash} options
      #
      def self.find_all options={}
        params ||= GoTransverseTractApi::ApiData.new.get_query_params({}, options)
        GoTransverseTractApi.get_response_for(self, params)
      end

      #
      # @param {Long} eid
      # @param {Hash} options
      #
      def self.find_by_eid eid, options={}
        return nil unless eid.present?

        params ||= GoTransverseTractApi::ApiData.new.get_query_params({eid: eid}, options)
        GoTransverseTractApi.get_response_for(self, params)
      end

      #
      # @param {String} first_name
      # @param {Hash} options
      #
      def self.find_by_first_name first_name, options={}
        return nil unless first_name.present?

        params ||= GoTransverseTractApi::ApiData.new.get_query_params({first_name: first_name}, options)
        GoTransverseTractApi.get_response_for(self, params)
      end

      #
      # @param {String} last_name
      # @param {Hash} options
      #
      def self.find_by_last_name last_name, options={}
        return nil unless last_name.present?

        params ||= GoTransverseTractApi::ApiData.new.get_query_params({last_name: last_name}, options)
        GoTransverseTractApi.get_response_for(self, params)
      end

      #
      # @param {Long} billing_account_eid
      # @param {Hash} options
      #
      def self.find_by_billing_account_eid billing_account_eid, options={}
        return nil unless billing_account_eid.present?

        params ||= GoTransverseTractApi::ApiData.new.get_query_params({billing_account_eid: billing_account_eid}, options)
        GoTransverseTractApi.get_response_for(self, params)
      end

      #
      # @param {Long} eid
      # @param {Hash} people
      #
      def self.update eid, people
        data = {
          person: {
            eid: eid,
            name: people[:name],
            taxIdNumber: people[:tax_id_number]
          }
        }

        xml_data = GoTransverseTractApi.generateXML(data, 'person')
        GoTransverseTractApi.put_request_for(self, {eid: eid}, xml_data)
      end

    end

  end

end


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

<title>com.badlogic.gdx.math.collision Class Hierarchy (libgdx API)</title>
<meta name="date" content="2016-02-02">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

				libgdx API

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package com.badlogic.gdx.math.collision

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

com.badlogic.gdx.math.collision.BoundingBox (implements java.io.Serializable)

com.badlogic.gdx.math.collision.Ray (implements java.io.Serializable)

com.badlogic.gdx.math.collision.Segment (implements java.io.Serializable)

com.badlogic.gdx.math.collision.Sphere (implements java.io.Serializable)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

libgdx API

Prev

Next

Frames

No Frames

All Classes

				Copyright © 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)


text:
<?php
namespace Payum\Core\Tests;

use Payum\Core\Bridge\Spl\ArrayObject;
use Payum\Core\CoreGatewayFactory;
use Payum\Core\GatewayInterface;
use Payum\Core\HttpClientInterface;
use Payum\Core\Payum;
use Payum\Core\Registry\RegistryInterface;
use Payum\Core\Registry\SimpleRegistry;
use Payum\Core\Security\GenericTokenFactoryInterface;
use Payum\Core\Security\HttpRequestVerifierInterface;
use Payum\Core\Storage\StorageInterface;

trait SkipOnPhp7Trait
{
    /**
     * @before
     */
    public function skipTestsIfPhp7()
    {
        if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
            $this->markTestSkipped('Mongo is not supported by php7');
        }
    }
}


text:
 * Fixed an issue where rapid queue processing would brick the DB server.

### 0.2.6 - 2014-03-14
 * Removed the AWS library from the repo, in favour of pear.

### 0.2.5 - 2014-03-14
 * Added database connection handling, such that the database connection is closed before the tasks are reserved, abd reopened once they are. This is because there could be a large timescale between each task, and we don't want the workers to die just because we didn't have a database connection.
 * Moved the beakstalk timeout exception so that it is thrown correctly.

### 0.2.4 - 2013-09-09
 * Added support for Gearman
 * Added adapter abstract handles for queue systems that run callbacks directly

### 0.2.3 - 2013-09-08
 * Added support for Amazon SQS
 * Added a way to send a manual queue item to the backend

### 0.2.2 - 2013-09-07
 * Fixed an issue with custom queue handler instantiation
 * Fixed an issue with the queue watching with **beanstalkd**

### 0.2.1
 * Fixed a performance bug within the worker launcher

### 0.2.0
 * Rewrite to use dynamic `config.xml` specified workers and queues
 * `EcomDev_PhpUnit` test included
 * Changed to an adapter based arcitechture

### 0.1.0
 * Initial proof of concept using hardcoded workers


text:
require 'rubygems'
require 'activesupport'

$: << File.expand_path(File.dirname(__FILE__))

module FireGrabber
  autoload :Recorder, "fire_grabber/recorder"
end


text:
<?php

namespace WifiTracking\ProfileBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ProfileBundle extends Bundle
{
}


text:
package com.querydsl.core.group;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

import com.mysema.commons.lang.CloseableIterator;
import com.querydsl.core.ResultTransformer;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.FactoryExpression;
import com.querydsl.core.types.FactoryExpressionUtils;

/**
 * GroupByBuilder is a fluent builder for GroupBy transformer instances. This class is not to be used directly,
 * but via GroupBy.
 *
 * @author tiwe
 *
 * @param <K>
 */
public class GroupByBuilder<K> {

    protected final Expression<K> key;

    /**
     * Create a new GroupByBuilder for the given key expression
     *
     * @param key key for aggregating
     */
    public GroupByBuilder(Expression<K> key) {
        this.key = key;
    }

    /**
     * Get the results as a map
     *
     * @param expressions projection
     * @return new result transformer
     */
    public ResultTransformer<Map<K, Group>> as(Expression<?>... expressions) {
        return new GroupByMap<K, Group>(key, expressions);
    }

    /**
     * Get the results as a map
     *
     * @param mapFactory the map factory to use, i.e. {@code HashMap::new}.
     * @param expressions projection
     * @return new result transformer
     */
    public <RES extends Map<K, Group>> ResultTransformer<RES> as(Supplier<RES> mapFactory, Expression<?>... expressions) {
        return new GroupByGenericMap<K, Group, RES>(mapFactory, key, expressions);
    }

    /**
     * Get the results as a closeable iterator
     *
     * @param expressions projection
     * @return new result transformer
     */
    public ResultTransformer<CloseableIterator<Group>> iterate(Expression<?>... expressions) {
        return new GroupByIterate<K, Group>(key, expressions);
    }

    /**
     * Get the results as a list
     *
     * @param expressions projection
     * @return new result transformer
     */
    public ResultTransformer<List<Group>> list(Expression<?>... expressions) {
        return new GroupByList<K, Group>(key, expressions);
    }

    /**
     * Get the results as a collection.
     *
     * @param resultFactory The collection factory to use, i.e. {@code HashSet::new}.
     * @param expressions projection
     * @return new result transformer
     */
    public <RES extends Collection<Group>> ResultTransformer<RES> collection(Supplier<RES> resultFactory, Expression<?>... expressions) {
        return new GroupByGenericCollection<K, Group, RES>(resultFactory, key, expressions);
    }

    /**
     * Get the results as a map
     *
     * @param expression projection
     * @return new result transformer
     */
    @SuppressWarnings("unchecked")
    public <V> ResultTransformer<Map<K, V>> as(Expression<V> expression) {
        final Expression<V> lookup = getLookup(expression);
        return new GroupByMap<K, V>(key, expression) {
            @Override
            protected Map<K, V> transform(Map<K, Group> groups) {
                Map<K, V> results = new LinkedHashMap<K, V>((int) Math.ceil(groups.size() / 0.75), 0.75f);
                for (Map.Entry<K, Group> entry : groups.entrySet()) {
                    results.put(entry.getKey(), entry.getValue().getOne(lookup));
                }
                return results;
            }
        };
    }

    /**
     * Get the results as a map
     *
     * @param mapFactory The map factory to use, i.e. {@code HashMap::new}.
     * @param expression projection
     * @return new result transformer
     */
    public <V, RES extends Map<K, V>> ResultTransformer<RES> as(final Supplier<RES> mapFactory, Expression<V> expression) {
        final Expression<V> lookup = getLookup(expression);
        return new GroupByGenericMap<K, V, RES>(mapFactory, key, expression) {
            @Override
            protected RES transform(Map<K, Group> groups) {
                RES results = mapFactory.get();
                for (Map.Entry<K, Group> entry : groups.entrySet()) {
                    results.put(entry.getKey(), entry.getValue().getOne(lookup));
                }
                return results;
            }
        };
    }

    /**
     * Get the results as a closeable iterator
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V> ResultTransformer<CloseableIterator<V>> iterate(Expression<V> expression) {
        final Expression<V> lookup = getLookup(expression);
        return new GroupByIterate<K, V>(key, expression) {
            @Override
            protected V transform(Group group) {
                return group.getOne(lookup);
            }
        };
    }

    /**
     * Get the results as a list
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V> ResultTransformer<List<V>> list(Expression<V> expression) {
        final Expression<V> lookup = getLookup(expression);
        return new GroupByList<K, V>(key, expression) {
            @Override
            protected V transform(Group group) {
                return group.getOne(lookup);
            }
        };
    }

    /**
     * Get the results as a set
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V, RES extends Collection<V>> ResultTransformer<RES> collection(Supplier<RES> resultFactory, Expression<V> expression) {
        final Expression<V> lookup = getLookup(expression);
        return new GroupByGenericCollection<K, V, RES>(resultFactory, key, expression) {
            @Override
            protected V transform(Group group) {
                return group.getOne(lookup);
            }
        };
    }

    protected  <V> Expression<V> getLookup(Expression<V> expression) {
        if (expression instanceof GroupExpression) {
            @SuppressWarnings("unchecked") // This is the underlying type
            GroupExpression<V, ?> groupExpression = (GroupExpression<V, ?>) expression;
            return groupExpression.getExpression();
        } else {
            return expression;
        }
    }

    /**
     * Get the results as a map
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V> ResultTransformer<Map<K, V>> as(FactoryExpression<V> expression) {
        final FactoryExpression<?> transformation = FactoryExpressionUtils.wrap(expression);
        List<Expression<?>> args = transformation.getArgs();
        return new GroupByMap<K, V>(key, args.toArray(new Expression<?>[0])) {

            @Override
            protected Map<K, V> transform(Map<K, Group> groups) {
                Map<K, V> results = new LinkedHashMap<K, V>((int) Math.ceil(groups.size() / 0.75), 0.75f);
                for (Map.Entry<K, Group> entry : groups.entrySet()) {
                    results.put(entry.getKey(), transform(entry.getValue()));
                }
                return results;
            }

            @SuppressWarnings("unchecked")
            protected V transform(Group group) {
                // XXX Isn't group.toArray() suitable here?
                List<Object> args = new ArrayList<Object>(groupExpressions.size() - 1);
                for (int i = 1; i < groupExpressions.size(); i++) {
                    args.add(group.getGroup(groupExpressions.get(i)));
                }
                return (V) transformation.newInstance(args.toArray());
            }

        };
    }

    /**
     * Get the results as a closeable iterator
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V> ResultTransformer<CloseableIterator<V>> iterate(FactoryExpression<V> expression) {
        final FactoryExpression<V> transformation = FactoryExpressionUtils.wrap(expression);
        List<Expression<?>> args = transformation.getArgs();
        return new GroupByIterate<K, V>(key, args.toArray(new Expression<?>[0])) {
            @Override
            protected V transform(Group group) {
                // XXX Isn't group.toArray() suitable here?
                List<Object> args = new ArrayList<Object>(groupExpressions.size() - 1);
                for (int i = 1; i < groupExpressions.size(); i++) {
                    args.add(group.getGroup(groupExpressions.get(i)));
                }
                return transformation.newInstance(args.toArray());
            }
        };
    }

    /**
     * Get the results as a list
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V> ResultTransformer<List<V>> list(FactoryExpression<V> expression) {
        final FactoryExpression<V> transformation = FactoryExpressionUtils.wrap(expression);
        List<Expression<?>> args = transformation.getArgs();
        return new GroupByList<K, V>(key, args.toArray(new Expression<?>[0])) {
            @Override
            protected V transform(Group group) {
                // XXX Isn't group.toArray() suitable here?
                List<Object> args = new ArrayList<Object>(groupExpressions.size() - 1);
                for (int i = 1; i < groupExpressions.size(); i++) {
                    args.add(group.getGroup(groupExpressions.get(i)));
                }
                return transformation.newInstance(args.toArray());
            }
        };
    }

    /**
     * Get the results as a list
     *
     * @param expression projection
     * @return new result transformer
     */
    public <V, RES extends Collection<V>> ResultTransformer<RES> collection(Supplier<RES> resultFactory, FactoryExpression<V> expression) {
        final FactoryExpression<V> transformation = FactoryExpressionUtils.wrap(expression);
        List<Expression<?>> args = transformation.getArgs();
        return new GroupByGenericCollection<K, V, RES>(resultFactory, key, args.toArray(new Expression<?>[args.size()])) {
            @Override
            protected V transform(Group group) {
                // XXX Isn't group.toArray() suitable here?
                List<Object> args = new ArrayList<Object>(groupExpressions.size() - 1);
                for (int i = 1; i < groupExpressions.size(); i++) {
                    args.add(group.getGroup(groupExpressions.get(i)));
                }
                return transformation.newInstance(args.toArray());
            }
        };
    }

}


text:
from __future__ import print_function

import numpy
import unittest

from nearpy.experiments import RecallPrecisionExperiment
from nearpy.hashes import UniBucket, RandomDiscretizedProjections, \
    RandomBinaryProjections, PCABinaryProjections
from nearpy.filters import NearestFilter, UniqueFilter
from nearpy.distances import CosineDistance, EuclideanDistance

from nearpy import Engine

class TestRecallExperiment(unittest.TestCase):

    def setUp(self):
        numpy.random.seed(4)

    def test_experiment_with_unibucket_1(self):
        dim = 50
        vector_count = 100
        vectors = numpy.random.randn(dim, vector_count)
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest],
                        distance=EuclideanDistance())
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        # Both recall and precision must be one in this case
        self.assertEqual(result[0][0], 1.0)
        self.assertEqual(result[0][1], 1.0)

    def test_experiment_with_unibucket_2(self):
        dim = 50
        vector_count = 100
        vectors = numpy.random.randn(dim, vector_count)
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(5, vectors)
        result = exp.perform_experiment([engine])

        # In this case precision is only 0.5
        # because the engine returns 10 nearest, but
        # the experiment only looks for 5 nearest.
        self.assertEqual(result[0][0], 1.0)
        self.assertEqual(result[0][1], 0.5)

    def test_experiment_with_unibucket_3(self):
        dim = 50
        vector_count = 100
        vectors = numpy.random.randn(dim, vector_count)
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(5 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        # In this case recall is only 0.5
        # because the engine returns 5 nearest, but
        # the experiment looks for 10 nearest.
        self.assertEqual(result[0][0], 0.5)
        self.assertEqual(result[0][1], 1.0)

    def test_experiment_with_list_1(self):
        dim = 50
        vector_count = 100
        vectors = []
        for index in range(vector_count):
            vectors.append(numpy.random.randn(dim))
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        # Both recall and precision must be one in this case
        self.assertEqual(result[0][0], 1.0)
        self.assertEqual(result[0][1], 1.0)

    def test_experiment_with_list_2(self):
        dim = 50
        vector_count = 100
        vectors = []
        for index in range(vector_count):
            vectors.append(numpy.random.randn(dim))
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(5, vectors)
        result = exp.perform_experiment([engine])

        # In this case precision is only 0.5
        # because the engine returns 10 nearest, but
        # the experiment only looks for 5 nearest.
        self.assertEqual(result[0][0], 1.0)
        self.assertEqual(result[0][1], 0.5)

    def test_experiment_with_list_3(self):
        dim = 50
        vector_count = 100
        vectors = []
        for index in range(vector_count):
            vectors.append(numpy.random.randn(dim))
        unibucket = UniBucket('testHash')
        nearest = NearestFilter(5 + 1)
        engine = Engine(dim, lshashes=[unibucket],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        # In this case recall is only 0.5
        # because the engine returns 5 nearest, but
        # the experiment looks for 10 nearest.
        self.assertEqual(result[0][0], 0.5)
        self.assertEqual(result[0][1], 1.0)

    def test_random_discretized_projections(self):
        dim = 4
        vector_count = 5000
        vectors = numpy.random.randn(dim, vector_count)

        # First get recall and precision for one 1-dim random hash
        rdp = RandomDiscretizedProjections('rdp', 1, 0.01)
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[rdp],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        recall1 = result[0][0]
        precision1 = result[0][1]
        searchtime1 = result[0][2]

        print('\nRecall RDP: %f, Precision RDP: %f, SearchTime RDP: %f\n' %
              (recall1, precision1, searchtime1))

        # Then get recall and precision for one 4-dim random hash
        rdp = RandomDiscretizedProjections('rdp', 2, 0.2)
        engine = Engine(dim, lshashes=[rdp],
                        vector_filters=[nearest])
        result = exp.perform_experiment([engine])

        recall2 = result[0][0]
        precision2 = result[0][1]
        searchtime2 = result[0][2]

        print('\nRecall RDP: %f, Precision RDP: %f, SearchTime RDP: %f\n' %
              (recall2, precision2, searchtime2))

        # Many things are random here, but the precision should increase
        # with dimension
        self.assertTrue(precision2 > precision1)

    def test_random_binary_projections(self):
        dim = 4
        vector_count = 5000
        vectors = numpy.random.randn(dim, vector_count)

        # First get recall and precision for one 1-dim random hash
        rbp = RandomBinaryProjections('rbp', 32)
        nearest = NearestFilter(10 + 1)
        engine = Engine(dim, lshashes=[rbp],
                        vector_filters=[nearest])
        exp = RecallPrecisionExperiment(10, vectors)
        result = exp.perform_experiment([engine])

        recall1 = result[0][0]
        precision1 = result[0][1]
        searchtime1 = result[0][2]

        print('\nRecall RBP: %f, Precision RBP: %f, SearchTime RBP: %f\n' %
              (recall1, precision1, searchtime1))

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


text:
;(function(window, document, undefined) {
    "use strict";

    var o = {};

    window.drops = function(selector, options) {
        if(!o.support()) return;
        var el = document.querySelector(selector);

        o.options = options;
        o.when(el, "dragenter", options.dragenter);
        o.when(el, "dragover",  options.dragover);
        o.when(el, "dragexit",  options.dragexit);
        o.when(el, "dragleave", options.dragleave);
        o.when(el, "dragend",   options.dragend);

        o.when(el, "drop", options.dropped || drops.runner);
    };

    window.drops.runner = function(event, options) {
        o.options.url = options ? options.url : o.options.url;

        if(o.options.drop) o.options.drop(event);
        o.readFiles(event.dataTransfer.files, o.options, function(files) {
            o.uploadFiles(files, o.options, o.options.complete);
        });
    };

    window.drops.remove = function(selector) {
        var el = document.querySelector(selector);
        var events = [
            'dragenter',
            'dragover',
            'dragexit',
            'dragleave',
            'dragend',
            'drop'
        ];

        for (var i = 0; i < events.length; ++i) {
            if (document[events[i]]) {
                el.removeEventListener(events[i], document[events[i]], false);
            }
        }
    };

    o.support = function() {
        var xhr = new XMLHttpRequest();
        var xhr2 = !!(xhr && ("upload" in xhr) && ("onprogress" in xhr.upload));
        var fileReader = !!(window.File && window.FileList && window.FileReader);
        var formData = window.FormData !== undefined;
        return !!(document.querySelector && formData && fileReader && xhr2);
    };

    o.when = function(el, name, fn) {
        if(!el) return;
        var handler = function(event) {
            event.stopPropagation();
            event.preventDefault();
            if(fn) fn(event);
            return false;
        };

        var oldHandler = document[name];
        if(oldHandler) el.removeEventListener(name, oldHandler, false);
        document[name] = handler;

        el.removeEventListener(name, handler, false);
        el.addEventListener(name, handler, false);
    };

    o.readFiles = function(files, options, callback) {
        var complete = [], onload = function(file) {
            return function() {
                complete.push(file);
                if(complete.length === files.length) callback(complete);
            };
        };
        for(var i = 0; i < files.length; i++) {
            var reader = new FileReader();
            reader.onload = onload(files[i]);
            reader.readAsArrayBuffer(files[i]);
        }
    };

    o.uploadFiles = function(files, options, callback) {
        var n = 0, i = 0, terminator = function() {
            if(++n === files.length && callback) callback();
        };
        for(i = 0; i < files.length; i++) {
            o.uploadFile(files[i], options, terminator);
        }
    };

    o.uploadFile = function(file, options, done) {
        var formData = new FormData();
        formData.append(options.field || "file", file);
        if(options.formData) options.formData(formData, file);

        var xhr = new XMLHttpRequest();
        xhr.open(options.method || "POST", options.url || "/", true);
        xhr.upload.onprogress = o.progress(options, file);
        xhr.setRequestHeader("Accept", options.acccept || "text");
        xhr.setRequestHeader("Cache-Control", "no-cache");
        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        xhr.setRequestHeader("X-File-Name", encodeURIComponent(file.name));
        if(options.xhr) options.xhr(xhr);

        xhr.onload = function() {
            if(options.success) options.success(xhr, file);
            if(options.progress) options.progress(file, 100);
            done();
        };
        xhr.onerror = function() {
            if(options.error) options.error(xhr, file);
            done();
        };
        xhr.send(formData);
    };

    o.progress = function(options, file) {
        return function(event) {
            if(!event.lengthComputable || !options.progress) return;
            var percent = Math.max(0, Math.min(100, (event.loaded / event.total) * 100));
            options.progress(file, Math.ceil(percent));
        };
    };

}(window, document));


text:
#ifndef _RWSTD_RW_META_SIGN_H_INCLUDED
#define _RWSTD_RW_META_SIGN_H_INCLUDED

#include <rw/_defs.h>
#include <rw/_meta_other.h>
#include <rw/_meta_rel.h>
#include <rw/_meta_cv.h>
#include <rw/_static_assert.h>

_RWSTD_NAMESPACE (__rw) {

// Provides typedefs mapping non-boolean integral types to signed
// and unsigned integral types of the same base type.
template <class _TypeT>
struct __rw_sign_helper
{
    typedef void _C_Sint;
    typedef void _C_Uint;
};

template <>
struct __rw_sign_helper<char>
{
#if (_RWSTD_CHAR_MIN < 0)
    typedef          char _C_Sint;
    typedef unsigned char _C_Uint;
#else
    typedef   signed char _C_Sint;
    typedef          char _C_Uint;
#endif
};

#ifndef _RWSTD_NO_NATIVE_WCHAR_T

template <>
struct __rw_sign_helper<wchar_t>
{
#if (_RWSTD_WCHAR_MIN < 0)
    typedef wchar_t             _C_Sint;

#  if (_RWSTD_WCHAR_SIZE == _RWSTD_CHAR_SIZE)
    typedef unsigned char _C_Uint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_SHRT_SIZE)
    typedef unsigned short _C_Uint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_INT_SIZE)
    typedef unsigned int _C_Uint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LONG_SIZE)
    typedef unsigned long _C_Uint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LLONG_SIZE)
    typedef unsigned long long _C_Uint;
#  endif

#  else   // 0 <= _RWSTD_WCHAR_MIN

#  if (_RWSTD_WCHAR_SIZE == _RWSTD_CHAR_SIZE)
    typedef signed char _C_Sint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_SHRT_SIZE)
    typedef signed short _C_Sint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_INT_SIZE)
    typedef signed int _C_Sint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LONG_SIZE)
    typedef signed long _C_Sint;
#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LLONG_SIZE)
    typedef signed long long _C_Sint;
#  endif

    typedef wchar_t             _C_Uint;
#  endif   // 0 <= _RWSTD_WCHAR_MIN
};

#endif   // _RWSTD_NO_NATIVE_WCHAR_T

template <>
struct __rw_sign_helper<signed char>
{
    typedef   signed char _C_Sint;
    typedef unsigned char _C_Uint;
};

template <>
struct __rw_sign_helper<unsigned char>
{
    typedef   signed char _C_Sint;
    typedef unsigned char _C_Uint;
};

template <>
struct __rw_sign_helper<signed short>
{
    typedef   signed short _C_Sint;
    typedef unsigned short _C_Uint;
};

template <>
struct __rw_sign_helper<unsigned short>
{
    typedef   signed short _C_Sint;
    typedef unsigned short _C_Uint;
};

template <>
struct __rw_sign_helper<signed int>
{
    typedef   signed int _C_Sint;
    typedef unsigned int _C_Uint;
};

template <>
struct __rw_sign_helper<unsigned int>
{
    typedef   signed int _C_Sint;
    typedef unsigned int _C_Uint;
};

template <>
struct __rw_sign_helper<signed long>
{
    typedef   signed long _C_Sint;
    typedef unsigned long _C_Uint;
};

template <>
struct __rw_sign_helper<unsigned long>
{
    typedef   signed long _C_Sint;
    typedef unsigned long _C_Uint;
};

#ifndef _RWSTD_NO_LONG_LONG

template <>
struct __rw_sign_helper<signed long long>
{
    typedef   signed long long _C_Sint;
    typedef unsigned long long _C_Uint;
};

template <>
struct __rw_sign_helper<unsigned long long>
{
    typedef   signed long long _C_Sint;
    typedef unsigned long long _C_Uint;
};

#endif // !_RWSTD_NO_LONG_LONG

// Class template provides typedefs mapping enumeration types
// to integral types of the same size.
template <_RWSTD_SIZE_T _Size>
struct __rw_enum_helper
{
    typedef void _C_Sint;
    typedef void _C_Uint;
};

template <>
struct __rw_enum_helper<_RWSTD_CHAR_SIZE>
{
    typedef   signed char _C_Sint;
    typedef unsigned char _C_Uint;
};

template <>
struct __rw_enum_helper<_RWSTD_SHRT_SIZE>
{
    typedef   signed short _C_Sint;
    typedef unsigned short _C_Uint;
};

template <>
struct __rw_enum_helper<_RWSTD_INT_SIZE>
{
    typedef   signed int _C_Sint;
    typedef unsigned int _C_Uint;
};

#if (_RWSTD_INT_SIZE != _RWSTD_LONG_SIZE)

template <>
struct __rw_enum_helper<_RWSTD_LONG_SIZE>
{
    typedef   signed long _C_Sint;
    typedef unsigned long _C_Uint;
};

#endif // (_RWSTD_INT_SIZE != _RWSTD_LONG_SIZE)

#ifndef _RWSTD_NO_LONG_LONG
#  if (_RWSTD_LONG_SIZE != _RWSTD_LLONG_SIZE)

template <>
struct __rw_enum_helper<_RWSTD_LLONG_SIZE>
{
    typedef   signed long long _C_Sint;
    typedef unsigned long long _C_Uint;
};

#  endif // _RWSTD_LONG_SIZE != _RWSTD_LLONG_SIZE
#endif // !_RWSTD_NO_LONG_LONG

template <class _TypeT>
struct __rw_make_signed
{
private:
    //_RWSTD_STATIC_ASSERT (   __rw_is_integral<_TypeT>::value
    //                      || __rw_is_enum<_TypeT>::value);

    typedef typename __rw_remove_cv<_TypeT>::type _NoCV_TypeT;

    //_RWSTD_STATIC_ASSERT (!__rw_is_same<_NoCV_TypeT, bool>::value);

    typedef typename
    __rw_conditional<__rw_is_integral<_NoCV_TypeT>::value,
                     typename __rw_sign_helper<_NoCV_TypeT>::_C_Sint,
                     typename __rw_enum_helper< sizeof (_TypeT) >::_C_Sint
                    >::type _NoCV_TypeU;

    typedef typename
    __rw_conditional<__rw_is_const<_TypeT>::value,
                     typename __rw_add_const<_NoCV_TypeU>::type,
                     _NoCV_TypeU>::type _NoV_TypeU;

    typedef typename
    __rw_conditional<__rw_is_volatile<_TypeT>::value,
                     typename __rw_add_volatile<_NoV_TypeU>::type,
                     _NoV_TypeU>::type _TypeU;

public:
    typedef _TypeU type;
};

#define _RWSTD_MAKE_SIGNED(T) _RW::__rw_make_signed<T>::type

template <class _TypeT>
struct __rw_make_unsigned
{
private:
    //_RWSTD_STATIC_ASSERT (   __rw_is_integral<_TypeT>::value
    //                      || __rw_is_enum<_TypeT>::value);

    typedef typename __rw_remove_cv<_TypeT>::type _NoCV_TypeT;

    //_RWSTD_STATIC_ASSERT (!__rw_is_same<_NoCV_TypeT, bool>::value);

    typedef typename
    __rw_conditional<__rw_is_integral<_NoCV_TypeT>::value,
                     typename __rw_sign_helper<_NoCV_TypeT>::_C_Uint,
                     typename __rw_enum_helper< sizeof (_TypeT) >::_C_Uint
                    >::type _NoCV_TypeU;

    typedef typename
    __rw_conditional<__rw_is_const<_TypeT>::value,
                     typename __rw_add_const<_NoCV_TypeU>::type,
                     _NoCV_TypeU>::type _NoV_TypeU;

    typedef typename
    __rw_conditional<__rw_is_volatile<_TypeT>::value,
                     typename __rw_add_volatile<_NoV_TypeU>::type,
                     _NoV_TypeU>::type _TypeU;

public:
    typedef _TypeU type;
};

#define _RWSTD_MAKE_UNSIGNED(T) _RW::__rw_make_unsigned<T>::type

} // namespace __rw

#endif   // _RWSTD_RW_META_SIGN_H_INCLUDED


text:
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Runtime.Serialization;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;

namespace System.Reflection
{
    [Serializable]
    internal unsafe sealed class RuntimeEventInfo : EventInfo, ISerializable
    {
        #region Private Data Members
        private int m_token;
        private EventAttributes m_flags;
        private string m_name;
        private void* m_utf8name;
        private RuntimeTypeCache m_reflectedTypeCache;
        private RuntimeMethodInfo m_addMethod;
        private RuntimeMethodInfo m_removeMethod;
        private RuntimeMethodInfo m_raiseMethod;
        private MethodInfo[] m_otherMethod;
        private RuntimeType m_declaringType;
        private BindingFlags m_bindingFlags;
        #endregion

        #region Constructor
        internal RuntimeEventInfo()
        {
            // Used for dummy head node during population
        }
        internal RuntimeEventInfo(int tkEvent, RuntimeType declaredType, RuntimeTypeCache reflectedTypeCache, out bool isPrivate)
        {
            Contract.Requires(declaredType != null);
            Contract.Requires(reflectedTypeCache != null);
            Debug.Assert(!reflectedTypeCache.IsGlobal);

            MetadataImport scope = declaredType.GetRuntimeModule().MetadataImport;

            m_token = tkEvent;
            m_reflectedTypeCache = reflectedTypeCache;
            m_declaringType = declaredType;

            RuntimeType reflectedType = reflectedTypeCache.GetRuntimeType();

            scope.GetEventProps(tkEvent, out m_utf8name, out m_flags);

            RuntimeMethodInfo dummy;
            Associates.AssignAssociates(scope, tkEvent, declaredType, reflectedType,
                out m_addMethod, out m_removeMethod, out m_raiseMethod,
                out dummy, out dummy, out m_otherMethod, out isPrivate, out m_bindingFlags);
        }
        #endregion

        #region Internal Members
        internal override bool CacheEquals(object o)
        {
            RuntimeEventInfo m = o as RuntimeEventInfo;

            if ((object)m == null)
                return false;

            return m.m_token == m_token &&
                RuntimeTypeHandle.GetModule(m_declaringType).Equals(
                    RuntimeTypeHandle.GetModule(m.m_declaringType));
        }

        internal BindingFlags BindingFlags { get { return m_bindingFlags; } }
        #endregion

        #region Object Overrides
        public override String ToString()
        {
            if (m_addMethod == null || m_addMethod.GetParametersNoCopy().Length == 0)
                throw new InvalidOperationException(SR.InvalidOperation_NoPublicAddMethod);

            return m_addMethod.GetParametersNoCopy()[0].ParameterType.FormatTypeName() + " " + Name;
        }
        #endregion

        #region ICustomAttributeProvider
        public override Object[] GetCustomAttributes(bool inherit)
        {
            return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType);
        }

        public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
        {
            if (attributeType == null)
                throw new ArgumentNullException(nameof(attributeType));
            Contract.EndContractBlock();

            RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;

            if (attributeRuntimeType == null)
                throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

            return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
        }

        public override bool IsDefined(Type attributeType, bool inherit)
        {
            if (attributeType == null)
                throw new ArgumentNullException(nameof(attributeType));
            Contract.EndContractBlock();

            RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;

            if (attributeRuntimeType == null)
                throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));

            return CustomAttribute.IsDefined(this, attributeRuntimeType);
        }

        public override IList<CustomAttributeData> GetCustomAttributesData()
        {
            return CustomAttributeData.GetCustomAttributesInternal(this);
        }
        #endregion

        #region MemberInfo Overrides
        public override MemberTypes MemberType { get { return MemberTypes.Event; } }
        public override String Name
        {
            get
            {
                if (m_name == null)
                    m_name = new Utf8String(m_utf8name).ToString();

                return m_name;
            }
        }
        public override Type DeclaringType { get { return m_declaringType; } }
        public override Type ReflectedType
        {
            get
            {
                return ReflectedTypeInternal;
            }
        }

        private RuntimeType ReflectedTypeInternal
        {
            get
            {
                return m_reflectedTypeCache.GetRuntimeType();
            }
        }

        public override int MetadataToken { get { return m_token; } }
        public override Module Module { get { return GetRuntimeModule(); } }
        internal RuntimeModule GetRuntimeModule() { return m_declaringType.GetRuntimeModule(); }
        #endregion

        #region ISerializable
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
                throw new ArgumentNullException(nameof(info));
            Contract.EndContractBlock();

            MemberInfoSerializationHolder.GetSerializationInfo(info, this);
        }
        #endregion

        #region EventInfo Overrides
        public override MethodInfo[] GetOtherMethods(bool nonPublic)
        {
            List<MethodInfo> ret = new List<MethodInfo>();

            if ((object)m_otherMethod == null)
                return new MethodInfo[0];

            for (int i = 0; i < m_otherMethod.Length; i++)
            {
                if (Associates.IncludeAccessor((MethodInfo)m_otherMethod[i], nonPublic))
                    ret.Add(m_otherMethod[i]);
            }

            return ret.ToArray();
        }

        public override MethodInfo GetAddMethod(bool nonPublic)
        {
            if (!Associates.IncludeAccessor(m_addMethod, nonPublic))
                return null;

            return m_addMethod;
        }

        public override MethodInfo GetRemoveMethod(bool nonPublic)
        {
            if (!Associates.IncludeAccessor(m_removeMethod, nonPublic))
                return null;

            return m_removeMethod;
        }

        public override MethodInfo GetRaiseMethod(bool nonPublic)
        {
            if (!Associates.IncludeAccessor(m_raiseMethod, nonPublic))
                return null;

            return m_raiseMethod;
        }

        public override EventAttributes Attributes
        {
            get
            {
                return m_flags;
            }
        }
        #endregion
    }
}


text:
package com.itakeunconf.codecraft.service.impl;

import com.itakeunconf.codecraft.model.AuthenticatedUser;
import com.itakeunconf.codecraft.model.User;
import com.itakeunconf.codecraft.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class DefaultUserDetailService implements UserDetailsService {
    private final UserService userService;

    @Autowired
    public DefaultUserDetailService(UserService userService) {
        this.userService = userService;
    }

    @Override
    public AuthenticatedUser loadUserByUsername(String email) throws UsernameNotFoundException {
        User user = userService.getUserByEmail(email)
                .orElseThrow(() -> new UsernameNotFoundException(String.format("User with email=%s was not found", email)));
        return new AuthenticatedUser(user);
    }
}


text:
import logging
import unittest

# project
from dogstream.cassandra import parse_cassandra

logger = logging.getLogger(__name__)

class TestCassandraDogstream(unittest.TestCase):
    def testStart(self):
        events = parse_cassandra(logger, " INFO [main] 2012-12-11 21:46:26,995 StorageService.java (line 687) Bootstrap/Replace/Move completed! Now serving reads.")
        self.assertTrue(events is None)

    def testInfo(self):
        events = parse_cassandra(logger, " INFO [CompactionExecutor:35] 2012-12-02 21:15:03,738 AutoSavingCache.java (line 268) Saved KeyCache (5 items) in 3 ms")
        self.assertTrue(events is None)

    def testWarn(self):
        events = parse_cassandra(logger, " WARN [MemoryMeter:1] 2012-12-03 20:07:47,158 Memtable.java (line 197) setting live ratio to minimum of 1.0 instead of 0.9416553595658074")
        self.assertTrue(events is None)

    def testError(self):
        for line in """\
ERROR [CompactionExecutor:518] 2012-12-11 21:35:29,686 AbstractCassandraDaemon.java (line 135) Exception in thread Thread[CompactionExecutor:518,1,RMI Runtime]
java.util.concurrent.RejectedExecutionException
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768)
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:215)
        at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:397)
        at java.util.concurrent.ScheduledThreadPoolExecutor.submit(ScheduledThreadPoolExecutor.java:470)
        at org.apache.cassandra.io.sstable.SSTableDeletingTask.schedule(SSTableDeletingTask.java:67)
        at org.apache.cassandra.io.sstable.SSTableReader.releaseReference(SSTableReader.java:806)
        at org.apache.cassandra.db.DataTracker.removeOldSSTablesSize(DataTracker.java:358)
        at org.apache.cassandra.db.DataTracker.postReplace(DataTracker.java:330)
        at org.apache.cassandra.db.DataTracker.replace(DataTracker.java:324)
        at org.apache.cassandra.db.DataTracker.replaceCompactedSSTables(DataTracker.java:253)
        at org.apache.cassandra.db.ColumnFamilyStore.replaceCompactedSSTables(ColumnFamilyStore.java:992)
        at org.apache.cassandra.db.compaction.CompactionTask.execute(CompactionTask.java:200)
        at org.apache.cassandra.db.compaction.CompactionManager$1.runMayThrow(CompactionManager.java:154)
        at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:30)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)""".splitlines():
            events = parse_cassandra(logger, line)
            self.assertTrue(events is None)

    def testCompactionStart(self):
        events = parse_cassandra(logger, " INFO [CompactionExecutor:2] 2012-12-11 21:46:27,012 CompactionTask.java (line 109) Compacting [SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-11-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-9-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-12-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-10-Data.db')]")
        self.assertEquals(events, [{'alert_type': 'info', 'event_type': 'cassandra.compaction', 'timestamp': 1355262387, 'msg_title': "Compacting [SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-1", 'msg_text': "Compacting [SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-11-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-9-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-12-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-10-Data.db')]", 'auto_priority': 0}])

    def testCompactionEnd(self):
        events = parse_cassandra(logger, "INFO [CompactionExecutor:2] 2012-12-11 21:46:27,095 CompactionTask.java (line 221) Compacted to [/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-13-Data.db,].  880 to 583 (~66% of original) bytes for 4 keys at 0.007831MB/s.  Time: 71ms.")
        self.assertEquals(events, [{'alert_type': 'info', 'event_type': 'cassandra.compaction', 'timestamp': 1355262387, 'msg_title': 'Compacted to [/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-13-Data.db,].  880 ', 'msg_text': 'Compacted to [/var/lib/cassandra/data/system/LocationInfo/system-LocationInfo-he-13-Data.db,].  880 to 583 (~66% of original) bytes for 4 keys at 0.007831MB/s.  Time: 71ms.', 'auto_priority': 0}])


text:
<?php
class ControllerLocalisationWeightClass extends Controller {
	private $error = array();

	public function index() {
		$this->load->language('localisation/weight_class');

		$this->document->title = $this->language->get('heading_title');

		$this->load->model('localisation/weight_class');

		$this->getList();
	}

	public function insert() {
		$this->load->language('localisation/weight_class');

		$this->document->title = $this->language->get('heading_title');

		$this->load->model('localisation/weight_class');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
			$this->model_localisation_weight_class->addWeightClass($this->request->post);

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			$this->redirect(HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url);
		}

		$this->getForm();
	}

	public function update() {
		$this->load->language('localisation/weight_class');

		$this->document->title = $this->language->get('heading_title');

		$this->load->model('localisation/weight_class');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
			$this->model_localisation_weight_class->editWeightClass($this->request->get['weight_class_id'], $this->request->post);

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			$this->redirect(HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url);
		}

		$this->getForm();
	}

	public function delete() {
		$this->load->language('localisation/weight_class');

		$this->document->title = $this->language->get('heading_title');

		$this->load->model('localisation/weight_class');

		if (isset($this->request->post['selected']) && $this->validateDelete()) {
			foreach ($this->request->post['selected'] as $weight_class_id) {
				$this->model_localisation_weight_class->deleteWeightClass($weight_class_id);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			$this->redirect(HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url);
		}

		$this->getList();
	}

	private function getList() {
		if (isset($this->request->get['page'])) {
			$page = $this->request->get['page'];
		} else {
			$page = 1;
		}

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'title';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'ASC';
		}

		$url = '';

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

  		$this->document->breadcrumbs = array();

   		$this->document->breadcrumbs[] = array(
       		'href'      => HTTPS_SERVER . 'index.php?route=common/home&token=' . $this->session->data['token'],
       		'text'      => $this->language->get('text_home'),
      		'separator' => FALSE
   		);

   		$this->document->breadcrumbs[] = array(
       		'href'      => HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url,
       		'text'      => $this->language->get('heading_title'),
      		'separator' => ' :: '
   		);

		$this->data['insert'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class/insert&token=' . $this->session->data['token'] . $url;
		$this->data['delete'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class/delete&token=' . $this->session->data['token'] . $url;

		$this->data['weight_classes'] = array();

		$data = array(
			'sort'  => $sort,
			'order' => $order,
			'start' => ($page - 1) * $this->config->get('config_admin_limit'),
			'limit' => $this->config->get('config_admin_limit')
		);

		$weight_class_total = $this->model_localisation_weight_class->getTotalWeightClasses();

		$results = $this->model_localisation_weight_class->getWeightClasses($data);

		foreach ($results as $result) {
			$action = array();

			$action[] = array(
				'text' => $this->language->get('text_edit'),
				'href' => HTTPS_SERVER . 'index.php?route=localisation/weight_class/update&token=' . $this->session->data['token'] . '&weight_class_id=' . $result['weight_class_id'] . $url
			);

			$this->data['weight_classes'][] = array(
				'weight_class_id' => $result['weight_class_id'],
				'title'           => $result['title'] . (($result['unit'] == $this->config->get('config_weight_class')) ? $this->language->get('text_default') : NULL),
				'unit'            => $result['unit'],
				'value'           => $result['value'],
				'selected'        => isset($this->request->post['selected']) && in_array($result['weight_class_id'], $this->request->post['selected']),
				'action'          => $action
			);
		}

		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['text_no_results'] = $this->language->get('text_no_results');

		$this->data['column_title'] = $this->language->get('column_title');
		$this->data['column_unit'] = $this->language->get('column_unit');
		$this->data['column_value'] = $this->language->get('column_value');
		$this->data['column_action'] = $this->language->get('column_action');

		$this->data['button_insert'] = $this->language->get('button_insert');
		$this->data['button_delete'] = $this->language->get('button_delete');

 		if (isset($this->error['warning'])) {
			$this->data['error_warning'] = $this->error['warning'];
		} else {
			$this->data['error_warning'] = '';
		}

		if (isset($this->session->data['success'])) {
			$this->data['success'] = $this->session->data['success'];

			unset($this->session->data['success']);
		} else {
			$this->data['success'] = '';
		}

		$url = '';

		if ($order == 'ASC') {
			$url .= '&order=DESC';
		} else {
			$url .= '&order=ASC';
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$this->data['sort_title'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . '&sort=title' . $url;
		$this->data['sort_unit'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . '&sort=unit' . $url;
		$this->data['sort_value'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . '&sort=value' . $url;

		$url = '';

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

		$pagination = new Pagination();
		$pagination->total = $weight_class_total;
		$pagination->page = $page;
		$pagination->limit = $this->config->get('config_admin_limit');
		$pagination->text = $this->language->get('text_pagination');
		$pagination->url = HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url . '&page={page}';

		$this->data['pagination'] = $pagination->render();

		$this->data['sort'] = $sort;
		$this->data['order'] = $order;

		$this->template = 'localisation/weight_class_list.tpl';
		$this->children = array(
			'common/header',
			'common/footer'
		);

		$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
	}

	private function getForm() {
		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['entry_title'] = $this->language->get('entry_title');
		$this->data['entry_unit'] = $this->language->get('entry_unit');
		$this->data['entry_value'] = $this->language->get('entry_value');

		$this->data['button_save'] = $this->language->get('button_save');
		$this->data['button_cancel'] = $this->language->get('button_cancel');

		$this->data['tab_general'] = $this->language->get('tab_general');

 		if (isset($this->error['warning'])) {
			$this->data['error_warning'] = $this->error['warning'];
		} else {
			$this->data['error_warning'] = '';
		}

 		if (isset($this->error['title'])) {
			$this->data['error_title'] = $this->error['title'];
		} else {
			$this->data['error_title'] = '';
		}

 		if (isset($this->error['unit'])) {
			$this->data['error_unit'] = $this->error['unit'];
		} else {
			$this->data['error_unit'] = '';
		}

		$url = '';

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

  		$this->document->breadcrumbs = array();

   		$this->document->breadcrumbs[] = array(
       		'href'      => HTTPS_SERVER . 'index.php?route=common/home&token=' . $this->session->data['token'],
       		'text'      => $this->language->get('text_home'),
      		'separator' => FALSE
   		);

   		$this->document->breadcrumbs[] = array(
       		'href'      => HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url,
       		'text'      => $this->language->get('heading_title'),
      		'separator' => ' :: '
   		);

		if (!isset($this->request->get['weight_class_id'])) {
			$this->data['action'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class/insert&token=' . $this->session->data['token'] . $url;
		} else {
			$this->data['action'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class/update&token=' . $this->session->data['token'] . '&weight_class_id=' . $this->request->get['weight_class_id'] . $url;
		}

		$this->data['cancel'] = HTTPS_SERVER . 'index.php?route=localisation/weight_class&token=' . $this->session->data['token'] . $url;

		if (isset($this->request->get['weight_class_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
      		$weight_class_info = $this->model_localisation_weight_class->getWeightClass($this->request->get['weight_class_id']);
    	}

		$this->load->model('localisation/language');

		$this->data['languages'] = $this->model_localisation_language->getLanguages();

		if (isset($this->request->post['weight_class_description'])) {
			$this->data['weight_class_description'] = $this->request->post['weight_class'];
		} elseif (isset($this->request->get['weight_class_id'])) {
			$this->data['weight_class_description'] = $this->model_localisation_weight_class->getWeightClassDescriptions($this->request->get['weight_class_id']);
		} else {
			$this->data['weight_class_description'] = array();
		}

		if (isset($this->request->post['value'])) {
			$this->data['value'] = $this->request->post['value'];
		} elseif (isset($weight_class_info)) {
			$this->data['value'] = $weight_class_info['value'];
		} else {
			$this->data['value'] = '';
		}

		$this->template = 'localisation/weight_class_form.tpl';
		$this->children = array(
			'common/header',
			'common/footer'
		);

		$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
	}

	private function validateForm() {
		if (!$this->user->hasPermission('modify', 'localisation/weight_class')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		foreach ($this->request->post['weight_class_description'] as $language_id => $value) {
			if ((strlen(utf8_decode($value['title'])) < 3) || (strlen(utf8_decode($value['title'])) > 32)) {
				$this->error['title'][$language_id] = $this->language->get('error_title');
			}

			if ((!$value['unit']) || (strlen(utf8_decode($value['unit'])) > 4)) {
				$this->error['unit'][$language_id] = $this->language->get('error_unit');
			}
		}

		if (!$this->error) {
			return TRUE;
		} else {
			return FALSE;
		}
	}

	private function validateDelete() {
		if (!$this->user->hasPermission('modify', 'localisation/weight_class')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		$this->load->model('catalog/product');

		foreach ($this->request->post['selected'] as $weight_class_id) {
			$weight_class_info = $this->model_localisation_weight_class->getWeightClass($weight_class_id);

			if ($weight_class_info && ($this->config->get('config_weight_class') == $weight_class_info['unit'])) {
				$this->error['warning'] = $this->language->get('error_default');
			}

			$product_total = $this->model_catalog_product->getTotalProductsByWeightClassId($weight_class_id);

			if ($product_total) {
				$this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);
			}
		}

		if (!$this->error) {
			return TRUE;
		} else {
			return FALSE;
		}
	}
}
?>


text:
module Cartodb
  def self.get_config(*config_chain)
    current = Cartodb.config
    config_chain.each { |config_param|
      current = current[config_param]
      if current.nil?
        break
      end
    }
    current
  end

  def self.config
    return @config if @config

    begin
    config_file_hash = YAML.load_file("#{Rails.root}/config/app_config.yml")
    rescue => e
      raise "Missing or inaccessible config/app_config.yml: #{e.message}"
    end
    @config ||= config_file_hash[Rails.env].try(:to_options!)

    if @config.blank?
      raise "Can't find App configuration for #{Rails.env} environment on config/app_config.yml"
    end

    # Check if we have all the important keys on config/app_config.yml
    raise "Missing mandatory_keys key on config/app_config.yml" unless @config[:mandatory_keys].present?
    unless(@config[:mandatory_keys].map(&:to_sym) - @config.keys).blank?
      raise "Missing the following config keys on config/app_config.yml: #{(@config[:mandatory_keys].map(&:to_sym) - @config.keys).join(', ')}"
    end
    ActionDispatch::Http::URL.tld_length = @config[:session_domain].split('.').delete_if {|i| i.empty? }.length - 1

    if !@config[:mailer].nil?
      # AuthSMTP
      CartoDB::Application.config.action_mailer.delivery_method = :smtp
      CartoDB::Application.config.action_mailer.smtp_settings = {
        :address              => Cartodb.config[:mailer]['address'],
        :port                 => Cartodb.config[:mailer]['port'],
        :user_name            => Cartodb.config[:mailer]['user_name'],
        :password             => Cartodb.config[:mailer]['password'],
        :authentication       => Cartodb.config[:mailer]['authentication'],
        :enable_starttls_auto => Cartodb.config[:mailer]['enable_starttls_auto'] }
    end

    if !@config[:basemaps].present? || @config[:basemaps].count == 0
      raise "Missing basemaps configuration, there should be at least one basemap"
    end
  end

  def self.error_codes
    return @error_codes if @error_codes
    file_hash = YAML.load_file("#{Rails.root}/config/error_codes.yml")
    @error_codes ||= file_hash["cartodb_errors"].try(:to_options!)
  end

  def self.asset_path
    return @asset_path if @asset_path
    if Cartodb.config[:app_assets]
      @asset_path = Cartodb.config[:app_assets]['asset_host']
    else
      @asset_path = nil
    end
  end

  # Execute a block with overriden configuration parameters
  # (useful for tests)
  #
  # Example:
  #
  #     Cartodb.with_config http_port: 8080 do
  #        # here Cartodb.get_config(:http_port) is 80
  #     end
  #     # herer Cartodb.get_config(:http_port) has its original value
  #
  # Note that since inner keys are strings (not symbols), you must
  # follow the same conventtion and use:
  #
  #     Cartodb.with_config(ogr2ogr: { 'binary' => 'ogr2ogr2' })
  #
  # and not:
  #
  #     Cartodb.with_config(ogr2ogr: { 'binary': 'ogr2ogr2' })
  #
  def self.with_config(options)
    original_config = config
    @config = original_config.merge(options)
    return_value = yield
    @config = original_config
    return_value
  end
end


text:
namespace Builder.Builders
{
    /// <summary>
    /// The 'ConcreteBuilder' class
    /// </summary>
    public class CarBuilder : VehicleBuilder
    {
        public CarBuilder()
        {
            this.Vehicle = new Vehicle("Car");
        }

        public override void BuildFrame()
        {
            this.Vehicle["frame"] = "Car Frame";
        }

        public override void BuildEngine()
        {
            this.Vehicle["engine"] = "2500 cc";
        }

        public override void BuildWheels()
        {
            this.Vehicle["wheels"] = "4";
        }

        public override void BuildDoors()
        {
            this.Vehicle["doors"] = "4";
        }
    }
}


text:
<?php

namespace MGS\FormBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class FichariesgohogarType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $constructYear = null;
        for ($i = date("Y"); $i >= date("Y")-100; $i--) {
            $constructYear[$i."-01-01"] = $i;
        }

        $builder
            ->add('idPadre', new FichapadreType())
            ->add('clausulahipoteca', 'text', array("required" => false))
            ->add('numprestamo', 'text', array("required" => false))
            ->add('direccion')
            ->add('descripcionriesgo')
            ->add('fechaconstruc', 'choice', array( 'choices' => $constructYear, 'empty_value' => '', 'required' => false))
            ->add('fechareformelect', 'choice', array( 'choices' => $constructYear, 'empty_value' => '', 'required' => false))
            ->add('fechareformtube', 'choice', array( 'choices' => $constructYear, 'empty_value' => '', 'required' => false))
            ->add('superparcela')
            ->add('superconstruida')
            ->add('supergaraje')
            ->add('supertrastero')
            ->add('superotras')
            ->add('tipologia', 'choice', array(
                'choices'   => array('Bajo' => 'Bajo', 'Intermedio' => 'Intermedio', 'Ultimo' => 'Ultimo', 'Atico' => 'Atico', 'Unifamiliar' => 'Unifamiliar', 'Adosado' => 'Adosado', 'Pareado' => 'Pareado')))
            ->add('uso', 'choice', array(
                'choices'   => array('Habitual' => 'Habitual', 'Secundaria' => 'Secundaria', 'Alquiler habitual' => 'Alquiler habitual', 'Alquiler temporal' => 'Alquiler temporal', 'Alquilada' => 'Alquilada')))
            ->add('situacion', 'choice', array(
                'choices'   => array('Despoblado' => 'Despoblado', 'Poblacion' => 'Poblacion', 'Urbano' => 'Urbano', 'Otros' => 'Otros')))
            ->add('murosperimetrales')
            ->add('otrasdependencias')
            ->add('cubierta', 'choice', array(
                'choices'   => array('Cubierta' => 'Cubierta', 'Tejas' => 'Tejas', 'Mixta' => 'Mixta', 'Madera' => 'Madera')))
            ->add('aguagalvanizado', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('aguacobre', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('aguapepb', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimfibrocemento', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimplomo', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimpvc', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimpozo', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimfosa', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('elimalcantarillado', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('cuadroelectrico', 'choice', array(
                'choices'   => array('NO' => 'NO', 'BUENO' => 'BUENO', 'REGULAR' => 'REGULAR', 'MALO' => 'MALO')))
            ->add('obscaracteristicas')
            ->add('continente', 'choice', array(
                'choices'   => array('V. Total' => 'V. Total', 'V. Parcial' => 'V. Parcial', '1er Riesgo' => '1er Riesgo')))
            ->add('valoredificacion')
            ->add('valorgaraje')
            ->add('valortrastero')
            ->add('valorotrasinst')
            ->add('valormuros')
            ->add('valorjardines')
            ->add('valorpergolas')
            ->add('valorbarbacoas')
            ->add('valorpajarera')
            ->add('valorpiscina')
            ->add('valorobrasref')
            ->add('numplacassol')
            ->add('valorplacassol')
            ->add('valorcalefaccion')
            ->add('valorcalefaccionrad')
            ->add('valorcaldera')
            ->add('valoraireacon')
            ->add('valorsplitbc')
            ->add('valorotros')
            ->add('obscontinente')
            ->add('valormobiliario')
            ->add('valorelectrodomesticos')
            ->add('valorcocina')
            ->add('valormobiliarioprof')
            ->add('valorimagensonido')
            ->add('valormaquinariapisicna')
            ->add('valorbombasfiltros')
            ->add('valorequipoelectronico')
            ->add('valorequipoelectronicoprof')
            ->add('valorjoyasdentrocaja')
            ->add('valorjoyasfueracaja')
            ->add('valordinerodentrocaja')
            ->add('valordinerofueracaja')
            ->add('valoralfombrastapices')
            ->add('valorarte')
            ->add('obscontenido')
            ->add('arte', 'collection', array(
                'type' => new ArteType(),
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => false,
                'prototype' => true
            ))
            ->add('animales', 'collection', array(
                'type' => new AnimalesType(),
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => false,
                'prototype' => true
            ))
            ->add('proteccionrobo', new ProteccionroboType())
            ->add('Enviar', 'submit')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'MGS\FormBundle\Entity\Fichariesgohogar'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'mgs_formbundle_fichariesgohogar';
    }
}


text:
package me.anchore.io;

import me.anchore.io.reader.IntReader;
import me.anchore.io.writer.IntWriter;

/**
 * @author anchore
 * @date 2018/7/21
 */
public interface IntIo extends IntWriter, IntReader {
}


text:
@implementation FBMessageSetting

@end


text:
**Note:** Greenplum Database does not support the PostgreSQL [large object facility](https://www.postgresql.org/docs/9.4/largeobjects.html) for streaming user data that is stored in large-object structures.

The `pg_largeobject` system catalog table holds the data making up 'large objects'. A large object is identified by an OID assigned when it is created. Each large object is broken into segments or 'pages' small enough to be conveniently stored as rows in `pg_largeobject`. The amount of data per page is defined to be `LOBLKSIZE` \(which is currently `BLCKSZ`/4, or typically 8K\).

Each row of `pg_largeobject` holds data for one page of a large object, beginning at byte offset \(*pageno*`* LOBLKSIZE`\) within the object. The implementation allows sparse storage: pages may be missing, and may be shorter than `LOBLKSIZE` bytes even if they are not the last page of the object. Missing regions within a large object read as zeroes.

|column|type|references|description|
|------|----|----------|-----------|
|`loid`|oid| |Identifier of the large object that includes this page.|
|`pageno`|int4| |Page number of this page within its large object \(counting from zero\).|
|`data`|bytea| |Actual data stored in the large object. This will never be more than `LOBLKSIZE` bytes and may be less.|

**Parent topic:** [System Catalogs Definitions](../system_catalogs/catalog_ref-html.html)


text:
/* global fluid, jqUnit */

(function ($) {
    "use strict";

    $(document).ready(function () {

        jqUnit.module("ModuleLayout Tests");

        function isOriginalOrderTest(testStr, layoutObj) {
            var portlet = fluid.transform(fluid.testUtils.moduleLayout.portletIds, fluid.byId);
            jqUnit.assertEquals(testStr + ", Portlet1 should be 1st in column 1", portlet[1], layoutObj.columns[0].elements[0]);
            jqUnit.assertEquals(testStr + ", Portlet2 should be 2nd in column 1", portlet[2], layoutObj.columns[0].elements[1]);
            jqUnit.assertEquals(testStr + ", Portlet3 should be 3rd in column 1", portlet[3], layoutObj.columns[0].elements[2]);
            jqUnit.assertEquals(testStr + ", Portlet4 should be 4th in column 1", portlet[4], layoutObj.columns[0].elements[3]);
            jqUnit.assertEquals(testStr + ", Portlet5 should be 1st in column 2", portlet[5], layoutObj.columns[1].elements[0]);
            jqUnit.assertEquals(testStr + ", Portlet6 should be 2nd in column 2", portlet[6], layoutObj.columns[1].elements[1]);
            jqUnit.assertEquals(testStr + ", Portlet7 should be 1st in column 3", portlet[7], layoutObj.columns[2].elements[0]);
            jqUnit.assertEquals(testStr + ", Portlet8 should be 2nd in column 3", portlet[8], layoutObj.columns[2].elements[1]);
            jqUnit.assertEquals(testStr + ", Portlet9 should be 3rd in column 3", portlet[9], layoutObj.columns[2].elements[2]);

        }

        jqUnit.test("UpdateLayout", function () {
            var portlet = fluid.transform(fluid.testUtils.moduleLayout.portletIds, fluid.byId);

            var item = portlet[3];
            var relatedItem = portlet[6];
            var layout = fluid.moduleLayout.layoutFromIds(fluid.testUtils.moduleLayout.fullLayout);
            var layoutClone = jQuery.extend(true, {}, layout);

            isOriginalOrderTest("Before doing anything", layoutClone);

            // Move before
            fluid.moduleLayout.updateLayout(item, relatedItem, fluid.position.BEFORE, layoutClone);
            jqUnit.assertEquals("After move, Portlet 3 should be before Portlet 6", portlet[3], layoutClone.columns[1].elements[1]);
            jqUnit.assertEquals("After move, Portlet 6 should be third in the column", portlet[6], layoutClone.columns[1].elements[2]);
            jqUnit.assertEquals("After move, Portlet 3 should not be in column 1", -1, jQuery.inArray(portlet[3], layoutClone.columns[0]));

            // Move after
            relatedItem = portlet[8];
            fluid.moduleLayout.updateLayout(item, relatedItem, fluid.position.AFTER, layoutClone);
            jqUnit.assertEquals("After move, Portlet 3 should be after Portlet 8", portlet[3], layoutClone.columns[2].elements[2]);
            jqUnit.assertEquals("After move, Portlet 8 should be second in the column", portlet[8], layoutClone.columns[2].elements[1]);
            jqUnit.assertEquals("After move, Portlet 3 should not be in column 2", -1, jQuery.inArray(portlet[3], layoutClone.columns[1]));

            // Move within same column
            relatedItem = portlet[7];
            fluid.moduleLayout.updateLayout(item, relatedItem, fluid.position.BEFORE, layoutClone);
            jqUnit.assertEquals("After move, Portlet 3 should be before Portlet 7", portlet[3], layoutClone.columns[2].elements[0]);
            jqUnit.assertEquals("After move, Portlet 7 should be second in the column", portlet[7], layoutClone.columns[2].elements[1]);

        });

    });
})(jQuery);


text:
Password Security

		<form class="form-horizontal" name ="passwordform">

				Old Password:

					<input id="oldpassword" name="oldpassword" ng-model="user.oldpassword" type="password" class="form-control" placeholder="*****" required/>

                      用户名是必须的。

				New Password:

					<input id="password" name="password" ng-model="user.password" type="password" class="form-control" placeholder="******" required/>

                      密码是必须的。

					<input type="submit" value="Reset" class="btn btn-primary" ng-click="reset()"/>

		</form>

If you do not have a account, you can not edit newsentry. firstly, we will user username, then, we will adopt email as login name


text:
'use strict';

module.exports = {
  up: function(queryInterface, Sequelize) {
    return queryInterface
      .changeColumn('Tiers', 'EventId', {
        type: Sequelize.INTEGER,
        references: {
          model: 'Events',
          key: 'id',
        },
        onDelete: 'SET NULL',
        onUpdate: 'CASCADE',
        allowNull: true,
      })
      .then(() =>
        queryInterface.addColumn('Tiers', 'slug', {
          type: Sequelize.STRING,
        }),
      );
  },

  down: function(queryInterface, Sequelize) {
    return queryInterface
      .changeColumn('Tiers', 'EventId', {
        type: Sequelize.INTEGER,
        references: {
          model: 'Events',
          key: 'id',
        },
        onDelete: 'SET NULL',
        onUpdate: 'CASCADE',
        allowNull: false,
      })
      .then(() => queryInterface.removeColumn('Tiers', 'slug'));
  },
};