text:
var assert = require('chai').assert;
var osdf_utils = require('osdf_utils');
var schema_utils = require('schema_utils');
var tutils = require('./lib/test_utils.js');
var waterfall = require('async/waterfall');

var test_ns = 'test';

// Get a set of valid and invalid credentials for our tests
var auth = tutils.get_test_auth();
var bad_auth = tutils.get_invalid_auth();

var test_aux_schema = {
    description: 'A test aux schema.',
    type: 'object',
    properties: {
        prop: {
            title: 'A bit of text.',
            type: 'string'
        }
    },
    additionalProperties: false,
    required: [ 'prop' ]
};

describe('aux-schema-insert', function() {
    // Test basic insertion of an auxiliary schema. The approach is to attempt
    // the insertion, then retrieve it to check that it's there, then clean up
    // by deleting it.
    it('insert_aux_schema', function(done) {
        var aux_schema_name = osdf_utils.random_string(8);

        waterfall([
            function(callback) {
                // First we insert an auxiliary schema
                var aux_schema_doc = {
                    name: aux_schema_name,
                    schema: test_aux_schema
                };

                tutils.insert_aux_schema(test_ns, aux_schema_doc, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 201,
                    'Correct status for auxiliary schema insertion.');

                assert.strictEqual(data, '',
                    'No content returned on a schema insertion.');

                // then try to retrieve it
                tutils.retrieve_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 200,
                    'Auxiliary schema retrieval yielded correct status code.');

                assert.isOk(data.length > 0,
                    'Data returned on aux schema retrieval.');

                // Get all the auxiliary schemas for the namespace and see if the
                // one we just inserted is there
                tutils.retrieve_all_aux_schemas(test_ns, auth, function(err, resp) {
                    if (err) {
                        callback(err, null);
                    } else {
                        callback(null, resp);
                    }
                });
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 200,
                    'Retrieval of all auxiliary schemas yielded correct ' +
                    'status code.');

                assert.isOk(data.length > 0,
                    'Data returned on aux schema collection retrieval.');

                var aux_schemas = JSON.parse(data);

                assert.isOk(aux_schemas.hasOwnProperty(aux_schema_name),
                    "Namespace's auxiliary schema listing includes test " +
                    'aux schema.');

                // Perform cleanup by deleting the auxiliary schema we attempted to
                // insert. It should not have been inserted, but delete it anyway
                // just in case the implementation failed to reject it.
                tutils.delete_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        // ignored
                    }
                );

                callback(null);
            }],
        function(err, results) {
            if (err) {
                done(err);
            } else {
                done();
            }
        });
    });

    // Test that the service does not allow invalid data or invalid JSON from
    // being registered as a schema.
    it('insert_aux_schema_with_malformed_json', function(done) {
        var aux_schema_name = osdf_utils.random_string(8);

        waterfall([
            function(callback) {
                /*eslint no-useless-escape: 0*/
                var bad_data = '\\\\\/////';

                // First we insert a schema
                var aux_schema_doc = {
                    name: aux_schema_name,
                    schema: bad_data
                };

                tutils.insert_aux_schema(test_ns, aux_schema_doc, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 422,
                    'Correct status for auxiliary schema insertion.');

                assert.equal(data, 0, 'No content returned on an auxiliary ' +
                    'schema insertion.');

                // then try to retrieve it
                tutils.retrieve_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 404,
                    'Auxiliary schema retrieval yielded correct status code.');

                assert.strictEqual(data, '',
                    'No data returned on auxiliary schema retrieval.');

                // If for whatever reason, the auxiliary schema actually made it
                // into the server we try to remove it so that the test doesn't
                // leave a residue behind.
                if (response.statusCode !== 404) {
                    // Cleanup. Remove the auxiliary schema that we inserted.
                    tutils.delete_aux_schema(test_ns, aux_schema_name, auth,
                        function(err, resp) {
                            // ignored
                        }
                    );
                }

                callback(null);
            }],
        function(err, results) {
            if (err) {
                done(err);
            } else {
                done();
            }
        });
    });

    // Test insertion of a schema into the server where one with the same name
    // already exists. The server should not allow an overwrite of this nature.
    // The user must either delete the schema, or update/edit it.
    it('insert_conflicting_aux_schema', function(done) {
        var aux_schema_name = osdf_utils.random_string(8);

        var aux_schema_doc = {
            name: aux_schema_name,
            schema: test_aux_schema
        };

        // Make a duplicate of the aux_schema_doc...
        var aux_schema_doc_dupe = aux_schema_doc;

        // Modify it slightly so that we can detect if the duplicate made it in
        // easier.
        aux_schema_doc_dupe['schema']['description'] = 'duplicate aux schema';

        waterfall([
            function(callback) {
                // First we insert a schema
                tutils.insert_aux_schema(test_ns, aux_schema_doc, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 201,
                    'Correct status for insertion.');

                // Now, try inserting another aux schema with the same name
                tutils.insert_aux_schema(test_ns, aux_schema_doc_dupe, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 409,
                    'Insertion of an auxiliary schema with an existing ' +
                    'name did not succeed.');

                assert.strictEqual(data, '',
                    'No data returned on subsequent insertion.');

                // Check that schema actually didn't make it into the server despite
                // what the HTTP code says
                tutils.retrieve_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.isOk(data.length > 0,
                    'Data retrieved for retrieving aux schema.');

                var retrieved;
                try {
                    retrieved = JSON.parse(data);
                } catch (err) {
                    callback(err);
                    return;
                }

                assert.equal(retrieved['description'], test_aux_schema['description'],
                    'Duplicate schema did NOT overwrite the original ' +
                    'aux schema.');

                // Perform cleanup by deleting the auxiliary schema we attempted to
                // insert. It should not have been inserted, but delete it anyway
                // just in case the implementation failed to reject it.
                tutils.delete_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        // ignored
                    }
                );

                callback(null);
            }],
        function(err, results) {
            if (err) {
                done(err);
            } else {
                done();
            }
        });
    });

    // Test insertion of a schema when no authentication credentials are provided.
    // We should not be able to insert a schema this way.
    it('insert_aux_schema_no_auth', function(done) {
        // Use a helper function since the insert_aux_schema_no_auth()
        // and insert_aux_schema_bad_auth() tests are so similar.
        invalid_credentials_helper(done, null);
    });

    // Test insertion of a schema when invalid authentication credentials are
    // provided. We should not be able to insert a schema this way.
    it('insert_aux_schema_bad_auth', function(done) {
        // Use a helper function since the insert_aux_schema_no_auth()
        // and insert_aux_schema_bad_auth() tests are so similar.
        invalid_credentials_helper(done, bad_auth);
    });

    // Test that the service does not allow a schema to be inserted that makes
    // reference to an auxiliary schema that it does not know about.
    it('insert_aux_schema_with_unknown_auxiliary', function(done) {
        var aux_schema_name = osdf_utils.random_string(8);

        waterfall([
            function(callback) {
                // Let's take the test schema, add a $ref to it using a
                // randomly generated name, and attempt to insert it. This
                // should fail.
                var random_aux_name = osdf_utils.random_string(8);
                var test_aux_schema_modified = test_aux_schema;

                test_aux_schema_modified['properties']['$ref'] = random_aux_name;

                var aux_schema_doc = {
                    name: aux_schema_name,
                    schema: test_aux_schema_modified
                };

                var schema_utils = require('schema_utils.js');
                var refs = schema_utils.extractRefNames(test_aux_schema_modified);

                assert.isArray(refs, 'Got an array of references to test.');

                assert.equal(refs.length, 1,
                    'Got the expected number of reference names.');

                assert.equal(refs[0], random_aux_name,
                    'The extracted ref name matches the random name we generated.');

                tutils.insert_aux_schema(test_ns, aux_schema_doc, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 422,
                    'Correct status code for aux schema insertion ' +
                    'with an unknown auxiliary.');

                assert.strictEqual(data, '',
                    'No content returned for aux schema insertion with an ' +
                    'unknown auxiliary.');

                tutils.retrieve_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        if (err) {
                            callback(err, null);
                        } else {
                            callback(null, resp);
                        }
                    }
                );
            },
            function(resp, callback) {
                var data = resp['body'];
                var response = resp['response'];

                assert.equal(response.statusCode, 404,
                    'Correct status code for failed auxiliary schema insertion.');

                assert.strictEqual(data, '',
                    'No content returned for auxiliary schema retrieval.');

                // Perform cleanup by deleting the auxiliary schema we attempted to
                // insert. It should not have been inserted, but delete it anyway
                // just in case the implementation failed to reject it.
                tutils.delete_aux_schema(test_ns, aux_schema_name, auth,
                    function(err, resp) {
                        // ignored
                    }
                );

                callback(null);
            }],
        function(err, results) {
            if (err) {
                done(err);
            } else {
                done();
            }
        });
    });
});

