text:
package Perl::Critic::Utils::POD;

use 5.006001;
use strict;
use warnings;

use English qw< -no_match_vars >;

use IO::String ();
use Pod::PlainText ();
use Pod::Select ();

# TODO: non-fatal generic?
use Perl::Critic::Exception::Fatal::Generic qw< throw_generic >;
use Perl::Critic::Exception::IO qw< throw_io >;
use Perl::Critic::Utils qw< :characters >;

use base 'Exporter';

our $VERSION = '1.118';

#-----------------------------------------------------------------------------

our @EXPORT_OK = qw(
    get_pod_file_for_module
    get_raw_pod_section_from_file
    get_raw_pod_section_from_filehandle
    get_raw_pod_section_from_string
    get_raw_pod_section_for_module
    get_pod_section_from_file
    get_pod_section_from_filehandle
    get_pod_section_from_string
    get_pod_section_for_module
    trim_raw_pod_section
    trim_pod_section
    get_raw_module_abstract_from_file
    get_raw_module_abstract_from_filehandle
    get_raw_module_abstract_from_string
    get_raw_module_abstract_for_module
    get_module_abstract_from_file
    get_module_abstract_from_filehandle
    get_module_abstract_from_string
    get_module_abstract_for_module
);

our %EXPORT_TAGS = (
    all => \@EXPORT_OK,
);

#-----------------------------------------------------------------------------

sub get_pod_file_for_module {
    my ($module_name) = @_;

    # No File::Spec: %INC always uses forward slashes.
    (my $relative_path = $module_name) =~ s< :: ></>xmsg;
    $relative_path .= '.pm';

    my $absolute_path = $INC{$relative_path} or return;

    (my $pod_path = $absolute_path) =~ s< [.] [^.]+ \z><.pod>xms;
    return $pod_path if -f $pod_path;

    return $absolute_path;
}

#-----------------------------------------------------------------------------

sub get_raw_pod_section_from_file {
    my ($file_name, $section_name) = @_;

    return _get_pod_section_from_file(
        $file_name,
        $section_name,
        Pod::Select->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_raw_pod_section_from_filehandle {
    my ($file_handle, $section_name) = @_;

    return _get_pod_section_from_filehandle(
        $file_handle,
        $section_name,
        Pod::Select->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_raw_pod_section_from_string {
    my ($source, $section_name) = @_;

    return _get_pod_section_from_string(
        $source,
        $section_name,
        Pod::Select->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_raw_pod_section_for_module {
    my ($module_name, $section_name) = @_;

    my $file_name = get_pod_file_for_module($module_name)
        or throw_generic qq<Could not find POD for "$module_name".>;

    return get_raw_pod_section_from_file($file_name, $section_name);
}

#-----------------------------------------------------------------------------

sub get_pod_section_from_file {
    my ($file_name, $section_name) = @_;

    return _get_pod_section_from_file(
        $file_name,
        $section_name,
        Pod::PlainText->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_pod_section_from_filehandle {
    my ($file_handle, $section_name) = @_;

    return _get_pod_section_from_filehandle(
        $file_handle,
        $section_name,
        Pod::PlainText->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_pod_section_from_string {
    my ($source, $section_name) = @_;

    return _get_pod_section_from_string(
        $source,
        $section_name,
        Pod::PlainText->new(),
    );
}

#-----------------------------------------------------------------------------

sub get_pod_section_for_module {
    my ($module_name, $section_name) = @_;

    my $file_name = get_pod_file_for_module($module_name)
        or throw_generic qq<Could not find POD for "$module_name".>;

    return get_pod_section_from_file($file_name, $section_name);
}

#-----------------------------------------------------------------------------

sub _get_pod_section_from_file {
    my ($file_name, $section_name, $parser) = @_;

    open my $file_handle, '<', $file_name
        or throw_io
            message     => qq<Could not open "$file_name": $ERRNO>,
            file_name   => $file_name,
            errno       => $ERRNO;

    my $content =
        _get_pod_section_from_filehandle(
            $file_handle, $section_name, $parser,
        );

    close $file_handle
        or throw_io
            message     => qq<Could not close "$file_name": $ERRNO>,
            file_name   => $file_name,
            errno       => $ERRNO;

    return $content;
}

#-----------------------------------------------------------------------------

sub _get_pod_section_from_filehandle {
    my ($file_handle, $section_name, $parser) = @_;

    $parser->select($section_name);

    my $content = $EMPTY;
    my $content_handle = IO::String->new( \$content );

    $parser->parse_from_filehandle( $file_handle, $content_handle );

    return if $content eq $EMPTY;
    return $content;
}

#-----------------------------------------------------------------------------

sub _get_pod_section_from_string {
    my ($source, $section_name, $parser) = @_;

    my $source_handle = IO::String->new( \$source );

    return
        _get_pod_section_from_filehandle(
            $source_handle, $section_name, $parser,
        );
}

#-----------------------------------------------------------------------------

sub trim_raw_pod_section {
    my ($pod) = @_;

    return if not defined $pod;

    $pod =~ s< \A =head1 \b [^\n]* \n $ ><>xms;
    $pod =~ s< \A \s+ ><>xms;
    $pod =~ s< \s+ \z ><>xms;

    return $pod;
}

#-----------------------------------------------------------------------------

sub trim_pod_section {
    my ($pod) = @_;

    return if not defined $pod;

    $pod =~ s< \A [^\n]* \n ><>xms;
    $pod =~ s< \A \s* \n ><>xms;
    $pod =~ s< \s+ \z ><>xms;

    return $pod;
}

#-----------------------------------------------------------------------------

sub get_raw_module_abstract_from_file {
    my ($file_name) = @_;

    return
        _get_module_abstract_from_file(
            $file_name,
            Pod::Select->new(),
            \&trim_raw_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_raw_module_abstract_from_filehandle {
    my ($file_handle) = @_;

    return
        _get_module_abstract_from_filehandle(
            $file_handle,
            Pod::Select->new(),
            \&trim_raw_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_raw_module_abstract_from_string {
    my ($source) = @_;

    return
        _get_module_abstract_from_string(
            $source,
            Pod::Select->new(),
            \&trim_raw_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_raw_module_abstract_for_module {
    my ($module_name) = @_;

    my $file_name = get_pod_file_for_module($module_name)
        or throw_generic qq<Could not find POD for "$module_name".>;

    return get_raw_module_abstract_from_file($file_name);
}

#-----------------------------------------------------------------------------

sub get_module_abstract_from_file {
    my ($file_name) = @_;

    return
        _get_module_abstract_from_file(
            $file_name,
            Pod::PlainText->new(),
            \&trim_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_module_abstract_from_filehandle {
    my ($file_handle) = @_;

    return
        _get_module_abstract_from_filehandle(
            $file_handle,
            Pod::PlainText->new(),
            \&trim_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_module_abstract_from_string {
    my ($source) = @_;

    return
        _get_module_abstract_from_string(
            $source,
            Pod::PlainText->new(),
            \&trim_pod_section,
        );
}

#-----------------------------------------------------------------------------

sub get_module_abstract_for_module {
    my ($module_name) = @_;

    my $file_name = get_pod_file_for_module($module_name)
        or throw_generic qq<Could not find POD for "$module_name".>;

    return get_module_abstract_from_file($file_name);
}

#-----------------------------------------------------------------------------

sub _get_module_abstract_from_file {
    my ($file_name, $parser, $trimmer) = @_;

    open my $file_handle, '<', $file_name
        or throw_io
            message     => qq<Could not open "$file_name": $ERRNO>,
            file_name   => $file_name,
            errno       => $ERRNO;

    my $module_abstract =
        _get_module_abstract_from_filehandle(
            $file_handle, $parser, $trimmer,
        );

    close $file_handle
        or throw_io
            message     => qq<Could not close "$file_name": $ERRNO>,
            file_name   => $file_name,
            errno       => $ERRNO;

    return $module_abstract;
}

#-----------------------------------------------------------------------------

sub _get_module_abstract_from_filehandle { ## no critic (RequireFinalReturn)
    my ($file_handle, $parser, $trimmer) = @_;

    my $name_section =
        _get_pod_section_from_filehandle( $file_handle, 'NAME', $parser );
    return if not $name_section;

    $name_section = $trimmer->($name_section);
    return if not $name_section;

    # Testing for parser class, blech.  But it's a lot simpler and it's all
    # hidden in the implementation.
    if ('Pod::Select' eq ref $parser) {
        if ( $name_section =~ m< \n >xms ) {
            throw_generic
                qq<Malformed NAME section in "$name_section". >
                . q<It must be on a single line>;
        }
    }
    else {
        $name_section =~ s< \s+ >< >xmsg;

        # Ugh.  Pod::PlainText splits up module names.
        if (
            $name_section =~ m<
                \A
                \s*
                (
                    \w [ \w:]+ \w
                )
                (
                    \s*
                    -
                    .*
                )?
                \z
            >xms
        ) {
            my ($module_name, $rest) = ($1, $2);

            $module_name =~ s/ [ ] //xms;

            $name_section = $module_name . ( $rest ? $rest : $EMPTY );
        }
    }

    if (
        $name_section =~ m<
            \A
            \s*
            [\w:]+              # Module name.
            \s+
            -                   # The required single hyphen.
            \s+
            (
                \S              # At least one non-whitespace.
                (?: .* \S)?     # Everything up to the last non-whitespace.
            )
            \s*
            \z
        >xms
    ) {
        my $module_abstract = $1;
        return $module_abstract;
    }

    if (
        $name_section =~ m<
            \A
            \s*
            [\w:]+              # Module name.
            (?: \s* - )?        # The single hyphen is now optional.
            \s*
            \z
        >xms
    ) {
        return;
    }

    throw_generic qq<Malformed NAME section in "$name_section".>;
}

#-----------------------------------------------------------------------------

sub _get_module_abstract_from_string {
    my ($source, $parser, $trimmer) = @_;

    my $source_handle = IO::String->new( \$source );

    return
        _get_module_abstract_from_filehandle(
            $source_handle, $parser, $trimmer,
        );
}

#-----------------------------------------------------------------------------

1;

__END__

#-----------------------------------------------------------------------------

=pod

=for stopwords

=head1 NAME

Perl::Critic::Utils::POD - Utility functions for dealing with POD.

=head1 SYNOPSIS

    use Perl::Critic::Utils::POD qw< get_pod_section_from_file >;

    my $synopsis =
        get_pod_section_from_file('Perl/Critic/Utils/POD.pm', 'SYNOPSIS');

    my $see_also =
        get_pod_section_from_filehandle($file_handle, 'SEE ALSO');

    my $see_also_content = trim_pod_section($see_also);

    # "Utility functions for dealing with POD."
    my $module_abstract =
        get_module_abstract_from_file('Perl/Critic/Utils/POD.pm');

    my $module_abstract =
        get_module_abstract_from_filehandle($file_handle);

=head1 DESCRIPTION

Provides means of accessing chunks of POD.

=head1 INTERFACE SUPPORT

This is considered to be a public module.  Any changes to its
interface will go through a deprecation cycle.

=head1 IMPORTABLE SUBROUTINES

=over

=item C<get_pod_file_for_module( $module_name )>

Figure out where to find the POD for the parameter.

This depends upon the module already being loaded; it will not find
the path for arbitrary modules.

If there is a file with a ".pod" extension next to the real module
location, it will be returned in preference to the actual module.

=item C<get_raw_pod_section_from_file( $file_name, $section_name )>

Retrieves the specified section of POD (i.e. something marked by
C<=head1>) from the file.  This is uninterpreted; escapes are not
processed and any sub-sections will be present.  E.g. if the content
contains "CZ<><$x>", the return value will contain "CZ<><$x>".

Returns nothing if no such section is found.

Throws a L<Perl::Critic::Exception::IO|Perl::Critic::Exception::IO> if
there's a problem with the file.

=item C<get_raw_pod_section_from_filehandle( $file_handle, $section_name )>

Does the same as C<get_raw_pod_section_from_file()>, but with a file
handle.

=item C<get_raw_pod_section_from_string( $source, $section_name )>

Does the same as C<get_raw_pod_section_from_file()>, but with a string
that contains the raw POD.

=item C<get_raw_pod_section_for_module( $module_name, $section_name )>

Does the same as C<get_raw_pod_section_from_file()>, but with a module
name.

Throws a
L<Perl::Critic::Exception::Generic|Perl::Critic::Exception::Generic>
if a file containing POD for the module can't be found.

=item C<get_pod_section_from_file( $file_name, $section_name )>

Retrieves the specified section of POD (i.e. something marked by
C<=head1>) from the file.  This is interpreted into plain text.

Returns nothing if no such section is found.

Throws a L<Perl::Critic::Exception::IO|Perl::Critic::Exception::IO> if
there's a problem with the file.

=item C<get_pod_section_from_filehandle( $file_handle, $section_name )>

Does the same as C<get_pod_section_from_file()>, but with a file
handle.

=item C<get_pod_section_from_string( $source, $section_name )>

Does the same as C<get_pod_section_from_file()>, but with a string
that contains the raw POD.

=item C<get_pod_section_for_module( $module_name, $section_name )>

Does the same as C<get_pod_section_from_file()>, but with a module
name.

Throws a
L<Perl::Critic::Exception::Generic|Perl::Critic::Exception::Generic>
if a file containing POD for the module can't be found.

=item C<trim_raw_pod_section( $pod_section )>

Returns a copy of the parameter, with any starting C<=item1 BLAH>
removed and all leading and trailing whitespace (including newlines)
removed after that.

For example, using one of the C<get_raw_pod_section_from_*> functions
to get the "NAME" section of this module and then calling
C<trim_raw_pod_section()> on the result would give you
"Perl::Critic::Utils::POD - Utility functions for dealing with POD.".

=item C<trim_pod_section( $pod_section )>

Returns a copy of the parameter, with any starting line removed and
leading blank lines and trailing whitespace (including newlines)
removed after that.  Note that only leading whitespace on the first
real line of the section will remain.

Since this cannot count upon a C<=item1> marker, this is much less
reliable than C<trim_raw_pod_section()>.

=item C<get_raw_module_abstract_from_file( $file_name )>

Attempts to parse the "NAME" section of the specified file and get the
abstract of the module from that.  If it succeeds, it returns the
abstract.  If it fails, either because there is no "NAME" section or
there is no abstract after the module name, returns nothing.  If it
looks like there's a malformed abstract, throws a
L<Perl::Critic::Exception::Fatal::Generic|Perl::Critic::Exception::Fatal::Generic>.

Example "well formed" "NAME" sections without abstracts:

    Some::Module

    Some::Other::Module -

Example "NAME" sections that will result in an exception:

    Some::Bad::Module This has no hyphen.

    Some::Mean::Module -- This has double hyphens.

    Some::Nasty::Module - This one attempts to
    span multiple lines.

=item C<get_raw_module_abstract_from_filehandle( $file_handle )>

Does the same as C<get_raw_module_abstract_from_file()>, but with a
file handle.

=item C<get_raw_module_abstract_from_string( $source )>

Does the same as C<get_raw_module_abstract_from_file()>, but with a
string that contains the raw POD.

=item C<get_raw_module_abstract_for_module( $module_name )>

Does the same as C<get_raw_module_abstract_from_file()>, but for a
module name.

=item C<get_module_abstract_from_file( $file_name )>

Does the same as C<get_raw_module_abstract_from_file()>, but with
escapes interpreted.

=item C<get_module_abstract_from_filehandle( $file_handle )>

Does the same as C<get_module_abstract_from_file()>, but with a file
handle.

=item C<get_module_abstract_from_string( $source )>

Does the same as C<get_module_abstract_from_file()>, but with a string
that contains the raw POD.

=item C<get_module_abstract_for_module( $module_name )>

Does the same as C<get_module_abstract_from_file()>, but for a module
name.

=back

=head1 AUTHOR

Elliot Shank <perl@galumph.com>

=head1 COPYRIGHT

Copyright (c) 2008-2011 Elliot Shank.

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  The full text of this license
can be found in the LICENSE file included with this module.

=cut

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :


text:
package com.semmle.js.ast.regexp;

import com.semmle.js.ast.SourceLocation;

/** A non-word boundary assertion <code>\B</code>. */
public class NonWordBoundary extends RegExpTerm {
  public NonWordBoundary(SourceLocation loc) {
    super(loc, "NonWordBoundary");
  }

  @Override
  public void accept(Visitor v) {
    v.visit(this);
  }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using Abp.Castle.Logging.Log4Net;
using Abp.Web;
using Castle.Facilities.Logging;

namespace YoYoCms.AbpProjectTemplate.WebApp
{
    public class WebApiApplication : AbpWebApplication<AbpProjectTemplateWebAppModule>
    {
        protected override void Application_Start(object sender, EventArgs e)
        {
            //Use UTC clock. Remove this to use local time for your application.

            //Log4Net configuration
            AbpBootstrapper.IocManager.IocContainer
                .AddFacility<LoggingFacility>(f => f.UseAbpLog4Net()
                    .WithConfig("log4net.config")
                );

            base.Application_Start(sender, e);
        }

    }
}


text:
from setuptools import setup
setup(
    name='dst',
    version='0.1.5',
    author='Jeroen Janssens',
    author_email='jeroen@jeroenjanssens.com',
    packages=['dst'],
    url='http://datasciencetoolbox.org',
    license='BSD',
    description='Data Science Toolbox -- Start doing data science in minutes.',
    long_description=open('README.txt').read(),
    install_requires=[
        "ansible >= 1.5",
    ],
    entry_points={
        'console_scripts': ['dst = dst.dst:main']
    },
    classifiers=[ # https://pypi.python.org/pypi?:action=list_classifiers
        'Development Status :: 3 - Alpha',
        'Environment :: Console',
        'Intended Audience :: Science/Research',
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Intended Audience :: End Users/Desktop',
        'License :: OSI Approved :: BSD License',
        'Operating System :: POSIX :: Linux',
        'Topic :: Scientific/Engineering',
        'Topic :: Utilities',
        'Topic :: System :: Software Distribution',
        'Topic :: System :: Systems Administration',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Unix Shell',
    ],
)


text:
<?php
namespace Shop\Controller;

class UserController extends \Zend\Mvc\Controller\AbstractActionController {

    public function indexAction() {
        $aResponse = array(
            'datagrid' => array(),
            'columnDefs' => array(
                array('field' => "u_id", 'displayName' => "ID", 'width' => 50),
                array('field' => "u_session", 'displayName' => "Session", 'width' => 250),
                array('field' => "u_last_login", 'displayName' => "Last Loged In", 'width' => 100),
                array('field' => "u_email", 'displayName' => "EMail", 'width' => 150),
                array('field' => "u_status", 'displayName' => "Status", 'width' => 50),
                array('field' => "u_basket", 'displayName' => "Basket", 'width' => 70),
                array('field' => "u_customer", 'displayName' => "Customer", 'width' => 100),

            )
        );

        $oUserTable = $this->getServiceLocator()->get('Datainterface\Model\TableInterface')->getTableInterface('IPYME_FINAL','USER');
        $aResult = $oUserTable->fetchAll();

        foreach($aResult['resultset'] as $oUser) {
            $aResponse['datagrid'][] = $oUser;
        }

        return new \Zend\View\Model\JsonModel($aResponse);

        $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');
        $oResultSet = $oDataFunctionGateway->getDataRecordSet('IPYME_FINAL', 'get_customer', array(':id' => null));

        foreach($oResultSet as $aRow) {
            $aResponse['datagrid'][] = $aRow;
        }

        return new \Zend\View\Model\JsonModel($aResponse);
    }

    public function SaveAction(){
        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);

            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');
            $oResultSet = $oDataFunctionGateway->getDataRecordSet('IPYME_FINAL', 'set_customer'
                    , array( ':p_c_id'              => array_key_exists('c_id',$aRequest)?$aRequest['c_id']:null
                            ,':p_c_customer_name'   => $aRequest['c_customer_name']
                            ,':p_ie_id'             => array_key_exists('ie_id',$aRequest)?$aRequest['ie_id']:null
                            ,':p_ie_legal_id'       => $aRequest['ie_legal_id']
                            ,':p_ie_invoice_name'   => $aRequest['ie_invoice_name']));

            $aResultSet = $oResultSet->current();
            $bSuccess = $aResultSet['success'];
        }
        else {
            $bSuccess=false;
        }

        return new \Zend\View\Model\JsonModel(array('success' => ($bSuccess?1:0)));
    }

    public function DeleteAction(){
        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);;
            $oTableController = $this->getServiceLocator()->get('Datainterface\Model\TableInterface');
            $bSuccess = $oTableController->delete('Datainterface\Model\CustomerTable','p_id',$aRequest);
        }
        else {
            $bSuccess = false;
        }

        return new \Zend\View\Model\JsonModel(array('success' => ($bSuccess?1:0)));
    }

    public function getAction(){
//        $this->getRequest()->setContent('{}');
//        $this->getRequest()->getHeaders()->addHeaderLine('X_REQUESTED_WITH','XMLHttpRequest');

        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);
            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');

            $aUser = $this->getServiceLocator()->get('User\Model\UserCredentials')->getUserDetails();

            $oResultSet = $oDataFunctionGateway->getDataRecordSet(
                    'IPYME_FINAL',
                    'get_user_details',
                    array(':p_u_session' => session_id()));

            if ($oResultSet->count() > 0){
                 foreach($oResultSet as $aRow) {
                    if (empty($aUserDetails)) {
                        $aUserDetails['user_u_id']                      = $aRow['user_u_id'];
                        $aUserDetails['user_u_last_login']              = $aRow['user_u_last_login'];
                        $aUserDetails['user_u_email']                   = $aRow['user_u_email'];
                        $aUserDetails['invoice_entity_ie_id']           = $aRow['invoice_entity_ie_id'];
                        $aUserDetails['invoice_entity_ie_invoice_name'] = $aRow['invoice_entity_ie_invoice_name'];
                        $aUserDetails['card']      = array();
                        $aUserDetails['addresses'] = array();
                        $aUserDetails['people']    = array();
                    }

                    if (!is_null($aRow['card_c_id']) && !array_key_exists($aRow['card_c_id'], $aUserDetails['card'])){
                        $aUserDetails['card'][$aRow['card_c_id']] = array(
                            'card_c_id'             => $aRow['card_c_id'],
                            'card_c_description'    => $aRow['card_c_description'],
                            'card_c_card_number'    => $aRow['card_c_card_number'],
                            'card_c_name'           => $aRow['card_c_name'],
                            'card_c_expire_date'    => $aRow['card_c_expire_date'],
                            'card_c_issue_numer'    => $aRow['card_c_issue_numer'],
                            'card_c_vendor'         => $aRow['card_c_vendor'],
                            'card_vendor_cv_name'   => $aRow['card_vendor_cv_name'],);
                    }
                    if (!is_null($aRow['address_detail_ad_id']) && !array_key_exists($aRow['address_detail_ad_id'], $aUserDetails['addresses'])){
                        $aUserDetails['addresses'][$aRow['address_detail_ad_id']] = array(
                            'address_detail_ad_description' => $aRow['address_detail_ad_description'],
                            'address_detail_ad_id'          => $aRow['address_detail_ad_id'],
                            'address_detail_ad_line1'       => $aRow['address_detail_ad_line1'],
                            'address_detail_ad_line2'       => $aRow['address_detail_ad_line2'],
                            'address_detail_ad_town'        => $aRow['address_detail_ad_town'],
                            'address_detail_ad_post_code'   => $aRow['address_detail_ad_post_code'],
                            'address_detail_ad_country'     => array('country_c_id'     => $aRow['country_c_id'],
                                                                    'country_c_name'    => $aRow['country_c_name'],
                                                                    'country_c_code'    => $aRow['country_c_code'],)

                        );
                    }

                    if (!is_null($aRow['people_p_id']) && !array_key_exists($aRow['people_p_id'], $aUserDetails['people'])){
                        $aUserDetails['people'][$aRow['people_p_id']] = array(
                            'people_p_id'       => $aRow['people_p_id'],
                            'people_p_title'    => $aRow['people_p_title'],
                            'people_p_name'     => $aRow['people_p_name'],
                            'people_p_surname'  => $aRow['people_p_surname'],
                            'people_p_phone'    => $aRow['people_p_phone'],);
                    }
                }

                $aUserDetails['card']      = array_values($aUserDetails['card']);
                $aUserDetails['addresses'] = array_values($aUserDetails['addresses']);
                $aUserDetails['people']    = array_values($aUserDetails['people']);
            }
            else {
                $aUserDetails = array('card'        => array()
                                    ,'addresses'   => array()
                                    ,'people'      => array());
            }

            $aUserDetails['card_vendor'] = array();

            $oResultSet = $oDataFunctionGateway->getDataRecordSet('IPYME_FINAL','get_card_vendor', array(':p_cv_id' => null));
            foreach($oResultSet as $aRow) {
                $aUserDetails['card_vendor'][] = $aRow['cv_name'];
            }

            $aUserDetails['user_u_email'] = $aUser['u_email'];
        }

//        var_dump($aUserDetails);
        return new \Zend\View\Model\JsonModel(array('success' => 1, 'user_details' => $aUserDetails));
    }

    public function getCountriesAction() {
        $aCountries = array();
        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);
            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');

            $oResultSet = $oDataFunctionGateway->getDataRecordSet(
                'IPYME_FINAL'
                , 'get_countries'
                , array(':id' => null));

            foreach($oResultSet as $aRow) {
                $aCountries[] = $aRow;
            }
        }

        return new \Zend\View\Model\JsonModel(array('success' => 1, 'available' => $aCountries));
    }

    public function addressAction() {
//        $this->getRequest()->setContent('{"address_detail_ad_description":"ertraaaaaaa","address_detail_ad_id":21,"address_detail_ad_line1":"ertredddddddddddd","address_detail_ad_line2":"retreDDDD","address_detail_ad_town":"retre","address_detail_ad_post_code":"ertretert","address_detail_ad_country":{"country_c_id":527,"country_c_name":"bolivia","country_c_code":"bo"}}');
//        $this->getRequest()->getHeaders()->addHeaderLine('X_REQUESTED_WITH','XMLHttpRequest');
//

        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);

            $aFunctionParams = array(':p_u_session'         => session_id()
                                    ,':p_ad_id'             => array_key_exists('address_detail_ad_id',$aRequest)?$aRequest['address_detail_ad_id']:0
                                    ,':p_ad_line1'          => array_key_exists('address_detail_ad_line1',$aRequest)?$aRequest['address_detail_ad_line1']:''
                                    ,':p_ad_line2'          => array_key_exists('address_detail_ad_line2',$aRequest)?$aRequest['address_detail_ad_line2']:''
                                    ,':p_ad_town'           => array_key_exists('address_detail_ad_town',$aRequest)?$aRequest['address_detail_ad_town']:''
                                    ,':p_ad_post_code'      => array_key_exists('address_detail_ad_post_code',$aRequest)?$aRequest['address_detail_ad_post_code']:''
                                    ,':p_ad_description'    => array_key_exists('address_detail_ad_description',$aRequest)?$aRequest['address_detail_ad_description']:''
                                    ,':p_c_code'            => array_key_exists('address_detail_ad_country',$aRequest)?$aRequest['address_detail_ad_country']->country_c_code:'');

//            var_dump($aRequest,$aFunctionParams);
            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');
            $oResultSet = $oDataFunctionGateway->getDataRecordSet(
                    'IPYME_FINAL'
                    , 'set_address'
                    , $aFunctionParams);

            $aResultSet = $oResultSet->current();
            if ($bSuccess = ($oResultSet->count() == 1)){
                $aResultSet['address_detail_ad_country'] = array('country_c_code' => $aResultSet['country_c_code']
                                                                ,'country_c_id' => $aResultSet['country_c_id']
                                                                ,'country_c_name' => $aResultSet['country_c_name']);
            }
        }
        else {
            $bSuccess=false;
        }

        return new \Zend\View\Model\JsonModel(array('success' => ($bSuccess?1:0), 'address' => $aResultSet));
    }

    public function cardAction() {
//        $this->getRequest()->setContent('{"card_c_description":"bbbbbb","card_vendor_cv_name":"electron","card_c_name":"bbbbbb","card_c_card_number":"bbbbbb","card_c_expire_date":"bbbbbb","card_c_issue_numer":"bbbbbb"}');
//        $this->getRequest()->getHeaders()->addHeaderLine('X_REQUESTED_WITH','XMLHttpRequest');
//
        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);

            $aFunctionParams = array(':p_u_session'     => session_id()
                                    ,':p_c_id'          => array_key_exists('card_c_id',$aRequest)?$aRequest['card_c_id']:0
                                    ,':p_c_description' => array_key_exists('card_c_description',$aRequest)?$aRequest['card_c_description']:''
                                    ,':p_c_card_number' => array_key_exists('card_c_card_number',$aRequest)?$aRequest['card_c_card_number']:''
                                    ,':p_c_name'        => array_key_exists('card_c_name',$aRequest)?$aRequest['card_c_name']:''
                                    ,':p_c_expire_date' => array_key_exists('card_c_expire_date',$aRequest)?$aRequest['card_c_expire_date']:''
                                    ,':p_c_issue_numer' => array_key_exists('card_c_issue_numer',$aRequest)?$aRequest['card_c_issue_numer']:''
                                    ,':p_c_vendor'      => array_key_exists('card_c_vendor',$aRequest)?$aRequest['card_c_vendor']:''
                                    ,':p_cv_name'       => array_key_exists('card_vendor_cv_name',$aRequest)?$aRequest['card_vendor_cv_name']:'');
//            var_dump($aRequest,$aFunctionParams);
//            exit;
            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');
            $oResultSet = $oDataFunctionGateway->getDataRecordSet(
                    'IPYME_FINAL'
                    , 'set_payment_card'
                    , $aFunctionParams);

            $aResultSet = $oResultSet->current();
            $bSuccess = ($oResultSet->count() == 1);
        }
        else {
            $bSuccess=false;
        }

        return new \Zend\View\Model\JsonModel(array('success' => ($bSuccess?1:0), 'card' => $aResultSet));
    }

    public function accountAction() {
//        $this->getRequest()->setContent('{"people_p_title":"Mr.","people_p_name":"gfff","people_p_surname":"fdffd","people_p_phone":"fddfd"}');
//        $this->getRequest()->getHeaders()->addHeaderLine('X_REQUESTED_WITH','XMLHttpRequest');
//
        if ($this->getRequest()->isXmlHttpRequest()) {
            $sJSONDataRequest = $this->getRequest()->getContent();
            $aRequest = (array)json_decode($sJSONDataRequest);

            $aFunctionParams = array(':p_u_session' => session_id()
                                    ,':p_p_id'      => array_key_exists('people_p_id',$aRequest)?$aRequest['people_p_id']:0
                                    ,':p_title'     => array_key_exists('people_p_title',$aRequest)?$aRequest['people_p_title']:''
                                    ,':p_p_name'    => array_key_exists('people_p_name',$aRequest)?$aRequest['people_p_name']:''
                                    ,':p_p_surname' => array_key_exists('people_p_surname',$aRequest)?$aRequest['people_p_surname']:''
                                    ,':p_p_phone'   => array_key_exists('people_p_phone',$aRequest)?$aRequest['people_p_phone']:'');
//            var_dump($aRequest,$aFunctionParams);
//            exit;
            $oDataFunctionGateway = $this->serviceLocator->get('Datainterface\Model\DataFunctionGateway');
            $oResultSet = $oDataFunctionGateway->getDataRecordSet(
                    'IPYME_FINAL'
                    , 'set_people'
                    , $aFunctionParams);

            $aResultSet = $oResultSet->current();
            $bSuccess = ($oResultSet->count() == 1);
        }
        else {
            $bSuccess=false;
        }

        return new \Zend\View\Model\JsonModel(array('success' => ($bSuccess?1:0), 'people' => $aResultSet));
    }
}
?>


text:
Hooks can be used to plug piece of code into the official phpfreechat code. Thanks to hooks, you can customize or extend phpfreechat's features. Hooks can be configured in your `server/config.php` or `server/config.local.php` files.

## pfc.before.auth

This hook can be used to connect the chat authentication system to you own one. It is activated just before asking a login to the user. It can check for an user in a cookie, an external database or through a sso. The hook has to return the login and it will be used by phpfreechat (if not already used by another user). Here is a basic example:
```php
$GLOBALS['pfc_hooks']['pfc.before.auth'][5] = function ($app, $req, $res) {
  return function () use ($app, $req, $res) {
    return 'guest'.rand(1,1000);
  };
};
```
This hook will randomly assign a nickname to each users (`[5]` is the hook priority cause it can have several hooks with one type)

A hook to connect phpbb3 authentication system to the chat (used on the [phpfreechat web site](http://www.phpfreechat.net)) can be found [at github here](https://github.com/kerphi/phpfreechat/tree/master/server/contrib/phpbb3-auth).

## pfc.filter.login

This hook can be used to filter characters on the user's login in the auth route. First parameter is the login and the hook must return the filtered login.

Example which filter none ascii characters from the login:
```php
$GLOBALS['pfc_hooks']['pfc.filter.login'][0] = function ($app, $req, $res) {
  return function ($login) use ($app, $req, $res) {
    $ascii_pattern = '/^[a-z0-9()\/\'"|&,. -]{2,55}$/i';
    return preg_replace($ascii_pattern, '', $login);
  };
};
```
This hook will remove all none ascii chars from the given login. The code source can be found [at github here](https://github.com/kerphi/phpfreechat/tree/master/server/contrib/ascii-login).

## pfc.isop

This hook can be used to give operator right to a specific login on a specific channel.

* First parameter is the login
* Second parameter is the channel name

The hook must return true if operator, false if not an operator on this channel.

Example which give op rights to "kerphi" login when he joins "Kerphi's room" channel:
```php
$GLOBALS['pfc_hooks']['pfc.isop'][5] = function ($app, $req, $res) {
  return function ($login, $channel, $uid, $cid) use ($app, $req, $res) {
    if ($login == 'kerphi' and $channel == "Kerphi's room") {
      return true;
    } else {
      return false;
    }
  };
};
```

This hook will systematically give channel operator rights to "kerphi" login when he joins "Kerphi's room" channel.

Available in phpFreeChat ≥ 2.1.0

## pfc.isban

This hook can be used to banish a specific user on a specific channel.

* First parameter is the login
* Second parameter is the channel name

The hook must return an array with baninfo (see bellow example) if the user is banned, false if the user is not banned on this channel.

Example which ban "baduser" login on the "Kerphi's room" channel:
```php
$GLOBALS['pfc_hooks']['pfc.isban'][5] = function ($app, $req, $res) {
  return function ($login, $channel, $uid, $cid) use ($app, $req, $res) {
    if ($login == 'baduser' and $channel == "Kerphi's room") {
      return array('opname' => 'Chat Master', 'reason' => 'Because you are a spammer', 'timestamp' => time());
    } else {
      return false;
    }
  };
};
```

Available in phpFreeChat ≥ 2.1.0


text:
    {{ date('d/m/Y', strtotime($relatorio->updated_at) ) }}
    Relatório Nº{{$relatorio->id}}

    Conversas

@foreach ( $relatorio->conversas as $cliente )

        @include( 'clientes.panels.item' )

            @foreach ( $cliente->conversas as $conversa )

                @include('conversas.print.item')

            @endforeach

@endforeach


text:
/**
 * Theses function are used to redistribute data located in the range 0-1
 * They take all the data and rearrange them and purturbe them slightly so that
 * they fit a particular distrubution function. For example you can use these
 * to push all the data points closer to 1 so that there are few points near 0
 * each redistribution function has different properties.
 *
 * Properties of these functions
 * the domain is (0-1) for the range (0-1)
 * in this range the function is one to one
 * f(0) == 0 and f(1) == 1
 *
 * @summary Functions used to redistrubute values in the range 0-1
 * @class Redist
 */

"use strict";

/**
 * The identity function. It returns the input value x
 *
 * @export
 * @function
 * @param {Number} x The input number in the range [0-1]
 * @returns {Number} Input value
 * @memberof Redist
 */
export function identity(x) {
    return x;
}

/**
 * The inverse fuction. It returns the opposite of the function in the range
 * from [0-1]. This is simply 1 - x.
 *
 * @export
 * @function
 * @param {Number} x The input number in the range [0-1]
 * @returns {Number} The redistributed input value, 1 - x
 * @memberof Redist
 */
export function inverse(x) {
    return 1 - x;
}

/**
 * Exponential redistribution function. This function skews the values either
 * up or down by a particular ammount according the input parameters. The
 * output distribution will be slight exponential shaped.
 *
 * @export
 * @function
 * @param {Number} x The input number in the range [0-1]
 * @param {Number} [amm=1] The strength of the redistribution
 * @param {Boolean} [inc=true] If you want to increase or decrease the input
 * @returns {Number} The redistributed input value
 * @memberof Redist
 */
export function exp(x, amm = 1, inc = true) {
    let nom, denom;
    if (inc) {
        nom = 1 - Math.exp(-amm * x);
        denom = 1 - Math.exp(-amm);
    } else {
        nom = Math.exp(amm * x) - 1;
        denom = Math.exp(amm) - 1;
    }

    return nom / denom;
}

// Power Function eg sqrt qubrt
/**
 * Power redistribution function. This function skews values either up or down
 * by a particular ammount according to the input parameters. The power
 * distribution also has a slight skew up or down on top of the redistribution.
 *
 * @export
 * @function
 * @param {Number} x The input number in the range [0-1]
 * @param {Number} [amm=2] The strength of the redistribution
 * @param {Boolean} [inc=true] If you want to increase or decrease the input
 * @param {Boolean} [skewDown=true] If you want to skew the input value down
 *  towards 0, then skewDown=true. If you want to skew the input value up
 *  towards 1, then skewDown=false
 * @returns {Number} The redistributed input value
 * @memberof Redist
 */
export function pow(x, amm = 2, inc = true, skewDown = true) {
    if (inc) {
        if (skewDown) {
            return Math.pow(x, 1 / amm);
        } else {
            return 1 - Math.pow(1 - x, amm);
        }
    } else {
        if (skewDown) {
            return Math.pow(x, amm);
        } else {
            return 1 - Math.pow(1 - x, 1 / amm);
        }
    }
}

/**
 * Turns a continious function and turns it into a discrete function that has
 * a specific number of bins to but the distribution into.
 *
 * @export
 * @function
 * @param {Number} x The input number in the range [0-1]
 * @param {Number} [bins=10] The number of bins for the discrite distribution
 * @returns {Number} The discretized input value
 * @memberof Redist
 */
export function step(x, bins = 10) {
    return Math.floor(bins * x) / bins;
}


text:
<?php

namespace Witty\OrderBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use JMS\SecurityExtraBundle\Annotation\Secure;

class OrderController extends Controller
{
    /**
     * @Route("commander", name="order_commander")
     * @Template()
	 * @Secure(roles="ROLE_USER")
     */
    public function commanderAction()
    {
		$em = $this->getDoctrine()->getEntityManager();
		$products = $em->getRepository('WittyOrderBundle:Product')->findAllOrderedByPriority();

        return array(
			'products' => $products,
			'franco' => $this->container->getParameter('witty.distribution.franco'),
			'frais_port' => $this->container->getParameter('witty.distribution.frais_port'),
			'tva' => $this->container->getParameter('witty.distribution.tva')
		);
    }

    /**
     * @Route("confirmation-commande", name="order_confirmationCommande")
     * @Template()
	 * @Secure(roles="ROLE_USER")
     */
    public function confirmationCommandeAction()
    {
		$em = $this->getDoctrine()->getEntityManager();
		$user = $this->container->get('security.context')->getToken()->getUser();
		$request = $this->getRequest();
		$order = new \Witty\OrderBundle\Entity\Order();

		//Ajout de l'user
		$order->setUser($user);

		//Récupération et sauvegarde de la commande
		foreach($request->get('customerOrders') as $id_product => $quantity)
		{
			if ($quantity > 0)
			{
				$product = $em->getRepository('WittyOrderBundle:Product')->find($id_product);

				$orderProduct = new \Witty\OrderBundle\Entity\OrderProduct();
				$orderProduct->setProduct($product);
				$orderProduct->setQuantity($quantity);
				$orderProduct->setUnitPrice($product->getUnitPrice()); //"Redondance" de l'information unitPrice pour que l'on puisse changer le prix d'un Product sans en créer un nouveau, et tout de même garder l'historique du prix payé par l'utilisateur

				$order->addOrderProduct($orderProduct);
				$orderProduct->setOrder($order);
			}
		}

		//Gestion de la promo
		if ($customerPromo = $request->get('promo'))
			if ($promo =$em->getRepository('WittyOrderBundle:Promo')->find($customerPromo))
				$orderProduct->setPromo($promo);

		//Gestion du franco
		if ($order->getHtAmount() >= $this->container->getParameter('witty.distribution.franco')) $order->setShipping(0);
		else $order->setShipping($this->container->getParameter('witty.distribution.frais_port'));

		//Persistence de la commande
		$em->persist($order);
		$em->flush();

		//Envoi des mails
			//Mail à l'utilisateur
		$message = \Swift_Message::newInstance()
		->setSubject('Confirmation de commande')
		->setFrom($this->container->getParameter('witty.mail.order_expediteur'))
		->setTo($user->getEmail())
		->setBody('
Bonjour et merci de votre commande.
Votre commande a bien été prise en compte.
Vous la recevrez sous 3 jours maximum.

Ludiquement,
La Witty Team

P.S: Ceci est un envoi automatique. Merci de ne pas répondre à cet email, il ne serait pas traité.');

		$this->get('mailer')->send($message);

			//Mail à la boîte contact
				//Construction du corps du message
		$messageCommande =
			"Commande de ".$user->getLabel()." d'un montant de ".$order->getTtcAmount()."
Détail de la commande :

";
		foreach($order->getOrderProducts() as $orderProduct)
		{
			$messageCommande.= '- '.$orderProduct->getQuantity().' x '.$orderProduct->getProduct()->getTitle().' ('.$orderProduct->getProduct()->getUnitPrice().' € HT) = '.($orderProduct->getQuantity() * $orderProduct->getProduct()->getUnitPrice()).' € HT
';
		}

			//Mail à Atlankit
		/*
		$message = \Swift_Message::newInstance()
		->setSubject('Commande de '.$user->getLabel())
		->setFrom($this->container->getParameter('witty.mail.order_expediteur'))
		->setTo($this->container->getParameter('witty.mail.logisticien'))
		->setBody('Commande de '.$user->getLabel().' d\'un montant de '.$order->getTtcAmount());
		*/
		$this->get('mailer')->send($message);

        return array();
    }
}


text:
package exh3y.telebot.data;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.json.JSONObject;
import org.junit.Test;

public class TelegramFileTest {

	@Test
	public void testFileCreation() {

		String fileString = "{\"file_id\":\"abba264bf53c\",\"file_size\":1234}";
		JSONObject json = new JSONObject(fileString);

		TelegramFile file;
		try {
			file = TelegramFile.create(json);
		} catch (IOException e) {
			assertTrue(false);
			return;
		}

		assertEquals(file.getFile_id(), json.getString("file_id"));
		assertEquals((int) file.getFile_size(), json.getInt("file_size"));
	}

}


text:
<!DOCTYPE HTML>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0">
  <title>Add spec</title>

  <link rel="shortcut icon" type="image/png" href="lib/jasmine-2.0.0/jasmine_favicon.png">
  <link rel="stylesheet" type="text/css" href="lib/jasmine-2.0.0/jasmine.css">

  <input id="value_a" type="text" value="0"><button id="clear_a">X</button>
  <input id="value_b" type="text" value="0"><button id="clear_b">X</button>

  Result:


text:
package com.mycompany.packagetest;

public class MethodModifiersTest {

    // Static Method
    static void staticMethod() {}

    // Abstract Method
    abstract void abstractMethod() {}

    // Final Method
    final void finalMethod() {}

    // Synchronized Method
    synchronized void synchronizedMethod() {}

    // Native Method
    native void nativeMethod() {}

    // Strictfp Method
    strictfp void strictfpMethod() {}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace IBApi
{
    /**
     * @class ComboLeg
     * @brief Class representing a leg within combo orders.
     * @sa Order
     */
    [ComVisible(true)]
    public class ComboLeg : IBApi.TWSApi.IComboLeg
    {
        public static int SAME = 0;
        public static int 	OPEN = 1;
        public static int 	CLOSE = 2;
        public static int 	UNKNOWN = 3;

        private int conId;
        private int ratio;
        private string action;
        private string exchange;
        private int openClose;
        private int shortSaleSlot;
        private string designatedLocation;
        private int exemptCode;

        /**
         * @brief The Contract's IB's unique id
         */
        public int ConId
        {
            get {return conId; }
            set { conId = value; }
        }

        /**
          * @brief Select the relative number of contracts for the leg you are constructing. To help determine the ratio for a specific combination order, refer to the Interactive Analytics section of the User's Guide.
          */
        public int Ratio
        {
            get { return ratio; }
            set { ratio = value; }
        }

        /**
         * @brief The side (buy or sell) of the leg:\n
         *      - For individual accounts, only BUY and SELL are available. SSHORT is for institutions.
         */
        public string Action
        {
            get { return action; }
            set { action = value; }
        }
        /**
         * @brief The destination exchange to which the order will be routed.
         */
        public string Exchange
        {
            get { return exchange; }
            set { exchange = value; }
        }

        /**
        * @brief Specifies whether an order is an open or closing order.
        * For instituational customers to determine if this order is to open or close a position.
        *      0 - Same as the parent security. This is the only option for retail customers.\n
        *      1 - Open. This value is only valid for institutional customers.\n
        *      2 - Close. This value is only valid for institutional customers.\n
        *      3 - Unknown
        */
        public int OpenClose
        {
            get { return openClose; }
            set { openClose = value; }
        }

        /**
         * @brief For stock legs when doing short selling.
         * Set to 1 = clearing broker, 2 = third party
         */
        public int ShortSaleSlot
        {
            get { return shortSaleSlot; }
            set { shortSaleSlot = value; }
        }

        /**
         * @brief When ShortSaleSlot is 2, this field shall contain the designated location.
         */
        public string DesignatedLocation
        {
            get { return designatedLocation; }
            set { designatedLocation = value; }
        }

        /**
         * @brief -
         */
        public int ExemptCode
        {
            get { return exemptCode; }
            set { exemptCode = value; }
        }

        public ComboLeg()
        {
        }

        public ComboLeg(int conId, int ratio, string action, string exchange, int openClose, int shortSaleSlot, string designatedLocation, int exemptCode)
        {
            ConId = conId;
            Ratio = ratio;
            Action = action;
            Exchange = exchange;
            OpenClose = openClose;
            ShortSaleSlot = shortSaleSlot;
            DesignatedLocation = designatedLocation;
            ExemptCode = exemptCode;
        }

        int TWSApi.IComboLeg.conId { get { return conId; } set { conId = value; } }

        int TWSApi.IComboLeg.ratio { get { return ratio; } set { ratio = value; } }

        string TWSApi.IComboLeg.action { get { return action; } set { action = value; } }

        string TWSApi.IComboLeg.exchange { get { return exchange; } set { exchange = value; } }

        int TWSApi.IComboLeg.openClose { get { return openClose; } set { openClose = value; } }

        int TWSApi.IComboLeg.shortSaleSlot { get { return shortSaleSlot; } set { shortSaleSlot = value; } }

        string TWSApi.IComboLeg.designatedLocation { get { return designatedLocation; } set { designatedLocation = value; } }

        int TWSApi.IComboLeg.exemptCode { get { return exemptCode; } set { exemptCode = value; } }
    }
}


text:
using System.Collections.Generic;
using System.Linq;

namespace designPatterns.Domain.DesignPattern.StrategyPattern
{
    public class SortedList
    {
        private readonly List<string> _list = new List<string>();
        private SortStrategy _sortstrategy;

        public void SetSortStrategy(SortStrategy sortstrategy)
        {
            _sortstrategy = sortstrategy;
        }

        public void Add(string name)
        {
            _list.Add(name);
        }

        public string Sort()
        {
            _sortstrategy.Sort(_list);

            return _list.Aggregate("", (current, name) => current + (" " + name));
        }
    }
}


text:
<?php

namespace Persydo\ContactBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * TimelineRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TimelineRepository extends EntityRepository
{
    public function findDescendTimeline()
    {
        $em = $this->getEntityManager();
        $timeline = $em->createQuery('SELECT t FROM PersydoContactBundle:Timeline t ORDER BY t.id DESC')
            ->getResult();

        return $timeline;
    }
}


text:
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20170904110147 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        $this->addSql('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"');
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

        $this->addSql('CREATE TABLE tokens (id VARCHAR(255) NOT NULL, token TEXT NOT NULL, expiredAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE TABLE refresh_tokens (id VARCHAR(255) NOT NULL, user_id VARCHAR(255) DEFAULT NULL, token TEXT NOT NULL, valid TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_9BACE7E1A76ED395 ON refresh_tokens (user_id)');
        $this->addSql('CREATE TABLE users (id VARCHAR(255) NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, active BOOLEAN NOT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, role VARCHAR(50) NOT NULL, googleId VARCHAR(255) DEFAULT NULL, seed TEXT DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE UNIQUE INDEX user_idx ON users (email, googleId)');
        $this->addSql('ALTER TABLE refresh_tokens ADD CONSTRAINT FK_9BACE7E1A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

        $this->addSql('CREATE SCHEMA public');
        $this->addSql('ALTER TABLE refresh_tokens DROP CONSTRAINT FK_9BACE7E1A76ED395');
        $this->addSql('DROP TABLE tokens');
        $this->addSql('DROP TABLE refresh_tokens');
        $this->addSql('DROP TABLE users');
    }
}


text:
from __future__ import print_function
import json
import os
import requests
import sys
from optparse import OptionParser

from operator import itemgetter, attrgetter

def get_slice_id(slice_name):
    r = requests.get(SLICES_API + "?name=%s" % slice_name, auth=OPENCLOUD_AUTH)
    if r.status_code != 200:
        print("Error: Slice REST API failed", file=sys.stderr)
        sys.exit(-1)
    return r.json()[0]["id"]

def get_node_id(host_name):
    r = requests.get(NODES_API, auth=OPENCLOUD_AUTH)
    if r.status_code != 200:
        print("Error: Node REST API failed", file=sys.stderr)
        sys.exit(-1)
    nodes = r.json()
    for node in nodes:
        if node["name"].lower() == host_name.lower():
            return node["id"]
    print("Error: failed to find node %s" % host_name, file=sys.stderr)
    sys.exit(-1)

def get_instances(slice_id=None, node_id=None):
    queries = []
    if slice_id:
        queries.append("slice=%s" % str(slice_id))
    if node_id:
        queries.append("node=%s" % str(node_id))

    if queries:
        query_string = "?" + "&".join(queries)
    else:
        query_string = ""

    r = requests.get(INSTANCES_API + query_string, auth=OPENCLOUD_AUTH)
    if r.status_code != 200:
        print("Error: Instance REST API failed", file=sys.stderr)
        sys.exit(-1)
    return r.json()

def get_networks():
    r = requests.get(NETWORKS_API, auth=OPENCLOUD_AUTH)
    if r.status_code != 200:
        print("Error: Network REST API failed", file=sys.stderr)
        sys.exit(-1)
    return r.json()

def main():
    global OPENCLOUD_AUTH, REST_API, NODES_API, SLICES_API, INSTANCES_API, PORTS_API, NETWORKS_API

    parser = OptionParser(
        usage="get_instance_ip.py [options] <rest_hostname> <rest_port>"
    )

    parser.add_option(
        "-u",
        "--username",
        dest="username",
        help="XOS admin username",
        metavar="NAME",
        default="padmin@vicci.org",
    )
    parser.add_option(
        "-p",
        "--password",
        dest="password",
        help="XOS admin password",
        metavar="PASSWORD",
        default="letmein",
    )
    parser.add_option(
        "-n",
        "--node",
        dest="node",
        help="show instances on node",
        metavar="HOSTNAME",
        default=None,
    )
    parser.add_option(
        "-s",
        "--slice",
        dest="slice",
        help="show instances in slice",
        metavar="SLICENAME",
        default=None,
    )
    parser.add_option(
        "-N",
        "--network",
        dest="filter_network_name",
        help="filter network name",
        metavar="NAME",
        default=None,
    )
    parser.add_option(
        "-b",
        "--brief",
        dest="brief",
        help="only display the IP, nothing else",
        action="store_true",
        default=False,
    )

    (options, args) = parser.parse_args(sys.argv[1:])

    if len(args) != 2:
        print(
            "syntax: get_instance_name.py [options] <rest_hostname> <rest_port>",
            file=sys.stderr,
        )
        sys.exit(-1)

    rest_hostname = args[0]
    rest_port = args[1]

    REST_API = "http://%s:%s/api/core/" % (rest_hostname, rest_port)

    NODES_API = REST_API + "nodes/"
    SLICES_API = REST_API + "slices/"
    INSTANCES_API = REST_API + "instances/"
    PORTS_API = REST_API + "ports/"
    NETWORKS_API = REST_API + "networks/"

    OPENCLOUD_AUTH = (options.username, options.password)

    if options.slice:
        slice_id = get_slice_id(options.slice)
    else:
        slice_id = None

    if options.node:
        node_id = get_node_id(hostname)
    else:
        node_id = None
    instances = get_instances(slice_id, node_id)

    networks = get_networks()
    networks_by_id = {}
    for network in networks:
        networks_by_id[network["id"]] = network

    # get (instance_name, ip) pairs for instances with names and ips

    instances = [x for x in instances if x["instance_name"]]
    instances = sorted(instances, key=lambda instance: instance["instance_name"])

    for instance in instances:
        r = requests.get(
            PORTS_API + "?instance=%s&no_hyperlinks=1" % instance["id"],
            auth=OPENCLOUD_AUTH,
        )
        ports = r.json()

        for x in ports:
            net_name = networks_by_id.get(x["network"], {"name": "unknown"})["name"]
            if (options.filter_network_name) and (
                net_name != options.filter_network_name
            ):
                continue
            if options.brief:
                print(x["ip"])
            else:
                print(instance["instance_name"], net_name, x["ip"])

if __name__ == "__main__":
    main()


text:
package com.github.osblinnikov.cnetsjava.readerwriter;

public interface ReaderWriterInterface {
  public Object readNext(BufferKernelParams params, int waitThreshold);
  public BufferReadData readNextWithMeta(BufferKernelParams params, int waitThreshold);
  public int readFinished(BufferKernelParams params);
  public Object writeNext(BufferKernelParams params, int waitThreshold);
  public int writeFinished(BufferKernelParams params);
  public int writeFinishedWithMeta(BufferKernelParams params, BufferWriteData writeData);
  public int size(BufferKernelParams params);
  public int timeout(BufferKernelParams params);
  public int gridSize(BufferKernelParams params);
  public int uniqueId(BufferKernelParams params);
  public int addSelector(BufferKernelParams params, Object selectorContainer);
  public int enable(BufferKernelParams params, boolean isEnabled);
}


text:
package com.jfoenix.controls;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.binding.Bindings;
import javafx.css.CssMetaData;
import javafx.css.SimpleStyleableDoubleProperty;
import javafx.css.Styleable;
import javafx.css.StyleableDoubleProperty;
import javafx.scene.Parent;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
import javafx.util.Duration;

import com.sun.javafx.css.converters.SizeConverter;

/**
 * @author Bashir Elias & Shadi Shaheen
 *
 */
public class JFXSpinner extends StackPane {

	private static final String DEFAULT_STYLE_CLASS = "jfx-spinner";

	private Color greenColor, redColor, yellowColor, blueColor, initialColor;
	private Timeline timeline;
	private Arc arc;
	private boolean initialized;

	public JFXSpinner() {
		super();
		getStyleClass().add(DEFAULT_STYLE_CLASS);
		initialize();
	}

	private void initialize() {

		blueColor = Color.valueOf("#4285f4");
		redColor = Color.valueOf("#db4437");
		yellowColor = Color.valueOf("#f4b400");
		greenColor = Color.valueOf("#0F9D58");

		arc = new Arc(0, 0, 12, 12, 0, 360);
		arc.setFill(Color.TRANSPARENT);
		arc.setStrokeWidth(3);
		arc.getStyleClass().addAll("arc");
		arc.radiusXProperty().bindBidirectional(radius);
		arc.radiusYProperty().bindBidirectional(radius);
		getChildren().add(arc);

		this.minWidthProperty().bind(Bindings.createDoubleBinding(()->{
			return getRadius()*2 + arc.getStrokeWidth() + 5;
		}, radius,arc.strokeWidthProperty()));

		this.maxWidthProperty().bind(Bindings.createDoubleBinding(()->{
			return getRadius()*2 + arc.getStrokeWidth() + 5;
		}, radius,arc.strokeWidthProperty()));

		this.minHeightProperty().bind(Bindings.createDoubleBinding(()->{
			return getRadius()*2 + arc.getStrokeWidth() + 5;
		}, radius,arc.strokeWidthProperty()));

		this.maxHeightProperty().bind(Bindings.createDoubleBinding(()->{
			return getRadius()*2 + arc.getStrokeWidth() + 5;
		}, radius,arc.strokeWidthProperty()));

	}

	private KeyFrame[] getKeyFrames(double angle, double duration, Color color) {
		KeyFrame[] frames = new KeyFrame[4];
		frames[0] = new KeyFrame(Duration.seconds(duration), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 45 + getStartingAngle(), Interpolator.LINEAR));
		frames[1] = new KeyFrame(Duration.seconds(duration + 0.4), new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 90 + getStartingAngle(), Interpolator.LINEAR));
		frames[2] = new KeyFrame(Duration.seconds(duration + 0.7), new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 135 + getStartingAngle(), Interpolator.LINEAR));
		frames[3] = new KeyFrame(Duration.seconds(duration + 1.1), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 435 + getStartingAngle(), Interpolator.LINEAR),
				new KeyValue(arc.strokeProperty(), color, Interpolator.EASE_BOTH));
		return frames;
	}

	protected void layoutChildren() {
		if (!initialized) {
			super.layoutChildren();
			initialColor = (Color) arc.getStroke();
			if (initialColor == null) {
				arc.setStroke(blueColor);
			}

			KeyFrame[] blueFrame = getKeyFrames( 0, 0, initialColor == null ? blueColor : initialColor);
			KeyFrame[] redFrame = getKeyFrames( 450, 1.4, initialColor == null ? redColor : initialColor);
			KeyFrame[] yellowFrame = getKeyFrames( 900, 2.8, initialColor == null ? yellowColor : initialColor);
			KeyFrame[] greenFrame = getKeyFrames( 1350, 4.2, initialColor == null ? greenColor : initialColor);

			KeyFrame endingFrame = new KeyFrame(Duration.seconds(5.6), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), 1845 + getStartingAngle(), Interpolator.LINEAR));

			if(timeline!=null) timeline.stop();
			timeline = new Timeline(blueFrame[0], blueFrame[1], blueFrame[2], blueFrame[3], redFrame[0], redFrame[1], redFrame[2], redFrame[3], yellowFrame[0], yellowFrame[1], yellowFrame[2], yellowFrame[3],
					greenFrame[0], greenFrame[1], greenFrame[2], greenFrame[3], endingFrame);
			timeline.setCycleCount(Timeline.INDEFINITE);
			timeline.setRate(1);
			timeline.play();

			initialized = true;
		}
	}

	/***************************************************************************
	 *                                                                         *
	 * Stylesheet Handling                                                     *
	 *                                                                         *
	 **************************************************************************/

	private StyleableDoubleProperty radius = new SimpleStyleableDoubleProperty(StyleableProperties.RADIUS, JFXSpinner.this, "radius", 12.0);

	public final StyleableDoubleProperty radiusProperty() {
		return this.radius;
	}

	public final double getRadius() {
		return this.radiusProperty().get();
	}

	public final void setRadius(final double radius) {
		this.radiusProperty().set(radius);
	}

	private StyleableDoubleProperty startingAngle = new SimpleStyleableDoubleProperty(StyleableProperties.STARTING_ANGLE, JFXSpinner.this, "starting_angle", 360 - Math.random()*720);

	public final StyleableDoubleProperty startingAngleProperty() {
		return this.startingAngle;
	}

	public final double getStartingAngle() {
		return this.startingAngleProperty().get();
	}

	public final void setStartingAngle(final double startingAngle) {
		this.startingAngleProperty().set(startingAngle);
	}

	private static class StyleableProperties {
		private static final CssMetaData<JFXSpinner, Number> RADIUS =
				new CssMetaData< JFXSpinner, Number>("-fx-radius",
						SizeConverter.getInstance(), 12) {
			@Override
			public boolean isSettable(JFXSpinner control) {
				return control.radius == null || !control.radius.isBound();
			}
			@Override
			public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
				return control.radius;
			}
		};

		private static final CssMetaData<JFXSpinner, Number> STARTING_ANGLE =
				new CssMetaData< JFXSpinner, Number>("-fx-starting-angle",
						SizeConverter.getInstance(), 360 - Math.random()*720) {
			@Override
			public boolean isSettable(JFXSpinner control) {
				return control.startingAngle == null || !control.startingAngle.isBound();
			}
			@Override
			public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
				return control.startingAngle;
			}
		};

		private static final List<CssMetaData<? extends Styleable, ?>> CHILD_STYLEABLES;
		static {
			final List<CssMetaData<? extends Styleable, ?>> styleables =
					new ArrayList<CssMetaData<? extends Styleable, ?>>(Parent.getClassCssMetaData());
			Collections.addAll(styleables,
					RADIUS,
					STARTING_ANGLE
					);
			CHILD_STYLEABLES = Collections.unmodifiableList(styleables);
		}
	}

	// inherit the styleable properties from parent
	private List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

	@Override
	public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
		if(STYLEABLES == null){
			final List<CssMetaData<? extends Styleable, ?>> styleables =
					new ArrayList<CssMetaData<? extends Styleable, ?>>(Parent.getClassCssMetaData());
			styleables.addAll(getClassCssMetaData());
			styleables.addAll(super.getClassCssMetaData());
			STYLEABLES = Collections.unmodifiableList(styleables);
		}
		return STYLEABLES;
	}
	public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
		return StyleableProperties.CHILD_STYLEABLES;
	}

}


text:
<!DOCTYPE html>

    <title>Radar area</title>
    <meta charset="utf-8">
    <link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">

        Back


text:
#include "test_precomp.hpp"

namespace opencv_test { namespace {

//#define DUMP_RESULTS

#ifdef DUMP_RESULTS
#  define DUMP(image, path) imwrite(path, image)
#else
#  define DUMP(image, path)
#endif

TEST(Photo_DenoisingGrayscale, regression)
{
    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
    string original_path = folder + "lena_noised_gaussian_sigma=10.png";
    string expected_path = folder + "lena_noised_denoised_grayscale_tw=7_sw=21_h=10.png";

    Mat original = imread(original_path, IMREAD_GRAYSCALE);
    Mat expected = imread(expected_path, IMREAD_GRAYSCALE);

    ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;

    Mat result;
    fastNlMeansDenoising(original, result, 10);

    DUMP(result, expected_path + ".res.png");

    ASSERT_EQ(0, cvtest::norm(result, expected, NORM_L2));
}

TEST(Photo_DenoisingColored, regression)
{
    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
    string original_path = folder + "lena_noised_gaussian_sigma=10.png";
    string expected_path = folder + "lena_noised_denoised_lab12_tw=7_sw=21_h=10_h2=10.png";

    Mat original = imread(original_path, IMREAD_COLOR);
    Mat expected = imread(expected_path, IMREAD_COLOR);

    ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;

    Mat result;
    fastNlMeansDenoisingColored(original, result, 10, 10);

    DUMP(result, expected_path + ".res.png");

    ASSERT_EQ(0, cvtest::norm(result, expected, NORM_L2));
}

TEST(Photo_DenoisingGrayscaleMulti, regression)
{
    const int imgs_count = 3;
    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";

    string expected_path = folder + "lena_noised_denoised_multi_tw=7_sw=21_h=15.png";
    Mat expected = imread(expected_path, IMREAD_GRAYSCALE);
    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;

    vector<Mat> original(imgs_count);
    for (int i = 0; i < imgs_count; i++)
    {
        string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
        original[i] = imread(original_path, IMREAD_GRAYSCALE);
        ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
    }

    Mat result;
    fastNlMeansDenoisingMulti(original, result, imgs_count / 2, imgs_count, 15);

    DUMP(result, expected_path + ".res.png");

    ASSERT_EQ(0, cvtest::norm(result, expected, NORM_L2));
}

TEST(Photo_DenoisingColoredMulti, regression)
{
    const int imgs_count = 3;
    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";

    string expected_path = folder + "lena_noised_denoised_multi_lab12_tw=7_sw=21_h=10_h2=15.png";
    Mat expected = imread(expected_path, IMREAD_COLOR);
    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;

    vector<Mat> original(imgs_count);
    for (int i = 0; i < imgs_count; i++)
    {
        string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
        original[i] = imread(original_path, IMREAD_COLOR);
        ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
    }

    Mat result;
    fastNlMeansDenoisingColoredMulti(original, result, imgs_count / 2, imgs_count, 10, 15);

    DUMP(result, expected_path + ".res.png");

    ASSERT_EQ(0, cvtest::norm(result, expected, NORM_L2));
}

TEST(Photo_White, issue_2646)
{
    cv::Mat img(50, 50, CV_8UC1, cv::Scalar::all(255));
    cv::Mat filtered;
    cv::fastNlMeansDenoising(img, filtered);

    int nonWhitePixelsCount = (int)img.total() - cv::countNonZero(filtered == img);

    ASSERT_EQ(0, nonWhitePixelsCount);
}

TEST(Photo_Denoising, speed)
{
    string imgname = string(cvtest::TS::ptr()->get_data_path()) + "shared/5MP.png";
    Mat src = imread(imgname, 0), dst;

    double t = (double)getTickCount();
    fastNlMeansDenoising(src, dst, 5, 7, 21);
    t = (double)getTickCount() - t;
    printf("execution time: %gms\n", t*1000./getTickFrequency());
}

}} // namespace


text:
<?php

namespace App\Http\Middleware;

use Closure;
use Sentinel;

class CheckPermission
{
    /**
     * Run the request filter.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($user = Sentinel::check()) {
            return $next($request);
        } else {
            return redirect('user/login');
        }
    }

}


text:
from collections import*
N=int(input())
total_mark=0
fields=input().split()
for i in range(N):
    students=namedtuple("k",fields)
    MARKS,CLASS,NAME,ID=input().split()
    x=students(MARKS,CLASS,NAME,ID)
    total_mark+=int(x.MARKS)
print(total_mark/N)