function invalid_credentials_helper(done, test_auth) {
    var aux_schema_name = osdf_utils.random_string(8);

    waterfall([
        function(callback) {
            // First we insert a schema
            var aux_schema_doc = {
                name: aux_schema_name,
                schema: test_aux_schema
            };

            // Make sure we use the invalid credentials here
            tutils.insert_aux_schema(test_ns, aux_schema_doc, test_auth,
                function(err, resp) {
                    if (err) {
                        callback(err, null);
                    } else {
                        callback(null, resp);
                    }
                }
            );
        },
        function(resp, callback) {
            var data = resp['body'];
            var response = resp['response'];

            assert.equal(response.statusCode, 403,
                'Correct status for auxiliary schema insertion.');

            assert.strictEqual(data, '',
                'No content returned on an auxiliary schema insertion.');

            // then try to retrieve it (with valid credentials)
            tutils.retrieve_aux_schema(test_ns, aux_schema_name, auth,
                function(err, resp) {
                    if (err) {
                        callback(err, null);
                    } else {
                        callback(null, resp);
                    }
                }
            );
        },
        function(resp, callback) {
            var data = resp['body'];
            var response = resp['response'];

            assert.equal(response.statusCode, 404,
                'Auxiliary schema retrieval of failed insertion had ' +
                'correct code.');

            assert.strictEqual(data, '',
                'No data returned on auxiliary schema retrieval.');

            // Finally, also check to see that the auxiliary schema did NOT find its
            // way into the namespace's master list of auxiliary schemas.
            tutils.retrieve_all_aux_schemas(test_ns, auth, function(err, resp) {
                if (err) {
                    callback(err, null);
                } else {
                    callback(null, resp);
                }
            });
        },
        function(resp, callback) {
            var data = resp['body'];
            var response = resp['response'];

            assert.equal(response.statusCode, 200,
                'Correct status for the auxiliary schema listing.');

            assert.isOk(data.length > 0,
                'Got data back for the auxiliary schema listing.');

            var aux_schemas;
            try {
                aux_schemas = JSON.parse(data);
            } catch (err) {
                callback(err);
                return;
            }

            assert.isFalse(aux_schemas.hasOwnProperty(aux_schema_name),
                'Auxiliary schema was not registered into master list.');

            // Perform cleanup by deleting the auxiliary schema we attempted to
            // insert. It should not have been inserted, but delete it anyway
            // just in case the implementation failed to reject it.
            tutils.delete_aux_schema(test_ns, aux_schema_name, auth,
                function(err, resp) {
                    // ignored
                }
            );

            callback(null);
        }],
    function(err, results) {
        if (err) {
            done(err);
        } else {
            done();
        }
    });
}


text:
import {Component} from 'angular2/core';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import WakandaClient from 'wakanda-client/browser/no-promise';
import {LoginComponent} from './login.component';
import {ProfileComponent} from './profile.component';
import {RegisterComponent} from './register.component';

@Component({
    selector: 'my-app',
    template: `
    <router-outlet></router-outlet>
    `,
    directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
  {path: '/login',   name: 'Login', component: LoginComponent, useAsDefault: true},
  {path: '/register',   name: 'Register', component: RegisterComponent},
  {path: '/profile',   name: 'Profile', component: ProfileComponent}
])
export class AppComponent {
}

redpajama_set_name: RedPajamaGithub


text:
package com.jayway.trumpet.server.infrastructure.trumpeteer;

import com.jayway.trumpet.server.domain.location.Location;
import com.jayway.trumpet.server.domain.subscriber.SubscriberConfig;
import com.jayway.trumpet.server.domain.subscriber.SubscriberOutput;
import com.jayway.trumpet.server.domain.subscriber.Trumpeteer;
import com.jayway.trumpet.server.domain.trumpeteer.TrumpeteerConfig;
import com.jayway.trumpet.server.infrastructure.event.GuavaTrumpetEventBus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

@RunWith(MockitoJUnitRunner.class)
public class TrumpetServiceImplLinkIdTest {

    @Mock
    TrumpeteerConfig trumpeteerConfig;

    @Mock
    SubscriberConfig subscriberConfig;

    private TrumpetServiceImpl tested;

    @Before public void
    given_trumpet_broadcast_service_is_created() {
        given(subscriberConfig.trumpeteerStaleThreshold()).willReturn(600000L);
        given(subscriberConfig.trumpeteerPurgeInterval()).willReturn(600000L);

        tested = new TrumpetServiceImpl(new GuavaTrumpetEventBus(), subscriberConfig, trumpeteerConfig);
    }

    @Test public void
    subscribing_with_unique_link_id_will_the_register_the_subscriber() {
        // Given
        Trumpeteer trumpeteer1 = givenSubscriber("id1", "linkId1");
        Trumpeteer trumpeteer2 = givenSubscriber("id2", "linkId2");
        tested.subscribe(trumpeteer1);

        // When
        tested.subscribe(trumpeteer2);

        // Then
        assertThat(tested.numberOfSubscribers()).isEqualTo(2);
    }

    @Test public void
    subscribing_with_link_id_already_used_by_another_subscriber_will_unsubscribe_the_other_subscriber() {
        // Given
        Trumpeteer trumpeteer1 = givenSubscriber("id1", "linkId1");
        Trumpeteer trumpeteer2 = givenSubscriber("id2", "linkId1");
        tested.subscribe(trumpeteer1);

        // When
        tested.subscribe(trumpeteer2);

        // Then
        assertThat(tested.numberOfSubscribers()).isEqualTo(1);
        assertThat(tested.findById("id1").isPresent()).isFalse();
        assertThat(tested.findById("id2").isPresent()).isTrue();
    }

    private Trumpeteer givenSubscriber(String id, String linkId) {
        return tested.create(id, linkId, Location.location(22.2d, 22.1d, 10), mock(SubscriberOutput.class));
    }

}


text:
package sunmi.sunmiui.utils;

import android.text.TextUtils;
import android.util.Log;

/**
 * 打印Log.点击可以直接连接到打印log所在行
 *
 * @author YC
 *         2016年7月27日
 */
public class LogUtil {

    public static final int VERBOSE = 1;
    public static final int DEBUG = 2;
    public static final int INFO = 3;
    public static final int WARN = 4;
    public static final int ERROR = 5;
    public static final int NOTHING = 6;
    public static int LEVEL = VERBOSE;

    public static void setLevel(int Level) {
        LEVEL = Level;
    }

    public static void v(String TAG, String msg) {
        if (LEVEL <= VERBOSE && !TextUtils.isEmpty(msg)) {
            MyLog(VERBOSE, TAG, msg);
        }
    }

    public static void d(String TAG, String msg) {
        if (LEVEL <= DEBUG && !TextUtils.isEmpty(msg)) {
            MyLog(DEBUG, TAG, msg);
        }
    }

    public static void i(String TAG, String msg) {
        if (LEVEL <= INFO && !TextUtils.isEmpty(msg)) {
            MyLog(INFO, TAG, msg);
        }
    }

    public static void w(String TAG, String msg) {
        if (LEVEL <= WARN && !TextUtils.isEmpty(msg)) {
            MyLog(WARN, TAG, msg);
        }
    }

    public static void e(String TAG, String msg) {
        if (LEVEL <= ERROR && !TextUtils.isEmpty(msg)) {
            MyLog(ERROR, TAG, msg);
        }
    }

    private static void MyLog(int type, String TAG, String msg) {
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

        int index = 4;
        String className = stackTrace[index].getFileName();
        String methodName = stackTrace[index].getMethodName();
        int lineNumber = stackTrace[index].getLineNumber();

        methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[ (").append(className).append(":").append(lineNumber).append(")#").append(methodName).append(" ] ");
        stringBuilder.append(msg);
        String logStr = stringBuilder.toString();
        switch (type) {
            case VERBOSE:
                Log.v(TAG, logStr);
                break;
            case DEBUG:
                Log.d(TAG, logStr);
                break;
            case INFO:
                Log.i(TAG, logStr);
                break;
            case WARN:
                Log.w(TAG, logStr);
                break;
            case ERROR:
                Log.e(TAG, logStr);
                break;
            default:
                break;
        }

    }

}


text:
 import java.util.ArrayList;

 public abstract class CarBuilder
 {
     public abstract void setSequence(ArrayList<String> sequence);
     public abstract CarModel getCarModel();
 }


text:
module RecordsFormatsHelper
end


text:
<?php

/**
 * Pressed78RPMDisc form base class.
 *
 * @method Pressed78RPMDisc getObject() Returns the current form's model object
 *
 * @package    mediaSCORE
 * @subpackage form
 * @author     Nouman Tayyab
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePressed78RPMDiscForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                              => new sfWidgetFormInputHidden(),
      'quantity'                        => new sfWidgetFormInputText(),
      'generation'                      => new sfWidgetFormInputText(),
      'year_recorded'                   => new sfWidgetFormInputText(),
      'copies'                          => new sfWidgetFormInputText(),
      'stock_brand'                     => new sfWidgetFormInputText(),
      'off_brand'                       => new sfWidgetFormInputText(),
      'fungus'                          => new sfWidgetFormInputText(),
      'other_contaminants'              => new sfWidgetFormInputText(),
      'duration'                        => new sfWidgetFormInputText(),
      'duration_type'                   => new sfWidgetFormInputText(),
      'type'                            => new sfWidgetFormInputText(),
      'material'                        => new sfWidgetFormInputText(),
      'oxidationcorrosion'              => new sfWidgetFormInputText(),
      'pack_deformation'                => new sfWidgetFormInputText(),
      'noise_reduction'                 => new sfWidgetFormInputText(),
      'tape_type'                       => new sfWidgetFormInputText(),
      'thin_tape'                       => new sfWidgetFormInputText(),
      'slow_speed'                      => new sfWidgetFormInputText(),
      'sound_field'                     => new sfWidgetFormInputText(),
      'soft_binder_syndrome'            => new sfWidgetFormInputText(),
      'gauge'                           => new sfWidgetFormInputText(),
      'color'                           => new sfWidgetFormInputText(),
      'colorfade'                       => new sfWidgetFormInputText(),
      'soundtrackformat'                => new sfWidgetFormInputText(),
      'substrate'                       => new sfWidgetFormInputText(),
      'strongodor'                      => new sfWidgetFormInputText(),
      'vinegarodor'                     => new sfWidgetFormInputText(),
      'adstriplevel'                    => new sfWidgetFormInputText(),
      'shrinkage'                       => new sfWidgetFormInputText(),
      'levelofshrinkage'                => new sfWidgetFormInputText(),
      'rust'                            => new sfWidgetFormInputText(),
      'discoloration'                   => new sfWidgetFormInputText(),
      'surfaceblisteringbubbling'       => new sfWidgetFormInputText(),
      'thintape'                        => new sfWidgetFormInputText(),
      '1993orearlier'                   => new sfWidgetFormInputText(),
      'datagradetape'                   => new sfWidgetFormInputText(),
      'longplay32k96k'                  => new sfWidgetFormInputText(),
      'corrosionrustoxidation'          => new sfWidgetFormInputText(),
      'composition'                     => new sfWidgetFormInputText(),
      'nonstandardbrand'                => new sfWidgetFormInputText(),
      'trackconfiguration'              => new sfWidgetFormInputText(),
      'tapethickness'                   => new sfWidgetFormInputText(),
      'speed'                           => new sfWidgetFormInputText(),
      'softbindersyndrome'              => new sfWidgetFormInputText(),
      'materialsbreakdown'              => new sfWidgetFormInputText(),
      'physicaldamage'                  => new sfWidgetFormInputText(),
      'delamination'                    => new sfWidgetFormInputText(),
      'plasticizerexudation'            => new sfWidgetFormInputText(),
      'recordinglayer'                  => new sfWidgetFormInputText(),
      'recordingspeed'                  => new sfWidgetFormInputText(),
      'cylindertype'                    => new sfWidgetFormInputText(),
      'reflectivelayer'                 => new sfWidgetFormInputText(),
      'datalayer'                       => new sfWidgetFormInputText(),
      'opticaldisctype'                 => new sfWidgetFormInputText(),
      'format'                          => new sfWidgetFormInputText(),
      'recordingstandard'               => new sfWidgetFormInputText(),
      'publicationyear'                 => new sfWidgetFormDate(),
      'capacitylayers'                  => new sfWidgetFormInputText(),
      'codec'                           => new sfWidgetFormInputText(),
      'datarate'                        => new sfWidgetFormInputText(),
      'sheddingsoftbinder'              => new sfWidgetFormInputText(),
      'formatversion'                   => new sfWidgetFormInputText(),
      'oxide'                           => new sfWidgetFormInputText(),
      'bindersystem'                    => new sfWidgetFormInputText(),
      'reelsize'                        => new sfWidgetFormInputText(),
      'whiteresidue'                    => new sfWidgetFormInputText(),
      'size'                            => new sfWidgetFormInputText(),
      'formattypedvideorecordingformat' => new sfWidgetFormInputText(),
      'bitrate'                         => new sfWidgetFormInputText(),
      'scanning'                        => new sfWidgetFormInputText(),
      'created_at'                      => new sfWidgetFormDateTime(),
      'updated_at'                      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'quantity'                        => new sfValidatorInteger(),
      'generation'                      => new sfValidatorInteger(),
      'year_recorded'                   => new sfValidatorString(array('max_length' => 255)),
      'copies'                          => new sfValidatorInteger(array('required' => false)),
      'stock_brand'                     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'off_brand'                       => new sfValidatorInteger(array('required' => false)),
      'fungus'                          => new sfValidatorInteger(array('required' => false)),
      'other_contaminants'              => new sfValidatorInteger(array('required' => false)),
      'duration'                        => new sfValidatorInteger(),
      'duration_type'                   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'type'                            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'material'                        => new sfValidatorInteger(),
      'oxidationcorrosion'              => new sfValidatorInteger(),
      'pack_deformation'                => new sfValidatorInteger(array('required' => false)),
      'noise_reduction'                 => new sfValidatorInteger(),
      'tape_type'                       => new sfValidatorInteger(),
      'thin_tape'                       => new sfValidatorInteger(array('required' => false)),
      'slow_speed'                      => new sfValidatorInteger(array('required' => false)),
      'sound_field'                     => new sfValidatorInteger(),
      'soft_binder_syndrome'            => new sfValidatorInteger(array('required' => false)),
      'gauge'                           => new sfValidatorInteger(),
      'color'                           => new sfValidatorInteger(),
      'colorfade'                       => new sfValidatorInteger(array('required' => false)),
      'soundtrackformat'                => new sfValidatorInteger(array('required' => false)),
      'substrate'                       => new sfValidatorInteger(),
      'strongodor'                      => new sfValidatorInteger(array('required' => false)),
      'vinegarodor'                     => new sfValidatorInteger(array('required' => false)),
      'adstriplevel'                    => new sfValidatorInteger(array('required' => false)),
      'shrinkage'                       => new sfValidatorInteger(array('required' => false)),
      'levelofshrinkage'                => new sfValidatorInteger(array('required' => false)),
      'rust'                            => new sfValidatorInteger(array('required' => false)),
      'discoloration'                   => new sfValidatorInteger(array('required' => false)),
      'surfaceblisteringbubbling'       => new sfValidatorInteger(array('required' => false)),
      'thintape'                        => new sfValidatorInteger(array('required' => false)),
      '1993orearlier'                   => new sfValidatorInteger(array('required' => false)),
      'datagradetape'                   => new sfValidatorInteger(array('required' => false)),
      'longplay32k96k'                  => new sfValidatorInteger(array('required' => false)),
      'corrosionrustoxidation'          => new sfValidatorInteger(array('required' => false)),
      'composition'                     => new sfValidatorInteger(array('required' => false)),
      'nonstandardbrand'                => new sfValidatorInteger(array('required' => false)),
      'trackconfiguration'              => new sfValidatorInteger(),
      'tapethickness'                   => new sfValidatorInteger(array('required' => false)),
      'speed'                           => new sfValidatorInteger(),
      'softbindersyndrome'              => new sfValidatorInteger(array('required' => false)),
      'materialsbreakdown'              => new sfValidatorInteger(array('required' => false)),
      'physicaldamage'                  => new sfValidatorInteger(array('required' => false)),
      'delamination'                    => new sfValidatorInteger(array('required' => false)),
      'plasticizerexudation'            => new sfValidatorInteger(array('required' => false)),
      'recordinglayer'                  => new sfValidatorInteger(),
      'recordingspeed'                  => new sfValidatorInteger(),
      'cylindertype'                    => new sfValidatorInteger(),
      'reflectivelayer'                 => new sfValidatorInteger(),
      'datalayer'                       => new sfValidatorInteger(),
      'opticaldisctype'                 => new sfValidatorInteger(),
      'format'                          => new sfValidatorInteger(),
      'recordingstandard'               => new sfValidatorInteger(),
      'publicationyear'                 => new sfValidatorDate(),
      'capacitylayers'                  => new sfValidatorInteger(),
      'codec'                           => new sfValidatorInteger(),
      'datarate'                        => new sfValidatorInteger(),
      'sheddingsoftbinder'              => new sfValidatorInteger(array('required' => false)),
      'formatversion'                   => new sfValidatorInteger(),
      'oxide'                           => new sfValidatorInteger(),
      'bindersystem'                    => new sfValidatorInteger(),
      'reelsize'                        => new sfValidatorInteger(),
      'whiteresidue'                    => new sfValidatorInteger(array('required' => false)),
      'size'                            => new sfValidatorInteger(),
      'formattypedvideorecordingformat' => new sfValidatorInteger(),
      'bitrate'                         => new sfValidatorInteger(array('required' => false)),
      'scanning'                        => new sfValidatorInteger(),
      'created_at'                      => new sfValidatorDateTime(),
      'updated_at'                      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('pressed78_rpm_disc[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pressed78RPMDisc';
  }

}


text:
layout: "pureblogpost"
lang: "en"
desc: A poem
author: Catherine George, 2k14
title: Escape
---
Shh.

Close your eyes

Breathe in

Listen -

\- and you'll hear

The rain on the windowpane

The rustle of leaves

The waves on the sand

The birds in the morning fluttering about

The rough and sharp crumpling of paper

The melody that soothes your veins

Eternalize it.

Now look -

\- and you'll see

The drops finding their way down the window

The green hue around, it's familiarity

The waves reaching in to caress the sand

The pleasant birds in the trees

The clean sheet of paper you're about to fill.

Stop there.

Take it all in.

Remember that even when all seems impossible

All you have to do is pay a little attention

There is always an escape.


text:
from __future__ import absolute_import

from mathpy.combinatorics import binomial
from mathpy.distributions import continuous, discrete
from mathpy.linalgebra import lu, matrix, norm, qr
from mathpy.numerical import differentiation, integration, polynomial, roots
from mathpy.numtheory import constants, divisibility, exponentiation, factor, integers, pi, primes, sequences
from mathpy.random import random, sample
from mathpy.settheory import sets
from mathpy.special import factorial, gamma
from mathpy.stats import aov, fa, hypothesis, simulate, summary


text:
import {ElementRef, Directive, OnInit, Input, HostListener, Renderer, Inject} from '@angular/core';
import {Window} from '../../utils/window/window';

@Directive({selector: '[sc-animation]'})
export class ScrollAnimationDirective implements OnInit {
    constructor(
        private _el: ElementRef,
        private _renderer: Renderer,
        @Inject(Window) private _window: Window
    ) {}

    // Element that triggers the reached state
    @Input('sc-animation') set sc(options: {ref?: ElementRef, offset?: number, class?: string, delay: number, hideInitial?: boolean}) {
        this.options = Object.assign(this.options, options);
    }

    @HostListener('window:scroll') onScroll() {
        if (!this.hasClass && this._window.pageYOffset + this.windowHeight >= this.top + this.options.offset) {
            setTimeout(() => {
                this._renderer.setElementClass(this._el.nativeElement, this.options.class, true);
                // Remove the class after the time specified if it was specified
                if (this.options.removeAfter !== null) setTimeout(() => this._renderer.setElementClass(this._el.nativeElement, this.options.class, false), this.options.removeAfter)
            }, this.options.delay);
            this.hasClass = true;
        }
    }

    @HostListener('window:resize') onResize() {
        this.windowHeight = this._window.innerHeight;
        this._setTop()
    }

    top: number;
    windowHeight: number = this._window.innerHeight;
    hasClass: boolean = false;

    options: {ref: ElementRef, offset: number, class: string, delay: number, hideInitial: boolean, removeAfter: number} = {
        ref: this._el,
        offset: 0,
        class: 'enter',
        delay: 0,
        hideInitial: true,
        removeAfter: null
    };

    ngOnInit() {
        if (this.options.hideInitial) this._hideInitial();
        this._setTop();
        this.onScroll();
    }

    private _setTop() {
        this.top = this.options.ref.nativeElement.getBoundingClientRect ? this.options.ref.nativeElement.getBoundingClientRect().top : 0;
    }

    private _hideInitial() {
        this._renderer.setElementStyle(this._el.nativeElement, 'opacity', '0');
    }
}


text:
<?php

namespace mako\validator\rules;

use mako\validator\rules\traits\WithParametersTrait;

/**
 * Greater than or equal to rule.
 *
 * @author Frederic G. Østby
 */
class GreaterThanOrEqualTo extends Rule implements RuleInterface, WithParametersInterface
{
	use WithParametersTrait;

	/**
	 * Parameters.
	 *
	 * @var array
	 */
	protected $parameters = ['greaterThanOrEqualTo'];

	/**
	 * {@inheritdoc}
	 */
	public function validate($value, array $input): bool
	{
		return (int) $value >= $this->getParameter('greaterThanOrEqualTo');
	}

	/**
	 * {@inheritdoc}
	 */
	public function getErrorMessage(string $field): string
	{
		return sprintf('The value of the %1$s field must be greater than or equal to %2$s.', $field, $this->parameters['greaterThanOrEqualTo']);
	}
}


text:
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

------------------------------------------------------------------------

html
 Tag.html.md
---------

------------------------------------------------------------------------

**Render an HTML `.html.md>` Element**

Renders an HTML `.html.md>` element with language attributes extracted from the user's current Locale object, if there is one.

------------------------------------------------------------------------

**Tag Information**

Tag Class

org.apache.struts.taglib.html.md.HtmlTag

TagExtraInfo Class

*None*

Body Content

JSP

Display Name

*None*

**Attributes**

**Name**

**Required**

**Request-time**

**Type**

**Description**

lang

false

true

`boolean`

Renders a lang attribute with the locale stored in the user's session. If not found in the session, the language from the `Accept-Language` HTTP header is used. If still not found, the default language for the server is used.

**Since:**
Struts 1.2

.html.md

false

true

`boolean`

Set to `true` in order to render `xml:lang` and `xmlns` attributes on the generated .html.md` element. This also causes all other html tags to render as XHTML 1.0 (the \ tag has a similar purpose).

**Since:**
Struts 1.1

|-------------------------|
| **Variables**           |
| *No Variables Defined.* |

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

------------------------------------------------------------------------

*Output Generated by [Tag Library Documentation Generator](http://taglibrarydoc.dev.java.net/). Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.*


text:
/*
Problem 3. Read file contents
    • Write a program that enters file name along with its full file path (e.g.  C:\WINDOWS\win.ini ), reads its contents and prints it
      on the console.
    • Find in MSDN how to use  System.IO.File.ReadAllText(…) .
    • Be sure to catch all possible exceptions and print user-friendly error messages.
*/

using System;

class ReadFileContents
{
    static void Main(string[] args)
    {

    }
}


text: import FModPreviewer


text:
static pthread_key_t GRSafeKeysForClassKey;
void freeSafeKeysForClass(void *objects) {
    CFRelease((CFMutableDictionaryRef)objects);
}
#define setupSafeKeysForClass() pthread_key_create(&GRSafeKeysForClassKey, freeSafeKeysForClass)
#define getCurrentThreadSafeKeysForClass() (CFMutableDictionaryRef)pthread_getspecific(GRSafeKeysForClassKey)
#define setCurrentThreadSafeKeysForClass(classes) pthread_setspecific(GRSafeKeysForClassKey, classes)

static Class NSManagedObjectClass;

// Plain declarations so that the compiler let us use those selectors
@interface NSObject(GRMustacheCoreDataMethods)
- (NSDictionary *)propertiesByName;
- (id)entity;
@end

@implementation GRMustacheKeyAccess

+ (void)initialize
{
    NSManagedObjectClass = NSClassFromString(@"NSManagedObject");
    setupSafeKeysForClass();
}

+ (BOOL)isSafeMustacheKey:(NSString *)key forObject:(id)object
{
    NSSet *safeKeys = nil;
    {
        CFMutableDictionaryRef safeKeysForClass = getCurrentThreadSafeKeysForClass();
        if (!safeKeysForClass) {
            safeKeysForClass = CFDictionaryCreateMutable(NULL, 0, NULL, &kCFTypeDictionaryValueCallBacks);
            setCurrentThreadSafeKeysForClass(safeKeysForClass);
        }

        Class klass = [object class];
        safeKeys = (NSSet *)CFDictionaryGetValue(safeKeysForClass, (__bridge const void *)(klass));
        if (safeKeys == nil) {
            NSMutableSet *keys = [self propertyGettersForClass:klass];
            if (NSManagedObjectClass && [object isKindOfClass:NSManagedObjectClass]) {
                [keys unionSet:[NSSet setWithArray:[[[object entity] propertiesByName] allKeys]]];
            }
            safeKeys = keys;
            CFDictionarySetValue(safeKeysForClass, (__bridge const void *)(klass), (__bridge const void *)(safeKeys));
        }
    }

    return [safeKeys containsObject:key];
}

+ (NSMutableSet *)propertyGettersForClass:(Class)klass
{
    NSMutableSet *safeKeys = [NSMutableSet set];

    // Iterate classes up to last super class

    while (klass) {

        // Iterate properties

        unsigned int count;
        objc_property_t *properties = class_copyPropertyList(klass, &count);

        for (unsigned int i=0; i<count; ++i) {
            const char *attrs = property_getAttributes(properties[i]);

            // Safe Mustache keys are property name, and custom getter, if present.

            const char *propertyNameCString = property_getName(properties[i]);
            NSString *propertyName = [NSString stringWithCString:propertyNameCString encoding:NSUTF8StringEncoding];
            [safeKeys addObject:propertyName];

            char *getterStart = strstr(attrs, ",G");            // ",GcustomGetter,..." or NULL if there is no custom getter
            if (getterStart) {
                getterStart += 2;                               // "customGetter,..."
                char *getterEnd = strstr(getterStart, ",");     // ",..." or NULL if customGetter is the last attribute
                size_t getterLength = (getterEnd ? getterEnd : attrs + strlen(attrs)) - getterStart;
                NSString *customGetter = [[NSString alloc] initWithBytes:getterStart length:getterLength encoding:NSUTF8StringEncoding];
                [safeKeys addObject:customGetter];
            }
        }

        free(properties);
        klass = class_getSuperclass(klass);
    }

    return safeKeys;
}

@end


text:
""" Defines the PanTool class.
"""

from numpy import inf

# Enthought library imports
from enable.api import BaseTool, Pointer, KeySpec
from traits.api import Bool, Enum, Float, Tuple, Instance

class PanTool(BaseTool):
    """ A tool that enables the user to pan a plot by clicking a mouse
    button and dragging.
    """

    # The mouse button that initiates the drag operation.
    drag_button = Enum("left", "middle", "right")

    # The cursor to use when panning.
    drag_pointer = Pointer("hand")

    # Scaling factor on the panning "speed".
    speed = Float(1.0)

    # The modifier key that, if depressed when the drag is initiated, constrains
    # the panning to happen in the only direction of largest initial motion.
    # It is possible to permanently restrict this tool to always drag along one
    # direction.  To do so, set constrain=True, constrain_key=None, and
    # constrain_direction to the desired direction.
    constrain_key = Enum(None, "shift", "control", "alt")

    # Keys to Pan via keyboard
    pan_right_key = Instance(KeySpec, args=("Right",))
    pan_left_key = Instance(KeySpec, args=("Left",))
    pan_up_key = Instance(KeySpec, args=("Up",))
    pan_down_key = Instance(KeySpec, args=("Down",))

    # number of pixels the keys should pan
    # disabled if 0.0
    pan_keys_step = Float(0.0)

    # Constrain the panning to one direction?
    constrain = Bool(False)

    # The direction of constrained draw. A value of None means that the user
    # has initiated the drag and pressed the constrain_key, but hasn't moved
    # the mouse yet; the magnitude of the components of the next mouse_move
    # event will determine the constrain_direction.
    constrain_direction = Enum(None, "x", "y")

    # Restrict to the bounds of the plot data
    restrict_to_data = Bool(False)

    # (x,y) of the point where the mouse button was pressed.
    _original_xy = Tuple

    # Data coordinates of **_original_xy**.  This may be either (index,value)
    # or (value,index) depending on the component's orientation.
    _original_data = Tuple

    # Was constrain=True triggered by the **contrain_key**? If False, it was
    # set programmatically.
    _auto_constrain = Bool(False)

    #------------------------------------------------------------------------
    # Inherited BaseTool traits
    #------------------------------------------------------------------------

    # The tool does not have a visual representation (overrides
    # BaseTool).
    draw_mode = "none"

    # The tool is not visible (overrides BaseTool).
    visible = False

    # The possible event states of this tool (overrides enable.Interactor).
    event_state = Enum("normal", "panning")

    def normal_key_pressed(self, event):
        """ Handles a key being pressed when the tool is in the 'normal'
        state.
        """
        if self.pan_keys_step == 0.0:
            return
        src = self.component.bounds[0]/2, self.component.bounds[1]/2
        dest = src
        if self.pan_left_key.match(event):
            dest = (src[0] - self.pan_keys_step,
                    src[1])
        elif self.pan_right_key.match(event):
            dest = (src[0] + self.pan_keys_step,
                    src[1])
        elif self.pan_down_key.match(event):
            dest = (src[0],
                    src[1] - self.pan_keys_step)
        elif self.pan_up_key.match(event):
            dest = (src[0],
                    src[1] + self.pan_keys_step)
        if src != dest:
            self._original_xy = src
            event.x = dest[0]
            event.y = dest[1]
            self.panning_mouse_move(event)
        return

    def normal_left_down(self, event):
        """ Handles the left mouse button being pressed when the tool is in
        the 'normal' state.

        Starts panning if the left mouse button is the drag button.
        """
        if self.drag_button == "left":
            self._start_pan(event)
        return

    def normal_right_down(self, event):
        """ Handles the right mouse button being pressed when the tool is in
        the 'normal' state.

        Starts panning if the right mouse button is the drag button.
        """
        if self.drag_button == "right":
            self._start_pan(event)
        return

    def normal_middle_down(self, event):
        """ Handles the middle mouse button being pressed when the tool is in
        the 'normal' state.

        Starts panning if the middle mouse button is the drag button.
        """
        if self.drag_button == "middle":
            self._start_pan(event)
        return

    def panning_left_up(self, event):
        """ Handles the left mouse button coming up when the tool is in the
        'panning' state.

        Stops panning if the left mouse button is the drag button.
        """
        if self.drag_button == "left":
            self._end_pan(event)
        return

    def panning_right_up(self, event):
        """ Handles the right mouse button coming up when the tool is in the
        'panning' state.

        Stops panning if the right mouse button is the drag button.
        """
        if self.drag_button == "right":
            self._end_pan(event)
        return

    def panning_middle_up(self, event):
        """ Handles the middle mouse button coming up when the tool is in the
        'panning' state.

        Stops panning if the middle mouse button is the drag button.
        """
        if self.drag_button == "middle":
            self._end_pan(event)
        return

    def panning_mouse_move(self, event):
        """ Handles the mouse being moved when the tool is in the 'panning'
        state.
        """
        plot = self.component

        if self._auto_constrain and self.constrain_direction is None:
            # Determine the constraint direction
            x_orig, y_orig = self._original_xy
            if abs(event.x - x_orig) > abs(event.y - y_orig):
                self.constrain_direction = "x"
            else:
                self.constrain_direction = "y"

        direction_info = [("x", "width", 0), ("y", "height", 1)]
        for direction, bound_name, index in direction_info:
            if not self.constrain or self.constrain_direction == direction:
                mapper = getattr(plot, direction + "_mapper")
                domain_min, domain_max = mapper.domain_limits
                eventpos = getattr(event, direction)
                origpos = self._original_xy[index]

                screenlow, screenhigh = mapper.screen_bounds
                screendelta = self.speed * (eventpos - origpos)

                newlow = mapper.map_data(screenlow - screendelta)
                newhigh = mapper.map_data(screenhigh - screendelta)

                # Don't set the range in this dimension if the panning
                # would exceed the domain limits.
                # To do this offset properly, we would need to iteratively
                # solve for a root using map_data on successive trial
                # values.  As a first approximation, we're just going to
                # use a linear approximation, which works perfectly for
                # linear mappers (which is used 99% of the time).
                if domain_min is None:
                    if self.restrict_to_data:
                        domain_min = min([source.get_data().min()
                                          for source in mapper.range.sources])
                    else:
                        domain_min = -inf
                if domain_max is None:
                    if self.restrict_to_data:
                        domain_max = max([source.get_data().max()
                                          for source in mapper.range.sources])
                    else:
                        domain_max = inf

                if (newlow <= domain_min) and (newhigh >= domain_max):
                    # Don't do anything; effectively, freeze the pan
                    continue

                if newlow <= domain_min:
                    newlow = domain_min
                    # Calculate delta in screen space, which is always linear.
                    screen_delta = mapper.map_screen(domain_min) - screenlow
                    newhigh = mapper.map_data(screenhigh + screen_delta)
                elif newhigh >= domain_max:
                    newhigh = domain_max
                    # Calculate delta in screen space, which is always linear.
                    screen_delta = mapper.map_screen(domain_max) - screenhigh
                    newlow = mapper.map_data(screenlow + screen_delta)

                # Use .set_bounds() so that we don't generate two range_changed
                # events on the DataRange
                mapper.range.set_bounds(newlow, newhigh)

        event.handled = True

        self._original_xy = (event.x, event.y)
        plot.request_redraw()
        return

    def panning_mouse_leave(self, event):
        """ Handles the mouse leaving the plot when the tool is in the 'panning'
        state.

        Ends panning.
        """
        return self._end_pan(event)

    def _start_pan(self, event, capture_mouse=True):
        self._original_xy = (event.x, event.y)
        if self.constrain_key is not None:
            if getattr(event, self.constrain_key + "_down"):
                self.constrain = True
                self._auto_constrain = True
                self.constrain_direction = None
        self.event_state = "panning"
        if capture_mouse:
            event.window.set_pointer(self.drag_pointer)
            event.window.set_mouse_owner(self, event.net_transform())
        event.handled = True
        return

    def _end_pan(self, event):
        if self._auto_constrain:
            self.constrain = False
            self.constrain_direction = None
        self.event_state = "normal"
        event.window.set_pointer("arrow")
        if event.window.mouse_owner == self:
            event.window.set_mouse_owner(None)
        event.handled = True
        return

# EOF


text:
<?php
class UserManager{
//attributes
    private $_db;

    //constructor
    public function __construct($db){
        $this->_db = $db;
    }

    //CRUD operations
    public function add(User $user){
        $query = $this->_db->prepare('INSERT INTO t_user (login, password, created, profil, status)
                                VALUES (:login, :password, :created, :profil, :status)') or die(print_r($this->_db->errorInfo()));
        $query->bindValue(':login', $user->login());
        $query->bindValue(':password', $user->password());
        $query->bindValue(':created', $user->created());
        $query->bindValue(':profil', $user->profil());
		$query->bindValue(':status', $user->status());
        $query->execute();
        $query->closeCursor();
    }

	public function delete($idUser){
		$query = $this->_db->prepare('DELETE FROM t_user WHERE id=:idUser');
		$query->bindValue(':idUser', $idUser);
		$query->execute();
		$query->closeCursor();
	}

	public function changeStatus($status, $idUser){
		$query = $this->_db->prepare('UPDATE t_user SET status=:status WHERE id=:idUser');
		$query->bindValue(':status', $status);
		$query->bindValue(':idUser', $idUser);
		$query->execute();
		$query->closeCursor();
	}

	public function updateProfil($idUser, $profil){
		$query = $this->_db->prepare('UPDATE t_user SET profil=:profil WHERE id=:idUser');
		$query->bindValue(':profil', $profil);
		$query->bindValue(':idUser', $idUser);
		$query->execute();
		$query->closeCursor();
	}

    public function getUsersNumber(){
        $query = $this->_db->query('SELECT COUNT(*) AS userNumbers FROM t_user');
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return $data['userNumbers'];
    }

    public function getStatus($login){
    	$query = $this->_db->prepare('SELECT status FROM t_user WHERE login=:login');
        $query->execute(array(':login' => $login));
		$data = $query->fetch(PDO::FETCH_ASSOC);
		$query->closeCursor();
        //get result
        return $data['status'];
    }

	public function getStatusById($idUser){
    	$query = $this->_db->prepare('SELECT status FROM t_user WHERE id=:idUser');
        $query->execute(array(':idUser' => $idUser));
		$data = $query->fetch(PDO::FETCH_ASSOC);
		$query->closeCursor();
        //get result
        return $data['status'];
    }

    public function getUsers(){
        $patients = array();
        $query = $this->_db->query('SELECT * FROM t_user ORDER BY created DESC');
        //get result
        while($data = $query->fetch(PDO::FETCH_ASSOC)){
            $users[] = new User($data);
        }
        $query->closeCursor();
        return $users;
    }

	public function changePassword($newPassword, $idUser){
		$query = $this->_db->prepare('UPDATE t_user SET password =:newPassword
		WHERE id=:idUser') or die(print_r($this->_db->errorInfo()));;
        $query->bindValue(':newPassword', $newPassword);
        $query->bindValue(':idUser', $idUser);
        $query->execute();
        $query->closeCursor();
	}

    public function exists($login, $password){
        $query = $this->_db->prepare('SELECT COUNT(*) FROM t_user WHERE login=:login AND password=:password');
        $query->execute(array(':login' => $login, ':password' => $password));
        //get result
        return (bool) $query->fetchColumn();
    }

	public function exists2($login){
        $query = $this->_db->prepare('SELECT COUNT(*) FROM t_user WHERE login=:login');
        $query->execute(array(':login' => $login));
        //get result
        return (bool) $query->fetchColumn();
    }

    public function getUserByLoginPassword($login, $password){
        $query = $this->_db->prepare('SELECT * FROM t_user WHERE login =:login AND password =:password');
        $query->bindValue(':login', $login);
        $query->bindValue(':password', $password);
        $query->execute();
        $data = $query->fetch(PDO::FETCH_ASSOC);
        $query->closeCursor();
        return new User($data);
    }

}


text:
package handler

import (
	"fmt"

	"k8s.io/apimachinery/pkg/api/meta"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/client-go/util/workqueue"
	"sigs.k8s.io/controller-runtime/pkg/event"
	logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
	"sigs.k8s.io/controller-runtime/pkg/reconcile"
	"sigs.k8s.io/controller-runtime/pkg/runtime/inject"
)

var _ EventHandler = &EnqueueRequestForOwner{}

var log = logf.RuntimeLog.WithName("eventhandler").WithName("EnqueueRequestForOwner")

// EnqueueRequestForOwner enqueues Requests for the Owners of an object.  E.g. the object that created
// the object that was the source of the Event.
//
// If a ReplicaSet creates Pods, users may reconcile the ReplicaSet in response to Pod Events using:
//
// - a source.Kind Source with Type of Pod.
//
// - a handler.EnqueueRequestForOwner EventHandler with an OwnerType of ReplicaSet and IsController set to true.
type EnqueueRequestForOwner struct {
	// OwnerType is the type of the Owner object to look for in OwnerReferences.  Only Group and Kind are compared.
	OwnerType runtime.Object

	// IsController if set will only look at the first OwnerReference with Controller: true.
	IsController bool

	// groupKind is the cached Group and Kind from OwnerType
	groupKind schema.GroupKind

	// mapper maps GroupVersionKinds to Resources
	mapper meta.RESTMapper
}

// Create implements EventHandler
func (e *EnqueueRequestForOwner) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface) {
	for _, req := range e.getOwnerReconcileRequest(evt.Object) {
		q.Add(req)
	}
}

// Update implements EventHandler
func (e *EnqueueRequestForOwner) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
	for _, req := range e.getOwnerReconcileRequest(evt.ObjectOld) {
		q.Add(req)
	}
	for _, req := range e.getOwnerReconcileRequest(evt.ObjectNew) {
		q.Add(req)
	}
}

// Delete implements EventHandler
func (e *EnqueueRequestForOwner) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface) {
	for _, req := range e.getOwnerReconcileRequest(evt.Object) {
		q.Add(req)
	}
}

// Generic implements EventHandler
func (e *EnqueueRequestForOwner) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface) {
	for _, req := range e.getOwnerReconcileRequest(evt.Object) {
		q.Add(req)
	}
}

// parseOwnerTypeGroupKind parses the OwnerType into a Group and Kind and caches the result.  Returns false
// if the OwnerType could not be parsed using the scheme.
func (e *EnqueueRequestForOwner) parseOwnerTypeGroupKind(scheme *runtime.Scheme) error {
	// Get the kinds of the type
	kinds, _, err := scheme.ObjectKinds(e.OwnerType)
	if err != nil {
		log.Error(err, "Could not get ObjectKinds for OwnerType", "owner type", fmt.Sprintf("%T", e.OwnerType))
		return err
	}
	// Expect only 1 kind.  If there is more than one kind this is probably an edge case such as ListOptions.
	if len(kinds) != 1 {
		err := fmt.Errorf("Expected exactly 1 kind for OwnerType %T, but found %s kinds", e.OwnerType, kinds)
		log.Error(nil, "Expected exactly 1 kind for OwnerType", "owner type", fmt.Sprintf("%T", e.OwnerType), "kinds", kinds)
		return err

	}
	// Cache the Group and Kind for the OwnerType
	e.groupKind = schema.GroupKind{Group: kinds[0].Group, Kind: kinds[0].Kind}
	return nil
}

// getOwnerReconcileRequest looks at object and returns a slice of reconcile.Request to reconcile
// owners of object that match e.OwnerType.
func (e *EnqueueRequestForOwner) getOwnerReconcileRequest(object metav1.Object) []reconcile.Request {
	// Iterate through the OwnerReferences looking for a match on Group and Kind against what was requested
	// by the user
	var result []reconcile.Request
	for _, ref := range e.getOwnersReferences(object) {
		// Parse the Group out of the OwnerReference to compare it to what was parsed out of the requested OwnerType
		refGV, err := schema.ParseGroupVersion(ref.APIVersion)
		if err != nil {
			log.Error(err, "Could not parse OwnerReference APIVersion",
				"api version", ref.APIVersion)
			return nil
		}

		// Compare the OwnerReference Group and Kind against the OwnerType Group and Kind specified by the user.
		// If the two match, create a Request for the objected referred to by
		// the OwnerReference.  Use the Name from the OwnerReference and the Namespace from the
		// object in the event.
		if ref.Kind == e.groupKind.Kind && refGV.Group == e.groupKind.Group {
			// Match found - add a Request for the object referred to in the OwnerReference
			request := reconcile.Request{NamespacedName: types.NamespacedName{
				Name: ref.Name,
			}}

			// if owner is not namespaced then we should set the namespace to the empty
			mapping, err := e.mapper.RESTMapping(e.groupKind, refGV.Version)
			if err != nil {
				log.Error(err, "Could not retrieve rest mapping", "kind", e.groupKind)
				return nil
			}
			if mapping.Scope.Name() != meta.RESTScopeNameRoot {
				request.Namespace = object.GetNamespace()
			}

			result = append(result, request)
		}
	}

	// Return the matches
	return result
}

// getOwnersReferences returns the OwnerReferences for an object as specified by the EnqueueRequestForOwner
// - if IsController is true: only take the Controller OwnerReference (if found)
// - if IsController is false: take all OwnerReferences
func (e *EnqueueRequestForOwner) getOwnersReferences(object metav1.Object) []metav1.OwnerReference {
	if object == nil {
		return nil
	}

	// If not filtered as Controller only, then use all the OwnerReferences
	if !e.IsController {
		return object.GetOwnerReferences()
	}
	// If filtered to a Controller, only take the Controller OwnerReference
	if ownerRef := metav1.GetControllerOf(object); ownerRef != nil {
		return []metav1.OwnerReference{*ownerRef}
	}
	// No Controller OwnerReference found
	return nil
}

var _ inject.Scheme = &EnqueueRequestForOwner{}

// InjectScheme is called by the Controller to provide a singleton scheme to the EnqueueRequestForOwner.
func (e *EnqueueRequestForOwner) InjectScheme(s *runtime.Scheme) error {
	return e.parseOwnerTypeGroupKind(s)
}

var _ inject.Mapper = &EnqueueRequestForOwner{}

// InjectMapper  is called by the Controller to provide the rest mapper used by the manager.
func (e *EnqueueRequestForOwner) InjectMapper(m meta.RESTMapper) error {
	e.mapper = m
	return nil
}


text:
<?php

class Learning_Controller extends Base_Kakadu_Controller {

    /**
     * Shows the learning view for a course with the first question
     */
    public function get_course($id) {

        //Get course
        $this->course = Course::find($id);

        if($this->course === null) {
            return Response::error('404');
        }

        //Check permissions
        $permission = $this->checkPermissions(Const_Action::LEARN);

        if($permission !== Const_Permission::ALLOWED) {
            return View::make('general.permission');
        }

        //Check favorites
        $userSentry = Sentry::user();
        $catalog = $this->course->catalog()->first();
        if(!Helper_Favorite::isCatalogFavoriteOfUser($catalog, $userSentry)) {
            return View::make('general.permission');
        }

        //Get all catalogs
        $catalogs = Helper_Course::getSubCatalogIDsOfCatalog($catalog);

        //Create view
        $this->layout->content = $this->getLearningView('course', $catalogs);
    }

    /**
     * Shows the learning view for a catalog with the first question
     */
    public function get_catalog($id) {

        //Get catalog
        $catalog = Catalog::find($id);

        if($catalog === null) {
            return Response::error('404');
        }

        //Get course
        $this->course = Helper_Course::getCourseOfCatalog($catalog);

        //Check permissions
        $permission = $this->checkPermissions(Const_Action::LEARN);

        if($permission !== Const_Permission::ALLOWED) {
            return View::make('general.permission');
        }

        //Check favorites
        $userSentry = Sentry::user();
        if(!Helper_Favorite::isCatalogFavoriteOfUser($catalog, $userSentry)) {
            if(!Helper_Favorite::isParentCatalogFavoriteOfUser($catalog, $userSentry)) {
                return View::make('general.permission');
            }
        }

        //Get all catalogs
        $catalogs = Helper_Course::getSubCatalogIDsOfCatalog($catalog);

        //Create view
        $this->layout->content = $this->getLearningView('catalog', $catalogs);
    }

    /**
     * Shows the learning view for all favorites
     */
    public function get_favorites() {

        //Check permissions
        $permission = $this->checkPermissions(Const_Action::LEARN);

        if($permission !== Const_Permission::ALLOWED) {
            return View::make('general.permission');
        }

        //Get user
        $user = User::find($this->user['id']);

        //Get favorite catalogs
        $catalogs = array();

        foreach ($user->favorites()->get() as $favorite) {
            $fav = Helper_Course::getSubCatalogIDsOfCatalog($favorite);
            $catalogs = array_merge($catalogs, $fav);
            $catalogs = array_unique($catalogs);
        }

        //Create view
        $this->layout->content = $this->getLearningView('favorites', $catalogs);
    }

    /**
     * Saves the answer of the last question and returns the next question as a JSON response
     */
    public function post_next() {

        //Validate input
        $rules = array(
            'question'          => 'required|integer',
            'course'            => 'integer',
            'catalog'           => 'integer',
            'answer'            => 'required|in:true,false',
            'section'           => 'required|in:course,catalog,favorites',
        );

        $validation = Validator::make(Input::all(), $rules);

        if ($validation->fails()) {
            $errors = $validation->errors->all();
            return $this->getJsonErrorResponse($errors);
        }

        //Get question
        $question = Question::find(Input::get('question'));

        if($question === null) {
            return $this->getJsonErrorResponse(array(__('question.question_not_found')));
        }

        //Get catalog and course
        $section = Input::get('section');

        if($section === 'course') {
            $course = Course::find(Input::get('course'));

            if($course === null) {
                return $this->getJsonErrorResponse(array(__('question.course_not_found')));
            }

            $catalog = $course->catalog()->first();
            $check = Helper_Course::isQuestionPartOfCatalog($question, $catalog);

            if($check === false) {
                return $this->getJsonErrorResponse(array(__('question.catalog_not_valid')));
            }

        } else if($section === 'catalog') {
            $catalog = Catalog::find(Input::get('catalog'));

            if($catalog === null) {
                return $this->getJsonErrorResponse(array(__('question.catalog_not_found')));
            }

            $check = Helper_Course::isQuestionPartOfCatalog($question, $catalog);

            if($check === false) {
                return $this->getJsonErrorResponse(array(__('question.catalog_not_valid')));
            }

            $this->course = Helper_Course::getCourseOfCatalog($catalog);
        }

        //Check permissions
        $permission = $this->checkPermissions(Const_Action::LEARN);

        if($permission !== Const_Permission::ALLOWED) {
            return $this->getJsonErrorResponse(array(__('general.permission_denied')));
        }

        //Check favorites
        $userSentry = Sentry::user();

        if($section === 'course' || $section === 'catalog') {
            if(!Helper_Favorite::isCatalogFavoriteOfUser($catalog, $userSentry)) {
                if($section === 'course' || !Helper_Favorite::isParentCatalogFavoriteOfUser($catalog, $userSentry)) {
                    return $this->getJsonErrorResponse(array(__('general.permission_denied')));
                }
            }
        }

        //Get all catalogs
        if($section === 'course' || $section === 'catalog') {
            $catalogs = Helper_Course::getSubCatalogIDsOfCatalog($catalog);

        } else if($section === 'favorites') {
            $user = User::find($this->user['id']);

            $catalogs = array();
            foreach ($user->favorites()->get() as $favorite) {
                $fav = Helper_Course::getSubCatalogIDsOfCatalog($favorite);
                $catalogs = array_merge($catalogs, $fav);
                $catalogs = array_unique($catalogs);
            }

            if(count($catalogs) <= 0) {
                return $this->getJsonErrorResponse(array(__('question.no_question_found')));
            }
        }

        //Save the answer of the last question
        Helper_Flashcard::saveFlashcard($userSentry, $question, Input::get('answer'), $catalogs);

        //Get a new question
        $data = Helper_Flashcard::getNextQuestion($userSentry, $catalogs);

        if($data === false) {
            return $this->getJsonErrorResponse(array(__('question.no_question_found')));
        }

        $question = $data['question'];
        $questionType = QuestionType::getQuestionFromQuestion($question);

        $catalog = $data['catalog'];
        $course = Helper_Course::getCourseOfCatalog($catalog);

        $response = array(
            'status'    => 'Ok',
            'catalog'   => $catalog->id,
            'course'    => $course->id
        );

        $response = array_merge($response, $questionType->getViewElement());

        return Response::json($response);
    }

    /**
     * Gets the learning view with the first question
     * @param  array $catalogs An array with all valid catalogs
     * @return View            The learning view with the first question
     */
    private function getLearningView($section, $catalogs) {
        //Get the next question
        $data = Helper_Flashcard::getNextQuestion(Sentry::user(), $catalogs);

        //Create view
        $view = View::make('learning.question');

        //No questions found
        if($data === false) {
            $view->error = array(__('question.no_question_found'));
            return $view;
        }

        $question = $data['question'];
        $questionType = QuestionType::getQuestionFromQuestion($question);

        $catalog = $data['catalog'];
        $course = Helper_Course::getCourseOfCatalog($catalog);

        $view->section = $section;
        $view->question = $questionType->getViewElement();
        $view->catalog = $this->getCatalogArray($catalog);
        $view->course = $this->getCourseArray($course);

        return $view;
    }

}


text:
package org.powermock.api.mockito.internal.invocation;

import org.mockito.Mockito;
import org.mockito.exceptions.base.MockitoAssertionError;
import org.mockito.stubbing.OngoingStubbing;
import org.mockito.verification.VerificationMode;
import org.powermock.core.MockRepository;
import org.powermock.core.spi.NewInvocationControl;
import org.powermock.core.spi.support.InvocationSubstitute;
import org.powermock.reflect.internal.WhiteboxImpl;

import java.lang.reflect.Array;
import java.lang.reflect.Constructor;

import static org.mockito.Mockito.times;

public class MockitoNewInvocationControl<T> implements NewInvocationControl<OngoingStubbing<T>> {
	private final InvocationSubstitute<T> substitute;

	public MockitoNewInvocationControl(InvocationSubstitute<T> substitute) {
		if (substitute == null) {
			throw new IllegalArgumentException("Internal error: substitute cannot be null.");
		}
		this.substitute = substitute;
	}

	public Object invoke(Class<?> type, Object[] args, Class<?>[] sig) throws Exception {
		Constructor<?> constructor = WhiteboxImpl.getConstructor(type, sig);
		if (constructor.isVarArgs()) {
			Object varArgs =  args[args.length - 1];
            final int varArgsLength = Array.getLength(varArgs);
            Object[] oldArgs = args;
            args = new Object[args.length + varArgsLength - 1];
            System.arraycopy(oldArgs, 0, args, 0, oldArgs.length - 1);
            for (int i = oldArgs.length - 1, j=0; i < args.length; i++, j++) {
                args[i] = Array.get(varArgs, j);
            }
		}
		try {
			return substitute.performSubstitutionLogic(args);
		} catch (MockitoAssertionError e) {
			InvocationControlAssertionError.throwAssertionErrorForNewSubstitutionFailure(e, type);
		}

		// Won't happen
		return null;
	}

	public OngoingStubbing<T> expectSubstitutionLogic(Object... arguments) throws Exception {
		return Mockito.when(substitute.performSubstitutionLogic(arguments));
	}

	public InvocationSubstitute<T> getSubstitute() {
		return substitute;
	}

	/**
	 * {@inheritDoc}
	 */
	public synchronized Object replay(Object... mocks) {
		return null;
	}

	/**
	 * {@inheritDoc}
	 */
	public synchronized Object verify(Object... mocks) {
		final VerificationMode verificationMode;
		Object mode = MockRepository.getAdditionalState("VerificationMode");
		if (mode != null) {
			if (mode instanceof VerificationMode) {
				verificationMode = (VerificationMode) mode;
			} else {
				throw new IllegalStateException("Internal error. VerificationMode in MockRepository was not of type "
						+ VerificationMode.class.getName() + ".");
			}
		} else {
			verificationMode = times(1);
		}
		Mockito.verify(substitute, verificationMode);
		return null;
	}

	/**
	 * {@inheritDoc}
	 */
	@SuppressWarnings("unchecked")
	public synchronized Object reset(Object... mocks) {
		Mockito.<InvocationSubstitute<T>> reset(substitute);
		return null;
	}

	public void verifyNoMoreInteractions() {
		try {
			Mockito.verifyNoMoreInteractions(substitute);
		} catch (MockitoAssertionError e) {
			InvocationControlAssertionError.updateErrorMessageForVerifyNoMoreInteractions(e);
			throw e;
		}
	}
}


text:
FIND_PATH ( MAXMINDDB_INCLUDE_DIR NAMES maxminddb.h PATHS /usr/include /usr/local/include )
FIND_LIBRARY ( MAXMINDDB_LIBRARY NAMES maxminddb PATHS /usr/lib /usr/local/lib )
FIND_FILE ( GEOLITE2_CITY_MMDB NAMES GeoIP/GeoLite2-City.mmdb PATHS /usr/share /usr/local/share )
FIND_FILE ( GEOLITE2_COUNTRY_MMDB NAMES GeoIP/GeoLite2-Country.mmdb PATHS /usr/share /usr/local/share )
FIND_FILE ( GEOLITE2_ASN_MMDB NAMES GeoIP/GeoLite2-ASN.mmdb PATHS /usr/share /usr/local/share )

IF ( MAXMINDDB_INCLUDE_DIR AND MAXMINDDB_LIBRARY )
    SET ( MAXMINDDB_FOUND TRUE )
ENDIF (  )

IF ( GEOLITE2_CITY_MMDB)
    SET ( GEOLITE2_CITY_MMDB_FOUND TRUE )
ENDIF (  )

IF ( GEOLITE2_COUNTRY_MMDB)
    SET ( GEOLITE2_COUNTRY_MMDB_FOUND TRUE )
ENDIF (  )

IF ( GEOLITE2_ASN_MMDB)
    SET ( GEOLITE2_ASN_MMDB_FOUND TRUE )
ENDIF (  )

IF ( MAXMINDDB_FOUND )
    MESSAGE ( STATUS "Found MaxMind DB headers in ${MAXMINDDB_INCLUDE_DIR}" )
    MESSAGE ( STATUS "Found MaxMind DB library: ${MAXMINDDB_LIBRARY}" )
ELSE (  )
    IF ( MAXMINDDB_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find MaxMind DB" )
    ELSE (  )
        MESSAGE ( STATUS "Could not find MaxMind DB" )
    ENDIF (  )
ENDIF (  )

IF ( GEOLITE2_CITY_MMDB )
    MESSAGE ( STATUS "Found GeoLite2-City database: ${GEOLITE2_CITY_MMDB}" )
ELSE (  )
    IF ( GEOLITE2_CITY_MMDB_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find GeoLite2-City database" )
    ELSE (  )
        MESSAGE ( STATUS "Could not find GeoLite2-City database" )
    ENDIF (  )
ENDIF (  )

IF ( GEOLITE2_COUNTRY_MMDB )
    MESSAGE ( STATUS "Found GeoLite2-Country database: ${GEOLITE2_COUNTRY_MMDB}" )
ELSE (  )
    IF ( GEOLITE2_COUNTRY_MMDB_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find GeoLite2-Country database" )
    ELSE (  )
        MESSAGE ( STATUS "Could not find GeoLite2-Country database" )
    ENDIF (  )
ENDIF (  )

IF ( GEOLITE2_ASN_MMDB_FOUND )
    MESSAGE ( STATUS "Found GeoLite2-ASN database: ${GEOLITE2_ASN_MMDB}" )
ELSE (  )
    IF ( GEOLITE2_ASN_MMDB_FIND_REQUIRED )
        MESSAGE ( FATAL_ERROR "Could not find GeoLite2-ASN database" )
    ELSE (  )
        MESSAGE ( STATUS "Could not find GeoLite2-ASN database" )
    ENDIF (  )
ENDIF (  )


text:
<?php

namespace App\Modules\SelmarinelAdmin\Http\Controllers\Auth;

use App\Http\Controllers\Auth\AuthController as Controller;

class AuthController extends Controller
{
    protected $redirectTo = '/admin';

}