text:
'use strict';

var path = require('path'),
  db = require(path.resolve('./config/lib/sequelize')).models,
  policy = require('../policies/mago.server.policy'),
  advancedSettings = require(path.resolve('./modules/mago/server/controllers/advanced_settings.server.controller'));

module.exports = function (app) {
  app.route('/api/AdvancedSettings')
    .all(policy.Authenticate)
    .all(policy.isAllowed)
    .get(advancedSettings.getAdvancedSettings)
    .put(advancedSettings.update)
};

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Capri</logradouro><bairro>Santa Isabel</bairro><cidade>Viamão</cidade><uf>RS</uf><cep>94480730</cep></feed>


text:
/**
 * Created by l.heddendorp on 21.03.2016.
 */
import angular from 'angular'

import template from './packIndex.ng.html'

class IndexCtrl {
  constructor () {
    'ngInject'
    console.log('INDEX INIT')
  }
}

let index = {
  restrict: 'E',
  bindings: {},
  template,
  controller: IndexCtrl,
  controllerAs: 'index'
}

export default angular
  .module('app.packs.index', [])
  .component('packIndex', index)
  .name


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Man.UnitsOfMeasurement.VSIX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]


text:
"""
The following line computes metrics for files in "Media supported by Wikimedia France"
and for the FDC report of year 2012-2013 round 2 quarter 3

python commons_cat_metrics_fdc.py --year 2012-2013 --round 2 --quarter 3 --category "Media supported by Wikimedia France"

Please use python commons_cat_metrics_fdc.py -h for more information

"""
from argparse import ArgumentParser

from wm_metrics.commons_cat_metrics import CommonsCatMetrics
from wm_metrics.fdc.round import Round

def _parse_years(arg_years):
    return [int(y) for y in arg_years.split('-')]

def main():
    """Commons Cat Metrics."""
    parser = ArgumentParser(description="Commons Cat Metrics")

    parser.add_argument("-c", "--category",
                        type=str,
                        dest="category",
                        metavar="CAT",
                        required=True,
                        help="The Commons category without Category:")
    parser.add_argument("-y", "--year",
                        type=str,
                        dest="years",
                        metavar="YEAR",
                        required=True,
                        help="The FDC year, e.g 2011-2012")
    parser.add_argument("-r", "--round",
                        type=int,
                        dest="round",
                        metavar="ROUND",
                        required=True,
                        help="The FDC round, i.e. 1 or 2")
    parser.add_argument("-q", "--quarter",
                        type=int,
                        dest="quarter",
                        metavar="QUARTER",
                        required=True,
                        help="The reporting quarter")
    # FDC round
    args = parser.parse_args()
    category = args.category.decode('utf-8')
    years = _parse_years(args.years)

    fdc_round = Round(years[0], years[1], args.round)

    time_period = fdc_round.to_period_for_quarter(args.quarter)

    metrics = CommonsCatMetrics(category, time_period)
    text_report = metrics.make_report()
    metrics.close()
    print text_report

if __name__ == "__main__":
    main()


text: var bogus = require('fs').readFileSync('./bogusFile', 'bogus');


text:
<?php

namespace PhpSchool\WebsiteTest\Repository\Fixtures;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Persistence\ObjectManager;
use PhpSchool\Website\Entity\Event;
use PhpSchool\Website\Entity\Workshop;
use Ramsey\Uuid\UuidInterface;

class Events implements FixtureInterface
{
    public UuidInterface $event1Id;

    public function load(ObjectManager $manager)
    {
        $date = new \DateTime('5 days ago');

        $manager->persist(
            $e = new Event('Event 1', 'Event 1', null, clone $date->add(new \DateInterval('P1D')), 'Location 1', null)
        );

        $this->event1Id = $e->getId();

        $manager->persist(
            new Event('Event 2', 'Event 2', null, clone $date->add(new \DateInterval('P1D')), 'Location 2', null)
        );

        $manager->persist(
            new Event('Event 3', 'Event 3', null, clone $date->add(new \DateInterval('P1D')), 'Location 3', null)
        );

        $manager->persist(
            new Event('Event 4', 'Event 4', null, clone $date->add(new \DateInterval('P1D')), 'Location 4', null)
        );

        $manager->persist(
            new Event('Event 5', 'Event 5', null, clone $date->add(new \DateInterval('P1D')), 'Location 5', null)
        );

        $manager->persist(
            new Event('Event 6', 'Event 6', null, clone $date->add(new \DateInterval('P1D')), 'Location 6', null)
        );

        $manager->persist(
            new Event('Event 7', 'Event 7', null, clone $date->add(new \DateInterval('P1D')), 'Location 7', null)
        );

        $manager->persist(
            new Event('Event 8', 'Event 8', null, clone $date->add(new \DateInterval('P1D')), 'Location 8', null)
        );

        $manager->persist(
            new Event('Event 9', 'Event 9', null, clone $date->add(new \DateInterval('P1D')), 'Location 9', null)
        );

        $manager->persist(
            new Event('Event 10', 'Event 10', null, clone $date->add(new \DateInterval('P1D')), 'Location 10', null)
        );

        $manager->flush();
    }
}


text:
using MiniBiggy.Storage.SqlServer;

namespace MiniBiggy {
    public class CreateOnSqlServerBuilder<T> : IChooseOptions<T>,
                                               IChooseConnectionString<T>,
                                               IChooseKeepingLatest<T>,
                                               IChooseTable<T> where T : new() {

        private string _connectionString;
        private int _keepingLatest = 100;

        public IChooseTable<T> WithConnectionString(string connectionString) {
            _connectionString = connectionString;
            return this;
        }
        public IChooseConnectionString<T> KeepingLatest(int versionsToKeep) {
            _keepingLatest = versionsToKeep;
            return this;
        }
        public IChooseSerializer<T> SavingOnTable(string tableName) {
            var dataStore = new SqlServerStorage(_connectionString, tableName, _keepingLatest);
            return new CreateListOfBuilder<T>(dataStore);
        }
    }

    public interface IChooseOptions<T> where T : new() {
        IChooseTable<T> WithConnectionString(string connectionString);
        IChooseConnectionString<T> KeepingLatest(int versionsToKeep = 100);
    }

    public interface IChooseConnectionString<T> where T : new() {
        IChooseTable<T> WithConnectionString(string connectionString);
    }

    public interface IChooseTable<T> where T : new() {
        IChooseSerializer<T> SavingOnTable(string tableName);
    }

    public interface IChooseKeepingLatest<T> where T: new() {
        IChooseConnectionString<T> KeepingLatest(int versionsToKeep = 100);
    }
}


text:
package kr.ac.kaist.se.tardis.scheduler;

import javax.sql.DataSource;

import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import kr.ac.kaist.se.tardis.scheduler.impl.AutowiringSpringBeanJobFactory;

@Configuration
public class SchedulerConfig {

	@Autowired
	private DataSource dataSource;

	@Autowired
	private ApplicationContext ctx;

	@Bean
	public SchedulerFactoryBean createScheduler() throws SchedulerException {
		SchedulerFactoryBean factory = new SchedulerFactoryBean();
		factory.setDataSource(dataSource);
		AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
		jobFactory.setApplicationContext(ctx);
		factory.setJobFactory(jobFactory);
		return factory;
	}

}


text:
av::EnemyGraphicsComponent::EnemyGraphicsComponent() = default;

void av::EnemyGraphicsComponent::Render(av::Entity& l_entity, sf::RenderWindow& l_window)
{
    auto enemy = dynamic_cast<av::Enemy&>(l_entity);

    enemy.GetHealthbar().Render(l_window);
    l_window.draw(enemy.GetBody());
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>Python magic methods (1) continued - Use magic methods to simplify code in URL matching in Python Pyramid application - Python consulting | Data structure | Algorithm | Python tutor | Python辅导</title>

    <link rel="canonical" href="http://localhost:4000/blog/2017/01/03/python-magic-methods-1-continued/">

    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <link rel="stylesheet" href="/css/hux-blog.min.css">

    <link rel="stylesheet" href="/css/syntax.css">

    <link href="http://cdn.staticfile.org/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">

            <button type="button" class="navbar-toggle">
                Toggle navigation

            </button>
            All about Python

                        Home

                        Tags

                        Python tutor service

                        Python

                        advanced features

Python magic methods (1) continued - Use magic methods to simplify code in URL matching in Python Pyramid application

                    Posted by All about Python on January 3, 2017

In the last article we reviewed the features of python magic methods, __new__() and __init__(). We will look into a real example today about how to use the magic methods to simplify code in Python, with example of URL matching in Pyramid framework.

Python magic methods (1) continued: Use descriptor, __new__ and metaclass to simplify URL Matching

Assume we have code like below. The method get_route_param will get the parameter from current request object in Pyramid by the name.

class TitlesContext(RootContext):
    def get_title(self):
        title = self._db.query(Title).get(self.get_route_param('title_id'))
        if not title:
            raise HTTPNotFound()
        return title

    def get_route_param(self, name):
        """
        Return the route parameter with the given ``name`` or raise a 404 if it
        is False-y.

        :rtype: unicode
        :raise: :exc:`pyramid.httpexceptions.HTTPNotFound`
        """
        value = self._request.matchdict[name].strip()
        if not value:
            raise HTTPNotFound()
        return value

In one pyramid application, for each Model-View-Controller, there could be multiple context object to query the database objects, thus the method get_route_param could exist in many places.

To improve, we can refactor the code by removing the get_route_param method by creating a new class, UrlMatch:

class TitlesContext(RootContext):

    title_id = UrlMatch()

    def get_title(self):
        title = self._db.query(Title).get(self.title_id)
        if not title:
            raise HTTPNotFound()
        return title

class UrlMatch(object):
    """
    Descriptor that will retrieve variable from the current requests matchdict.

    This should be used on a context class to allow retrieving matchdict variables
    from the context. When the context class uses :class:`UrlMatchMeta` as it's metaclass
    then ``UrlMatch`` will use the class attribute name as the key to extract from
    the matchdict. If the parent class of ``UrlMatch`` does not use `UrlMatchMeta`
    as its metaclass then the ``name`` argument must be given to ``UrlMatch``.

    Example with metaclass::

        class MyContext(object):

            __metaclass__ = UrlMatchMeta

            def __init__(self, request):
                self._request = request

            my_var = UrlMatch()
	 """

    def __init__(self, name=None):
        self.name = name

    def __get__(self, obj, type=None):
        if not obj:
            # Accessed via class, so return the descriptor
            return self

        if not self.name:
            raise ValueError(
                'UrlMatch property does not have a name to extract from matchdict. ' +
                'Use viewutils.UrlMatchMeta as your metaclass or pass a name to UrlMatch().'
            )

        try:
            return obj._request.matchdict[self.name]
        except KeyError:
            # Turn the KeyError into AttributeError because this will be accessed as
            # an attribute
            raise AttributeError("Matchdict does not have key '{}'".format(self.name))

class UrlMatchMeta(abc.ABCMeta):
    """
    Metaclass that provides support for the :class:`UrlMatch` descriptor.

    This metaclass will set the ``name`` attribute of each ``UrlMatch`` class attribute
    to the name of the class attribute.
    """

    def __new__(cls, classname, bases, classDict):
        new_class = super(UrlMatchMeta, cls).__new__(cls, classname, bases, classDict)
        cls._set_url_match_names(new_class)

        return new_class

    @staticmethod
    def _set_url_match_names(new_class):
        for key, attr in vars(new_class).items():
            if isinstance(attr, UrlMatch):
                attr.name = key

In this example, we used descriptor, metaclass __new__() to create this new class to simplify the code.
So how will this work?

__metaclass__ is used to redefine how a class is constructed. In UrlMatchMeta, __new__() is called to add the key in MyContext's attributes (in this case, "title_id") to the name of UrlMatch() object. Note __new__() is called automatically when calling the class name, even before __init__(). By using metaclass, we have created a UrlMatch object called title_id in TitlesContext and dynamically added title_id as its name.

__get__() descriptor is used to retrieve the attribute from request context. Python descriptor says if we call obj.d, it will look for d in obj's dictionary, and if d defines __get__(), it will call d.__get__(obj). In our case, when we call self.title_id (self is the TitlesContext), it finds __get__() method, so it will actually call title_id.__get__(TitlesContext). Since title_id is UrlMatch, it will return obj._request.matchdict[self.name], which is TitlesContext._request.matchdict["title_id"]. As such, we complete the same way as to look for title_id parameter in request (which is the same as get_route_param from the old way).

                        ← Previous Post

                        Next Post →

FEATURED TAGS

                                    Python

                                    Data Structure

                                    Function

                                    advanced features

FRIENDS

My Blog

                    Copyright © All about Python 2019

                    Theme by Hux |


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('postcode_api', '0011_auto_20150702_1812'),
    ]

    operations = [
        migrations.CreateModel(
            name='Country',
            fields=[
                ('gss_code', models.CharField(max_length=9, serialize=False, primary_key=True, db_index=True)),
                ('name', models.CharField(max_length=128, db_index=True)),
            ],
        ),
        migrations.AddField(
            model_name='postcodegsscode',
            name='country_gss_code',
            field=models.CharField(max_length=9, null=True, db_index=True),
        ),
    ]


text:
package pascalTriangle;

import java.util.Arrays;
import java.util.List;

//todo
public class pascalTriangleII {
	public List<Integer> getRow(int rowIndex) {
		Integer[] integers = new Integer[rowIndex + 1];
		Arrays.fill(integers, 1);
		for (int row = 0; row < rowIndex; row++) {
			for (int col = row; col > 0; col--) {
				integers[col] += integers[col - 1];
			}
		}
		return Arrays.asList(integers);
	}
}


text:
/* This file was generated by SableCC (http://www.sablecc.org/). */

package com.bju.cps450.node;

import com.bju.cps450.analysis.*;

@SuppressWarnings("nls")
public final class AArgument extends PArgument
{
    private PType _type_;
    private TIdentifier _identifier_;

    public AArgument()
    {
        // Constructor
    }

    public AArgument(
        @SuppressWarnings("hiding") PType _type_,
        @SuppressWarnings("hiding") TIdentifier _identifier_)
    {
        // Constructor
        setType(_type_);

        setIdentifier(_identifier_);

    }

    @Override
    public Object clone()
    {
        return new AArgument(
            cloneNode(this._type_),
            cloneNode(this._identifier_));
    }

    @Override
    public void apply(Switch sw)
    {
        ((Analysis) sw).caseAArgument(this);
    }

    public PType getType()
    {
        return this._type_;
    }

    public void setType(PType node)
    {
        if(this._type_ != null)
        {
            this._type_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        this._type_ = node;
    }

    public TIdentifier getIdentifier()
    {
        return this._identifier_;
    }

    public void setIdentifier(TIdentifier node)
    {
        if(this._identifier_ != null)
        {
            this._identifier_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        this._identifier_ = node;
    }

    @Override
    public String toString()
    {
        return ""
            + toString(this._type_)
            + toString(this._identifier_);
    }

    @Override
    void removeChild(@SuppressWarnings("unused") Node child)
    {
        // Remove child
        if(this._type_ == child)
        {
            this._type_ = null;
            return;
        }

        if(this._identifier_ == child)
        {
            this._identifier_ = null;
            return;
        }

        throw new RuntimeException("Not a child.");
    }

    @Override
    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
    {
        // Replace child
        if(this._type_ == oldChild)
        {
            setType((PType) newChild);
            return;
        }

        if(this._identifier_ == oldChild)
        {
            setIdentifier((TIdentifier) newChild);
            return;
        }

        throw new RuntimeException("Not a child.");
    }
}


text:
package com.freshplanet.ane.AirCrashlytics;

import java.util.HashMap;
import java.util.Map;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.freshplanet.ane.AirCrashlytics.functions.CrashFunction;
import com.freshplanet.ane.AirCrashlytics.functions.GetApiKeyFunction;
import com.freshplanet.ane.AirCrashlytics.functions.GetVersionFunction;
import com.freshplanet.ane.AirCrashlytics.functions.SetBoolFunction;
import com.freshplanet.ane.AirCrashlytics.functions.SetFloatFunction;
import com.freshplanet.ane.AirCrashlytics.functions.SetIntFunction;
import com.freshplanet.ane.AirCrashlytics.functions.SetStringFunction;
import com.freshplanet.ane.AirCrashlytics.functions.SetUserIdentifierFunction;
import com.freshplanet.ane.AirCrashlytics.functions.StartFunction;

public class AirCrashlyticsExtensionContext extends FREContext {
	@Override
	public void dispose()
	{
		AirCrashlyticsExtension.context = null;
	}

	@Override
	public Map<String, FREFunction> getFunctions() {
		Map<String, FREFunction> functions = new HashMap<String, FREFunction>();

		functions.put("AirCrashlyticsStart", new StartFunction());
		functions.put("AirCrashlyticsCrash", new CrashFunction());
		functions.put("AirCrashlyticsGetApiKey", new GetApiKeyFunction());
		functions.put("AirCrashlyticsGetVersion", new GetVersionFunction());
		functions.put("AirCrashlyticsSetUserIdentifier", new SetUserIdentifierFunction());
		functions.put("AirCrashlyticsSetBool", new SetBoolFunction());
		functions.put("AirCrashlyticsSetInt", new SetIntFunction());
		functions.put("AirCrashlyticsSetFloat", new SetFloatFunction());
		functions.put("AirCrashlyticsSetString", new SetStringFunction());
		return functions;
	}
}


text:
package org.fest.assertions.internal;

import static org.fest.assertions.error.ShouldContain.shouldContain;
import static org.fest.assertions.test.ErrorMessages.*;
import static org.fest.assertions.test.ExpectedException.none;
import static org.fest.assertions.test.FailureMessages.actualIsNull;
import static org.fest.assertions.test.ShortArrayFactory.*;
import static org.fest.assertions.test.TestData.someInfo;
import static org.fest.assertions.test.TestFailures.expectedAssertionErrorNotThrown;
import static org.fest.util.Collections.set;
import static org.mockito.Mockito.*;

import org.fest.assertions.core.AssertionInfo;
import org.fest.assertions.test.ExpectedException;
import org.junit.*;

/**
 * Tests for <code>{@link ShortArrays#assertContains(AssertionInfo, short[], short[])}</code>.
 *
 * @author Alex Ruiz
 */
public class ShortArrays_assertContains_Test {

  @Rule public ExpectedException thrown = none();

  private Failures failures;
  private short[] actual;
  private ShortArrays arrays;

  @Before public void setUp() {
    failures = spy(new Failures());
    actual = array(6, 8, 10);
    arrays = new ShortArrays();
    arrays.failures = failures;
  }

  @Test public void should_pass_if_actual_contains_given_values() {
    arrays.assertContains(someInfo(), actual, array(6));
  }

  @Test public void should_pass_if_actual_contains_given_values_in_different_order() {
    arrays.assertContains(someInfo(), actual, array(8, 10));
  }

  @Test public void should_pass_if_actual_contains_all_given_values() {
    arrays.assertContains(someInfo(), actual, array(6, 8, 10));
  }

  @Test public void should_pass_if_actual_contains_given_values_more_than_once() {
    actual = array(6, 8, 10, 10, 8);
    arrays.assertContains(someInfo(), actual, array(8));
  }

  @Test public void should_pass_if_actual_contains_given_values_even_if_duplicated() {
    arrays.assertContains(someInfo(), actual, array(6, 6));
  }

  @Test public void should_throw_error_if_array_of_values_to_look_for_is_empty() {
    thrown.expectIllegalArgumentException(valuesToLookForIsEmpty());
    arrays.assertContains(someInfo(), actual, emptyArray());
  }

  @Test public void should_throw_error_if_array_of_values_to_look_for_is_null() {
    thrown.expectNullPointerException(valuesToLookForIsNull());
    arrays.assertContains(someInfo(), actual, null);
  }

  @Test public void should_fail_if_actual_is_null() {
    thrown.expectAssertionError(actualIsNull());
    arrays.assertContains(someInfo(), null, array(8));
  }

  @Test public void should_fail_if_actual_does_not_contain_values() {
    AssertionInfo info = someInfo();
    short[] expected = { 6, 8, 9 };
    try {
      arrays.assertContains(info, actual, expected);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldContain(actual, expected, set((short)9)));
      return;
    }
    throw expectedAssertionErrorNotThrown();
  }
}


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/run_tests_velodyne_driver_rostest"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang)
  INCLUDE(CMakeFiles/run_tests_velodyne_driver_rostest.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)


text:
using CocosSharp;

namespace tests
{
    public class CameraZoomTest : TestCocosNodeDemo
    {
        private float m_z;

        public CameraZoomTest()
        {
        }

        protected override void AddedToScene()
        {
            base.AddedToScene();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

			CCSprite sprite;
			CCCamera cam;

			// LEFT
			sprite = new CCSprite(TestResource.s_pPathGrossini);
			AddChild(sprite, 0);
			sprite.Position = (new CCPoint(s.Width / 4 * 1, s.Height / 2));
			cam = sprite.Camera;
//			cam.SetEyeXyz(0, 0, 415 / 2);
//			cam.SetCenterXyz(0, 0, 0);

			// CENTER
			sprite = new CCSprite(TestResource.s_pPathGrossini);
			AddChild(sprite, 0, 40);
			sprite.Position = (new CCPoint(s.Width / 4 * 2, s.Height / 2));

			// RIGHT
			sprite = new CCSprite(TestResource.s_pPathGrossini);
			AddChild(sprite, 0, 20);
			sprite.Position = (new CCPoint(s.Width / 4 * 3, s.Height / 2));

			m_z = 0;

			Schedule ();
		}

        public override void Update(float dt)
        {
            CCNode sprite;
            CCCamera cam;

            m_z += dt * 100;

            sprite = GetChildByTag(20);
            cam = sprite.Camera;
            //cam.SetEyeXyz(0, 0, m_z);

            sprite = GetChildByTag(40);
            cam = sprite.Camera;
            //cam.SetEyeXyz(0, 0, -m_z);
        }

        public override void OnEnter()
        {
            base.OnEnter();
            //Scene.Director.Projection = (CCDirectorProjection.Projection3D);
        }

        public override void OnExit()
        {
            //Scene.Director.Projection = (CCDirectorProjection.Projection2D);
            base.OnExit();
        }

        public override string title()
        {
            return "Camera Zoom test";
        }
    }
}


text:
import {Component} from '@angular/core';

@Component({
  selector: 'tables',
  template: `<router-outlet></router-outlet>`
})
export class Tables {

  constructor() {
  }
}


text:
<!doctype html>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="description" content="网站描述">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>iUAP Design</title>

		<meta name="mobile-web-app-capable" content="yes">

		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-title" content="UDEMO">
		<link rel="apple-touch-icon-precomposed" href="../../static/ios-desktop.png">

		<meta name="msapplication-TileColor" content="#3372DF">

		<link rel="stylesheet" href="http://design.yyuap.com/static/uui-original/1.0.1/fonts/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="http://design.yyuap.com/static/uui-original/1.0.3/css/u.css">
		<link rel="stylesheet" href="../../../index.css">

			              		iUAP Design

center-title

			            </sapn>


text:
@(bookBarCode : String)

@import helper._
@import helper.twitterBootstrap._
@import models.Messages;

@templates.main {
    @String.format(Messages.tr("info.bookWithBarcdIsAdded"), bookBarCode)
    @templates.homeButton()
}


text:
<?php

namespace Achsoft\Component\ErrorHandler\Exception;

use Achsoft\Component\ErrorHandler\Exception\ErrorException;

/**
 * Thrown on E_NOTICE error.
 *
 * @author Achmad F. Ibrahim <acfatah@gmail.com>
 * @package Achsoft\Component\ErrorHandler\Exception
 * @version 0.2.1
 */
class NoticeException extends ErrorException
{

}


text:
package org.junit;

import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.junit.internal.ArrayComparisonFailure;
import org.junit.internal.ExactComparisonCriteria;
import org.junit.internal.InexactComparisonCriteria;

/**
 * A set of assertion methods useful for writing tests. Only failed assertions
 * are recorded. These methods can be used directly:
 * Assert.assertEquals(...), however, they read better if they
 * are referenced through static import:
 *
 *

 * import static org.junit.Assert.*;
 *    ...
 *    assertEquals(...);
 *

 *
 * @see AssertionError
 * @since 4.0
 */
public class Assert {
    /**
     * Protect constructor since it is a static only class
     */
    protected Assert() {
    }

    /**
     * Asserts that a condition is true. If it isn't it throws an
     * {@link AssertionError} with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param condition condition to be checked
     */
    static public void assertTrue(String message, boolean condition) {
        if (!condition) {
            fail(message);
        }
    }

    /**
     * Asserts that a condition is true. If it isn't it throws an
     * {@link AssertionError} without a message.
     *
     * @param condition condition to be checked
     */
    static public void assertTrue(boolean condition) {
        assertTrue(null, condition);
    }

    /**
     * Asserts that a condition is false. If it isn't it throws an
     * {@link AssertionError} with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param condition condition to be checked
     */
    static public void assertFalse(String message, boolean condition) {
        assertTrue(message, !condition);
    }

    /**
     * Asserts that a condition is false. If it isn't it throws an
     * {@link AssertionError} without a message.
     *
     * @param condition condition to be checked
     */
    static public void assertFalse(boolean condition) {
        assertFalse(null, condition);
    }

    /**
     * Fails a test with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @see AssertionError
     */
    static public void fail(String message) {
        if (message == null) {
            throw new AssertionError();
        }
        throw new AssertionError(message);
    }

    /**
     * Fails a test with no message.
     */
    static public void fail() {
        fail(null);
    }

    /**
     * Asserts that two objects are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message. If
     * expected and actual are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expected expected value
     * @param actual actual value
     */
    static public void assertEquals(String message, Object expected,
            Object actual) {
        if (equalsRegardingNull(expected, actual)) {
            return;
        } else if (expected instanceof String && actual instanceof String) {
            String cleanMessage = message == null ? "" : message;
            throw new ComparisonFailure(cleanMessage, (String) expected,
                    (String) actual);
        } else {
            failNotEquals(message, expected, actual);
        }
    }

    private static boolean equalsRegardingNull(Object expected, Object actual) {
        if (expected == null) {
            return actual == null;
        }

        return isEquals(expected, actual);
    }

    private static boolean isEquals(Object expected, Object actual) {
        return expected.equals(actual);
    }

    /**
     * Asserts that two objects are equal. If they are not, an
     * {@link AssertionError} without a message is thrown. If
     * expected and actual are null,
     * they are considered equal.
     *
     * @param expected expected value
     * @param actual the value to check against expected
     */
    static public void assertEquals(Object expected, Object actual) {
        assertEquals(null, expected, actual);
    }

    /**
     * Asserts that two objects are not equals. If they are, an
     * {@link AssertionError} is thrown with the given message. If
     * unexpected and actual are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param unexpected unexpected value to check
     * @param actual the value to check against unexpected
     */
    static public void assertNotEquals(String message, Object unexpected,
            Object actual) {
        if (equalsRegardingNull(unexpected, actual)) {
            failEquals(message, actual);
        }
    }

    /**
     * Asserts that two objects are not equals. If they are, an
     * {@link AssertionError} without a message is thrown. If
     * unexpected and actual are null,
     * they are considered equal.
     *
     * @param unexpected unexpected value to check
     * @param actual the value to check against unexpected
     */
    static public void assertNotEquals(Object unexpected, Object actual) {
        assertNotEquals(null, unexpected, actual);
    }

    private static void failEquals(String message, Object actual) {
        String formatted = "Values should be different. ";
        if (message != null) {
            formatted = message + ". ";
        }

        formatted += "Actual: " + actual;
        fail(formatted);
    }

    /**
     * Asserts that two longs are not equals. If they are, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param unexpected unexpected value to check
     * @param actual the value to check against unexpected
     */
    static public void assertNotEquals(String message, long unexpected, long actual) {
        if (unexpected == actual) {
            failEquals(message, Long.valueOf(actual));
        }
    }

    /**
     * Asserts that two longs are not equals. If they are, an
     * {@link AssertionError} without a message is thrown.
     *
     * @param unexpected unexpected value to check
     * @param actual the value to check against unexpected
     */
    static public void assertNotEquals(long unexpected, long actual) {
        assertNotEquals(null, unexpected, actual);
    }

    /**
     * Asserts that two doubles are not equal to within a positive delta.
     * If they are, an {@link AssertionError} is thrown with the given
     * message. If the unexpected value is infinity then the delta value is
     * ignored. NaNs are considered equal:
     * assertNotEquals(Double.NaN, Double.NaN, *) fails
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param unexpected unexpected value
     * @param actual the value to check against unexpected
     * @param delta the maximum delta between unexpected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertNotEquals(String message, double unexpected,
            double actual, double delta) {
        if (!doubleIsDifferent(unexpected, actual, delta)) {
            failEquals(message, Double.valueOf(actual));
        }
    }

    /**
     * Asserts that two doubles are not equal to within a positive delta.
     * If they are, an {@link AssertionError} is thrown. If the unexpected
     * value is infinity then the delta value is ignored.NaNs are considered
     * equal: assertNotEquals(Double.NaN, Double.NaN, *) fails
     *
     * @param unexpected unexpected value
     * @param actual the value to check against unexpected
     * @param delta the maximum delta between unexpected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertNotEquals(double unexpected, double actual, double delta) {
        assertNotEquals(null, unexpected, actual, delta);
    }

    /**
     * Asserts that two floats are not equal to within a positive delta.
     * If they are, an {@link AssertionError} is thrown. If the unexpected
     * value is infinity then the delta value is ignored.NaNs are considered
     * equal: assertNotEquals(Float.NaN, Float.NaN, *) fails
     *
     * @param unexpected unexpected value
     * @param actual the value to check against unexpected
     * @param delta the maximum delta between unexpected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertNotEquals(float unexpected, float actual, float delta) {
        assertNotEquals(null, unexpected, actual, delta);
    }

    /**
     * Asserts that two object arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message. If
     * expecteds and actuals are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
     * expected values.
     * @param actuals Object array or array of arrays (multi-dimensional array) with
     * actual values
     */
    public static void assertArrayEquals(String message, Object[] expecteds,
            Object[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two object arrays are equal. If they are not, an
     * {@link AssertionError} is thrown. If expected and
     * actual are null, they are considered
     * equal.
     *
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
     * expected values
     * @param actuals Object array or array of arrays (multi-dimensional array) with
     * actual values
     */
    public static void assertArrayEquals(Object[] expecteds, Object[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two boolean arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message. If
     * expecteds and actuals are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds boolean array with expected values.
     * @param actuals boolean array with expected values.
     */
    public static void assertArrayEquals(String message, boolean[] expecteds,
            boolean[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two boolean arrays are equal. If they are not, an
     * {@link AssertionError} is thrown. If expected and
     * actual are null, they are considered
     * equal.
     *
     * @param expecteds boolean array with expected values.
     * @param actuals boolean array with expected values.
     */
    public static void assertArrayEquals(boolean[] expecteds, boolean[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two byte arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds byte array with expected values.
     * @param actuals byte array with actual values
     */
    public static void assertArrayEquals(String message, byte[] expecteds,
            byte[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two byte arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds byte array with expected values.
     * @param actuals byte array with actual values
     */
    public static void assertArrayEquals(byte[] expecteds, byte[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two char arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds char array with expected values.
     * @param actuals char array with actual values
     */
    public static void assertArrayEquals(String message, char[] expecteds,
            char[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two char arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds char array with expected values.
     * @param actuals char array with actual values
     */
    public static void assertArrayEquals(char[] expecteds, char[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two short arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds short array with expected values.
     * @param actuals short array with actual values
     */
    public static void assertArrayEquals(String message, short[] expecteds,
            short[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two short arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds short array with expected values.
     * @param actuals short array with actual values
     */
    public static void assertArrayEquals(short[] expecteds, short[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two int arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds int array with expected values.
     * @param actuals int array with actual values
     */
    public static void assertArrayEquals(String message, int[] expecteds,
            int[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two int arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds int array with expected values.
     * @param actuals int array with actual values
     */
    public static void assertArrayEquals(int[] expecteds, int[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two long arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds long array with expected values.
     * @param actuals long array with actual values
     */
    public static void assertArrayEquals(String message, long[] expecteds,
            long[] actuals) throws ArrayComparisonFailure {
        internalArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two long arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds long array with expected values.
     * @param actuals long array with actual values
     */
    public static void assertArrayEquals(long[] expecteds, long[] actuals) {
        assertArrayEquals(null, expecteds, actuals);
    }

    /**
     * Asserts that two double arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds double array with expected values.
     * @param actuals double array with actual values
     * @param delta the maximum delta between expecteds[i] and
     * actuals[i] for which both numbers are still
     * considered equal.
     */
    public static void assertArrayEquals(String message, double[] expecteds,
            double[] actuals, double delta) throws ArrayComparisonFailure {
        new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two double arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds double array with expected values.
     * @param actuals double array with actual values
     * @param delta the maximum delta between expecteds[i] and
     * actuals[i] for which both numbers are still
     * considered equal.
     */
    public static void assertArrayEquals(double[] expecteds, double[] actuals, double delta) {
        assertArrayEquals(null, expecteds, actuals, delta);
    }

    /**
     * Asserts that two float arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds float array with expected values.
     * @param actuals float array with actual values
     * @param delta the maximum delta between expecteds[i] and
     * actuals[i] for which both numbers are still
     * considered equal.
     */
    public static void assertArrayEquals(String message, float[] expecteds,
            float[] actuals, float delta) throws ArrayComparisonFailure {
        new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two float arrays are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expecteds float array with expected values.
     * @param actuals float array with actual values
     * @param delta the maximum delta between expecteds[i] and
     * actuals[i] for which both numbers are still
     * considered equal.
     */
    public static void assertArrayEquals(float[] expecteds, float[] actuals, float delta) {
        assertArrayEquals(null, expecteds, actuals, delta);
    }

    /**
     * Asserts that two object arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message. If
     * expecteds and actuals are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
     * expected values.
     * @param actuals Object array or array of arrays (multi-dimensional array) with
     * actual values
     */
    private static void internalArrayEquals(String message, Object expecteds,
            Object actuals) throws ArrayComparisonFailure {
        new ExactComparisonCriteria().arrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two doubles are equal to within a positive delta.
     * If they are not, an {@link AssertionError} is thrown with the given
     * message. If the expected value is infinity then the delta value is
     * ignored. NaNs are considered equal:
     * assertEquals(Double.NaN, Double.NaN, *) passes
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expected expected value
     * @param actual the value to check against expected
     * @param delta the maximum delta between expected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertEquals(String message, double expected,
            double actual, double delta) {
        if (doubleIsDifferent(expected, actual, delta)) {
            failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual));
        }
    }

    /**
     * Asserts that two floats are equal to within a positive delta.
     * If they are not, an {@link AssertionError} is thrown with the given
     * message. If the expected value is infinity then the delta value is
     * ignored. NaNs are considered equal:
     * assertEquals(Float.NaN, Float.NaN, *) passes
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expected expected value
     * @param actual the value to check against expected
     * @param delta the maximum delta between expected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertEquals(String message, float expected,
            float actual, float delta) {
        if (floatIsDifferent(expected, actual, delta)) {
            failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual));
        }
    }

    /**
     * Asserts that two floats are not equal to within a positive delta.
     * If they are, an {@link AssertionError} is thrown with the given
     * message. If the unexpected value is infinity then the delta value is
     * ignored. NaNs are considered equal:
     * assertNotEquals(Float.NaN, Float.NaN, *) fails
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param unexpected unexpected value
     * @param actual the value to check against unexpected
     * @param delta the maximum delta between unexpected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertNotEquals(String message, float unexpected,
            float actual, float delta) {
        if (!floatIsDifferent(unexpected, actual, delta)) {
            failEquals(message, Float.valueOf(actual));
        }
    }

    static private boolean doubleIsDifferent(double d1, double d2, double delta) {
        if (Double.compare(d1, d2) == 0) {
            return false;
        }
        if ((Math.abs(d1 - d2) <= delta)) {
            return false;
        }

        return true;
    }

    static private boolean floatIsDifferent(float f1, float f2, float delta) {
        if (Float.compare(f1, f2) == 0) {
            return false;
        }
        if ((Math.abs(f1 - f2) <= delta)) {
            return false;
        }

        return true;
    }

    /**
     * Asserts that two longs are equal. If they are not, an
     * {@link AssertionError} is thrown.
     *
     * @param expected expected long value.
     * @param actual actual long value
     */
    static public void assertEquals(long expected, long actual) {
        assertEquals(null, expected, actual);
    }

    /**
     * Asserts that two longs are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expected long expected value.
     * @param actual long actual value
     */
    static public void assertEquals(String message, long expected, long actual) {
        if (expected != actual) {
            failNotEquals(message, Long.valueOf(expected), Long.valueOf(actual));
        }
    }

    /**
     * @deprecated Use
     *             assertEquals(double expected, double actual, double delta)
     *             instead
     */
    @Deprecated
    static public void assertEquals(double expected, double actual) {
        assertEquals(null, expected, actual);
    }

    /**
     * @deprecated Use
     *             assertEquals(String message, double expected, double actual, double delta)
     *             instead
     */
    @Deprecated
    static public void assertEquals(String message, double expected,
            double actual) {
        fail("Use assertEquals(expected, actual, delta) to compare floating-point numbers");
    }

    /**
     * Asserts that two doubles are equal to within a positive delta.
     * If they are not, an {@link AssertionError} is thrown. If the expected
     * value is infinity then the delta value is ignored.NaNs are considered
     * equal: assertEquals(Double.NaN, Double.NaN, *) passes
     *
     * @param expected expected value
     * @param actual the value to check against expected
     * @param delta the maximum delta between expected and
     * actual for which both numbers are still
     * considered equal.
     */
    static public void assertEquals(double expected, double actual, double delta) {
        assertEquals(null, expected, actual, delta);
    }

    /**
     * Asserts that two floats are equal to within a positive delta.
     * If they are not, an {@link AssertionError} is thrown. If the expected
     * value is infinity then the delta value is ignored. NaNs are considered
     * equal: assertEquals(Float.NaN, Float.NaN, *) passes
     *
     * @param expected expected value
     * @param actual the value to check against expected
     * @param delta the maximum delta between expected and
     * actual for which both numbers are still
     * considered equal.
     */

    static public void assertEquals(float expected, float actual, float delta) {
        assertEquals(null, expected, actual, delta);
    }

    /**
     * Asserts that an object isn't null. If it is an {@link AssertionError} is
     * thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param object Object to check or null
     */
    static public void assertNotNull(String message, Object object) {
        assertTrue(message, object != null);
    }

    /**
     * Asserts that an object isn't null. If it is an {@link AssertionError} is
     * thrown.
     *
     * @param object Object to check or null
     */
    static public void assertNotNull(Object object) {
        assertNotNull(null, object);
    }

    /**
     * Asserts that an object is null. If it is not, an {@link AssertionError}
     * is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param object Object to check or null
     */
    static public void assertNull(String message, Object object) {
        if (object == null) {
            return;
        }
        failNotNull(message, object);
    }

    /**
     * Asserts that an object is null. If it isn't an {@link AssertionError} is
     * thrown.
     *
     * @param object Object to check or null
     */
    static public void assertNull(Object object) {
        assertNull(null, object);
    }

    static private void failNotNull(String message, Object actual) {
        String formatted = "";
        if (message != null) {
            formatted = message + " ";
        }
        fail(formatted + "expected null, but was:<" + actual + ">");
    }

    /**
     * Asserts that two objects refer to the same object. If they are not, an
     * {@link AssertionError} is thrown with the given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expected the expected object
     * @param actual the object to compare to expected
     */
    static public void assertSame(String message, Object expected, Object actual) {
        if (expected == actual) {
            return;
        }
        failNotSame(message, expected, actual);
    }

    /**
     * Asserts that two objects refer to the same object. If they are not the
     * same, an {@link AssertionError} without a message is thrown.
     *
     * @param expected the expected object
     * @param actual the object to compare to expected
     */
    static public void assertSame(Object expected, Object actual) {
        assertSame(null, expected, actual);
    }

    /**
     * Asserts that two objects do not refer to the same object. If they do
     * refer to the same object, an {@link AssertionError} is thrown with the
     * given message.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param unexpected the object you don't expect
     * @param actual the object to compare to unexpected
     */
    static public void assertNotSame(String message, Object unexpected,
            Object actual) {
        if (unexpected == actual) {
            failSame(message);
        }
    }

    /**
     * Asserts that two objects do not refer to the same object. If they do
     * refer to the same object, an {@link AssertionError} without a message is
     * thrown.
     *
     * @param unexpected the object you don't expect
     * @param actual the object to compare to unexpected
     */
    static public void assertNotSame(Object unexpected, Object actual) {
        assertNotSame(null, unexpected, actual);
    }

    static private void failSame(String message) {
        String formatted = "";
        if (message != null) {
            formatted = message + " ";
        }
        fail(formatted + "expected not same");
    }

    static private void failNotSame(String message, Object expected,
            Object actual) {
        String formatted = "";
        if (message != null) {
            formatted = message + " ";
        }
        fail(formatted + "expected same:<" + expected + "> was not:<" + actual
                + ">");
    }

    static private void failNotEquals(String message, Object expected,
            Object actual) {
        fail(format(message, expected, actual));
    }

    static String format(String message, Object expected, Object actual) {
        String formatted = "";
        if (message != null && !message.equals("")) {
            formatted = message + " ";
        }
        String expectedString = String.valueOf(expected);
        String actualString = String.valueOf(actual);
        if (expectedString.equals(actualString)) {
            return formatted + "expected: "
                    + formatClassAndValue(expected, expectedString)
                    + " but was: " + formatClassAndValue(actual, actualString);
        } else {
            return formatted + "expected:<" + expectedString + "> but was:<"
                    + actualString + ">";
        }
    }

    private static String formatClassAndValue(Object value, String valueString) {
        String className = value == null ? "null" : value.getClass().getName();
        return className + "<" + valueString + ">";
    }

    /**
     * Asserts that two object arrays are equal. If they are not, an
     * {@link AssertionError} is thrown with the given message. If
     * expecteds and actuals are null,
     * they are considered equal.
     *
     * @param message the identifying message for the {@link AssertionError} (null
     * okay)
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
     * expected values.
     * @param actuals Object array or array of arrays (multi-dimensional array) with
     * actual values
     * @deprecated use assertArrayEquals
     */
    @Deprecated
    public static void assertEquals(String message, Object[] expecteds,
            Object[] actuals) {
        assertArrayEquals(message, expecteds, actuals);
    }

    /**
     * Asserts that two object arrays are equal. If they are not, an
     * {@link AssertionError} is thrown. If expected and
     * actual are null, they are considered
     * equal.
     *
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
     * expected values
     * @param actuals Object array or array of arrays (multi-dimensional array) with
     * actual values
     * @deprecated use assertArrayEquals
     */
    @Deprecated
    public static void assertEquals(Object[] expecteds, Object[] actuals) {
        assertArrayEquals(expecteds, actuals);
    }

    /**
     * Asserts that actual satisfies the condition specified by
     * matcher. If not, an {@link AssertionError} is thrown with
     * information about the matcher and failing value. Example:
     *
     *

     *   assertThat(0, is(1)); // fails:
     *     // failure message:
     *     // expected: is <1>
     *     // got value: <0>
     *   assertThat(0, is(not(1))) // passes
     *

     *
     * org.hamcrest.Matcher does not currently document the meaning
     * of its type parameter T.  This method assumes that a matcher
     * typed as Matcher<T> can be meaningfully applied only
     * to values that could be assigned to a variable of type T.
     *
     * @param <T> the static type accepted by the matcher (this can flag obvious
     * compile-time problems such as {@code assertThat(1, is("a"))}
     * @param actual the computed value being compared
     * @param matcher an expression, built of {@link Matcher}s, specifying allowed
     * values
     * @see org.hamcrest.CoreMatchers
     * @see org.hamcrest.MatcherAssert
     */
    public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
        assertThat("", actual, matcher);
    }

    /**
     * Asserts that actual satisfies the condition specified by
     * matcher. If not, an {@link AssertionError} is thrown with
     * the reason and information about the matcher and failing value. Example:
     *
     *

     *   assertThat("Help! Integers don't work", 0, is(1)); // fails:
     *     // failure message:
     *     // Help! Integers don't work
     *     // expected: is <1>
     *     // got value: <0>
     *   assertThat("Zero is one", 0, is(not(1))) // passes
     *

     *
     * org.hamcrest.Matcher does not currently document the meaning
     * of its type parameter T.  This method assumes that a matcher
     * typed as Matcher<T> can be meaningfully applied only
     * to values that could be assigned to a variable of type T.
     *
     * @param reason additional information about the error
     * @param <T> the static type accepted by the matcher (this can flag obvious
     * compile-time problems such as {@code assertThat(1, is("a"))}
     * @param actual the computed value being compared
     * @param matcher an expression, built of {@link Matcher}s, specifying allowed
     * values
     * @see org.hamcrest.CoreMatchers
     * @see org.hamcrest.MatcherAssert
     */
    public static <T> void assertThat(String reason, T actual,
            Matcher<? super T> matcher) {
        MatcherAssert.assertThat(reason, actual, matcher);
    }
}


text:
// JOOS1:PARSER_WEEDER,PARSER_EXCEPTION
// JOOS2:PARSER_WEEDER,PARSER_EXCEPTION
// JAVAC:
/**
 * Parser/weeder:
 * - Methods must have a modifier
 */
public class Je_1_Methods_MissingAccessModifier {

    public Je_1_Methods_MissingAccessModifier() { }

    public static int test() {
	return 123;
    }

    int bar() {
	return 123;
    }

}


text:
namespace kaldi {

int32 NumFrames(int32 nsamp,
                const FrameExtractionOptions &opts) {
  int32 frame_shift = opts.WindowShift();
  int32 frame_length = opts.WindowSize();
  KALDI_ASSERT(frame_shift != 0 && frame_length != 0);
  if (opts.snip_edges) {
    if (static_cast<int32>(nsamp) < frame_length)
      return 0;
    else
      return (1 + ((nsamp - frame_length) / frame_shift));
      // view the expression above as: nsamp-frame_length is how much room we
      // have to shift the frame within the waveform; frame_shift is how much
      // we shift it each time and the ratio is how many times we can shift
      // it (integer arithmetic rounds down).
  } else {
    return (int32)(nsamp * 1.0f / frame_shift + 0.5f);
    // if --snip-edges=false, the number of frames would be determined by
    // rounding the (file-length / frame-shift) to the nearest integer
  }
}

void Dither(VectorBase<BaseFloat> *waveform, BaseFloat dither_value) {
  for (int32 i = 0; i < waveform->Dim(); i++)
    (*waveform)(i) += RandGauss() * dither_value;
}

void Preemphasize(VectorBase<BaseFloat> *waveform, BaseFloat preemph_coeff) {
  if (preemph_coeff == 0.0) return;
  KALDI_ASSERT(preemph_coeff >= 0.0 && preemph_coeff <= 1.0);
  for (int32 i = waveform->Dim()-1; i > 0; i--)
    (*waveform)(i) -= preemph_coeff * (*waveform)(i-1);
  (*waveform)(0) -= preemph_coeff * (*waveform)(0);
}

FeatureWindowFunction::FeatureWindowFunction(const FrameExtractionOptions &opts) {
  int32 frame_length = opts.WindowSize();
  KALDI_ASSERT(frame_length > 0);
  window.Resize(frame_length);
  for (int32 i = 0; i < frame_length; i++) {
    BaseFloat i_fl = static_cast<BaseFloat>(i);
    if (opts.window_type == "hanning") {
      window(i) = 0.5  - 0.5*cos(M_2PI * i_fl / (frame_length-1));
    } else if (opts.window_type == "hamming") {
      window(i) = 0.54 - 0.46*cos(M_2PI * i_fl / (frame_length-1));
    } else if (opts.window_type == "povey") {  // like hamming but goes to zero at edges.
      window(i) = pow(0.5 - 0.5*cos(M_2PI * i_fl / (frame_length-1)), 0.85);
    } else if (opts.window_type == "rectangular") {
      window(i) = 1.0;
    } else {
      KALDI_ERR << "Invalid window type " << opts.window_type;
    }
  }
}

// ExtractWindow extracts a windowed frame of waveform with a power-of-two,
// padded size.  It does mean subtraction, pre-emphasis and dithering as
// requested.

void ExtractWindow(const VectorBase<BaseFloat> &wave,
                   int32 f,  // with 0 <= f < NumFrames(feats, opts)
                   const FrameExtractionOptions &opts,
                   const FeatureWindowFunction &window_function,
                   Vector<BaseFloat> *window,
                   BaseFloat *log_energy_pre_window) {
  int32 frame_shift = opts.WindowShift();
  int32 frame_length = opts.WindowSize();
  KALDI_ASSERT(window_function.window.Dim() == frame_length);
  KALDI_ASSERT(frame_shift != 0 && frame_length != 0);

  Vector<BaseFloat> wave_part(frame_length);
  if (opts.snip_edges) {
    int32 start = frame_shift*f, end = start + frame_length;
    KALDI_ASSERT(start >= 0 && end <= wave.Dim());
    wave_part.CopyFromVec(wave.Range(start, frame_length));
  } else {
    // If opts.snip_edges = false, we allow the frames to go slightly over the
    // edges of the file; we'll extend the data by reflection.
    int32 mid = frame_shift * (f + 0.5),
        begin = mid - frame_length / 2,
        end = begin + frame_length,
        begin_limited = std::max<int32>(0, begin),
        end_limited = std::min(end, wave.Dim()),
        length_limited = end_limited - begin_limited;

    // Copy the main part.  Usually this will be the entire window.
    wave_part.Range(begin_limited - begin, length_limited).
        CopyFromVec(wave.Range(begin_limited, length_limited));

    // Deal with any end effects by reflection, if needed.  This code will
    // rarely be reached, so we don't concern ourselves with efficiency.
    for (int32 f = begin; f < 0; f++) {
      int32 reflected_f = -f;
      // The next statement will only have an effect in the case of files
      // shorter than a single frame, it's to avoid a crash in those cases.
      reflected_f = reflected_f % wave.Dim();
      wave_part(f - begin) = wave(reflected_f);
    }
    for (int32 f = wave.Dim(); f < end; f++) {
      int32 distance_to_end = f - wave.Dim();
      // The next statement will only have an effect in the case of files
      // shorter than a single frame, it's to avoid a crash in those cases.
      distance_to_end = distance_to_end % wave.Dim();
      int32 reflected_f = wave.Dim() - 1 - distance_to_end;
      wave_part(f - begin) = wave(reflected_f);
    }
  }
  KALDI_ASSERT(window != NULL);
  int32 frame_length_padded = opts.PaddedWindowSize();

  if (window->Dim() != frame_length_padded)
    window->Resize(frame_length_padded);

  SubVector<BaseFloat> window_part(*window, 0, frame_length);
  window_part.CopyFromVec(wave_part);

  if (opts.dither != 0.0) Dither(&window_part, opts.dither);

  if (opts.remove_dc_offset)
    window_part.Add(-window_part.Sum() / frame_length);

  if (log_energy_pre_window != NULL) {
    BaseFloat energy = std::max(VecVec(window_part, window_part),
                                std::numeric_limits<BaseFloat>::min());
    *log_energy_pre_window = log(energy);
  }

  if (opts.preemph_coeff != 0.0)
    Preemphasize(&window_part, opts.preemph_coeff);

  window_part.MulElements(window_function.window);

  if (frame_length != frame_length_padded)
    SubVector<BaseFloat>(*window, frame_length,
                         frame_length_padded-frame_length).SetZero();
}

void ExtractWaveformRemainder(const VectorBase<BaseFloat> &wave,
                              const FrameExtractionOptions &opts,
                              Vector<BaseFloat> *wave_remainder) {
  int32 frame_shift = opts.WindowShift();
  int32 num_frames = NumFrames(wave.Dim(), opts);
  // offset is the amount at the start that has been extracted.
  int32 offset = num_frames * frame_shift;
  KALDI_ASSERT(wave_remainder != NULL);
  int32 remaining_len = wave.Dim() - offset;
  wave_remainder->Resize(remaining_len);
  KALDI_ASSERT(remaining_len >= 0);
  if (remaining_len > 0)
    wave_remainder->CopyFromVec(SubVector<BaseFloat>(wave, offset, remaining_len));
}

void ComputePowerSpectrum(VectorBase<BaseFloat> *waveform) {
  int32 dim = waveform->Dim();

  // no, letting it be non-power-of-two for now.
  // KALDI_ASSERT(dim > 0 && (dim & (dim-1) == 0));  // make sure a power of two.. actually my FFT code
  // does not require this (dan) but this is better in case we use different code [dan].

  // RealFft(waveform, true);  // true == forward (not inverse) FFT; makes no difference here,
  // as we just want power spectrum.

  // now we have in waveform, first half of complex spectrum
  // it's stored as [real0, realN/2-1, real1, im1, real2, im2, ...]
  int32 half_dim = dim/2;
  BaseFloat first_energy = (*waveform)(0) * (*waveform)(0),
      last_energy = (*waveform)(1) * (*waveform)(1);  // handle this special case
  for (int32 i = 1; i < half_dim; i++) {
    BaseFloat real = (*waveform)(i*2), im = (*waveform)(i*2 + 1);
    (*waveform)(i) = real*real + im*im;
  }
  (*waveform)(0) = first_energy;
  (*waveform)(half_dim) = last_energy;  // Will actually never be used, and anyway
  // if the signal has been bandlimited sensibly this should be zero.
}

DeltaFeatures::DeltaFeatures(const DeltaFeaturesOptions &opts): opts_(opts) {
  KALDI_ASSERT(opts.order >= 0 && opts.order < 1000);  // just make sure we don't get binary junk.
  // opts will normally be 2 or 3.
  KALDI_ASSERT(opts.window > 0 && opts.window < 1000);  // again, basic sanity check.
  // normally the window size will be two.

  scales_.resize(opts.order+1);
  scales_[0].Resize(1);
  scales_[0](0) = 1.0;  // trivial window for 0th order delta [i.e. baseline feats]

  for (int32 i = 1; i <= opts.order; i++) {
    Vector<BaseFloat> &prev_scales = scales_[i-1],
        &cur_scales = scales_[i];
    int32 window = opts.window;  // this code is designed to still
    // work if instead we later make it an array and do opts.window[i-1],
    // or something like that. "window" is a parameter specifying delta-window
    // width which is actually 2*window + 1.
    KALDI_ASSERT(window != 0);
    int32 prev_offset = (static_cast<int32>(prev_scales.Dim()-1))/2,
        cur_offset = prev_offset + window;
    cur_scales.Resize(prev_scales.Dim() + 2*window);  // also zeros it.

    BaseFloat normalizer = 0.0;
    for (int32 j = -window; j <= window; j++) {
      normalizer += j*j;
      for (int32 k = -prev_offset; k <= prev_offset; k++) {
        cur_scales(j+k+cur_offset) +=
            static_cast<BaseFloat>(j) * prev_scales(k+prev_offset);
      }
    }
    cur_scales.Scale(1.0 / normalizer);
  }
}

void DeltaFeatures::Process(const MatrixBase<BaseFloat> &input_feats,
                            int32 frame,
                            VectorBase<BaseFloat> *output_frame) const {
  KALDI_ASSERT(frame < input_feats.NumRows());
  int32 num_frames = input_feats.NumRows(),
      feat_dim = input_feats.NumCols();
  KALDI_ASSERT(static_cast<int32>(output_frame->Dim()) == feat_dim * (opts_.order+1));
  output_frame->SetZero();
  for (int32 i = 0; i <= opts_.order; i++) {
    const Vector<BaseFloat> &scales = scales_[i];
    int32 max_offset = (scales.Dim() - 1) / 2;
    SubVector<BaseFloat> output(*output_frame, i*feat_dim, feat_dim);
    for (int32 j = -max_offset; j <= max_offset; j++) {
      // if asked to read
      int32 offset_frame = frame + j;
      if (offset_frame < 0) offset_frame = 0;
      else if (offset_frame >= num_frames)
        offset_frame = num_frames - 1;
      BaseFloat scale = scales(j + max_offset);
      if (scale != 0.0)
        output.AddVec(scale, input_feats.Row(offset_frame));
    }
  }
}

ShiftedDeltaFeatures::ShiftedDeltaFeatures(
  const ShiftedDeltaFeaturesOptions &opts): opts_(opts) {
  KALDI_ASSERT(opts.window > 0 && opts.window < 1000);

  // Default window is 1.
  int32 window = opts.window;
  KALDI_ASSERT(window != 0);
  scales_.Resize(1 + 2*window);  // also zeros it.
  BaseFloat normalizer = 0.0;
  for (int32 j = -window; j <= window; j++) {
    normalizer += j*j;
    scales_(j + window) += static_cast<BaseFloat>(j);
  }
  scales_.Scale(1.0 / normalizer);
}

void ShiftedDeltaFeatures::Process(const MatrixBase<BaseFloat> &input_feats,
                            int32 frame,
                            SubVector<BaseFloat> *output_frame) const {
  KALDI_ASSERT(frame < input_feats.NumRows());
  int32 num_frames = input_feats.NumRows(),
      feat_dim = input_feats.NumCols();
  KALDI_ASSERT(static_cast<int32>(output_frame->Dim())
               == feat_dim * (opts_.num_blocks + 1));
  output_frame->SetZero();

  // The original features
  SubVector<BaseFloat> output(*output_frame, 0, feat_dim);
  output.AddVec(1.0, input_feats.Row(frame));

  // Concatenate the delta-blocks. Each block is block_shift
  // (usually 3) frames apart.
  for (int32 i = 0; i < opts_.num_blocks; i++) {
    int32 max_offset = (scales_.Dim() - 1) / 2;
    SubVector<BaseFloat> output(*output_frame, (i + 1) * feat_dim, feat_dim);
    for (int32 j = -max_offset; j <= max_offset; j++) {
      int32 offset_frame = frame + j + i * opts_.block_shift;
      if (offset_frame < 0) offset_frame = 0;
      else if (offset_frame >= num_frames)
        offset_frame = num_frames - 1;
      BaseFloat scale = scales_(j + max_offset);
      if (scale != 0.0)
        output.AddVec(scale, input_feats.Row(offset_frame));
    }
  }
}

void ComputeDeltas(const DeltaFeaturesOptions &delta_opts,
                   const MatrixBase<BaseFloat> &input_features,
                   Matrix<BaseFloat> *output_features) {
  output_features->Resize(input_features.NumRows(),
                          input_features.NumCols()
                          *(delta_opts.order + 1));
  DeltaFeatures delta(delta_opts);
  for (int32 r = 0; r < static_cast<int32>(input_features.NumRows()); r++) {
    SubVector<BaseFloat> row(*output_features, r);
    delta.Process(input_features, r, &row);
  }
}

void ComputeShiftedDeltas(const ShiftedDeltaFeaturesOptions &delta_opts,
                   const MatrixBase<BaseFloat> &input_features,
                   Matrix<BaseFloat> *output_features) {
  output_features->Resize(input_features.NumRows(),
                          input_features.NumCols()
                          * (delta_opts.num_blocks + 1));
  ShiftedDeltaFeatures delta(delta_opts);

  for (int32 r = 0; r < static_cast<int32>(input_features.NumRows()); r++) {
    SubVector<BaseFloat> row(*output_features, r);
    delta.Process(input_features, r, &row);
  }
}

void GetEqualLoudnessVector(const MelBanks &mel_banks,
                            Vector<BaseFloat> *ans) {
  int32 n = mel_banks.NumBins();
  // central freq of each mel bin
  const Vector<BaseFloat> &f0 = mel_banks.GetCenterFreqs();
  ans->Resize(n);
  for (int32 i = 0; i < n; i++) {
    BaseFloat fsq = f0(i) * f0(i);
    BaseFloat fsub = fsq / (fsq + 1.6e5);
    (*ans)(i) = fsub * fsub * ((fsq + 1.44e6) / (fsq + 9.61e6));
  }
}

void InitIdftBases(int32 n_bases, int32 dimension, Matrix<BaseFloat> *mat_out) {
  BaseFloat angle = M_PI / static_cast<BaseFloat>(dimension - 1);
  BaseFloat scale = 1.0f / (2.0 * static_cast<BaseFloat>(dimension - 1));
  mat_out->Resize(n_bases, dimension);
  for (int32 i = 0; i < n_bases; i++) {
    (*mat_out)(i, 0) = 1.0 * scale;
    BaseFloat i_fl = static_cast<BaseFloat>(i);
    for (int32 j = 1; j < dimension - 1; j++) {
      BaseFloat j_fl = static_cast<BaseFloat>(j);
      (*mat_out)(i, j) = 2.0 * scale * cos(angle * i_fl * j_fl);
    }

    (*mat_out)(i, dimension -1)
        = scale * cos(angle * i_fl * static_cast<BaseFloat>(dimension-1));
  }
}

// Compute LP coefficients from autocorrelation coefficients.
BaseFloat ComputeLpc(const VectorBase<BaseFloat> &autocorr_in,
                     Vector<BaseFloat> *lpc_out) {
  int32 n = autocorr_in.Dim() - 1;
  KALDI_ASSERT(lpc_out->Dim() == n);
  Vector<BaseFloat> tmp(n);
  BaseFloat ans =  Durbin(n, autocorr_in.Data(),
                          lpc_out->Data(),
                          tmp.Data());
  if (ans <= 0.0)
    KALDI_WARN << "Zero energy in LPC computation";
  return -log((double)1.0/ans);  // forms the C0 value
}

void SpliceFrames(const MatrixBase<BaseFloat> &input_features,
                  int32 left_context,
                  int32 right_context,
                  Matrix<BaseFloat> *output_features) {
  int32 T = input_features.NumRows(), D = input_features.NumCols();
  if (T == 0 || D == 0)
    KALDI_ERR << "SpliceFrames: empty input";
  KALDI_ASSERT(left_context >= 0 && right_context >= 0);
  int32 N = 1 + left_context + right_context;
  output_features->Resize(T, D*N);
  for (int32 t = 0; t < T; t++) {
    SubVector<BaseFloat> dst_row(*output_features, t);
    for (int32 j = 0; j < N; j++) {
      int32 t2 = t + j - left_context;
      if (t2 < 0) t2 = 0;
      if (t2 >= T) t2 = T-1;
      SubVector<BaseFloat> dst(dst_row, j*D, D),
          src(input_features, t2);
      dst.CopyFromVec(src);
    }
  }
}

void ReverseFrames(const MatrixBase<BaseFloat> &input_features,
                   Matrix<BaseFloat> *output_features) {
  int32 T = input_features.NumRows(), D = input_features.NumCols();
  if (T == 0 || D == 0)
    KALDI_ERR << "ReverseFrames: empty input";
  output_features->Resize(T, D);
  for (int32 t = 0; t < T; t++) {
    SubVector<BaseFloat> dst_row(*output_features, t);
    SubVector<BaseFloat> src_row(input_features, T-1-t);
    dst_row.CopyFromVec(src_row);
  }
}

void SlidingWindowCmnOptions::Check() const {
  KALDI_ASSERT(cmn_window > 0);
  if (center)
    KALDI_ASSERT(min_window > 0 && min_window <= cmn_window);
  // else ignored so value doesn't matter.
}

// Internal version of SlidingWindowCmn with double-precision arguments.
void SlidingWindowCmnInternal(const SlidingWindowCmnOptions &opts,
                              const MatrixBase<double> &input,
                              MatrixBase<double> *output) {
  opts.Check();
  int32 num_frames = input.NumRows(), dim = input.NumCols();

  int32 last_window_start = -1, last_window_end = -1;
  Vector<double> cur_sum(dim), cur_sumsq(dim);

  for (int32 t = 0; t < num_frames; t++) {
    int32 window_start, window_end; // note: window_end will be one
    // past the end of the window we use for normalization.
    if (opts.center) {
      window_start = t - (opts.cmn_window / 2);
      window_end = window_start + opts.cmn_window;
    } else {
      window_start = t - opts.cmn_window;
      window_end = t + 1;
    }
    if (window_start < 0) { // shift window right if starts <0.
      window_end -= window_start;
      window_start = 0; // or: window_start -= window_start
    }
    if (!opts.center) {
      if (window_end > t)
        window_end = std::max(t + 1, opts.min_window);
    }
    if (window_end > num_frames) {
      window_start -= (window_end - num_frames);
      window_end = num_frames;
      if (window_start < 0) window_start = 0;
    }
    if (last_window_start == -1) {
      SubMatrix<double> input_part(input,
                                      window_start, window_end - window_start,
                                      0, dim);
      cur_sum.AddRowSumMat(1.0, input_part , 0.0);
      if (opts.normalize_variance)
        cur_sumsq.AddDiagMat2(1.0, input_part, kTrans, 0.0);
    } else {
      if (window_start > last_window_start) {
        KALDI_ASSERT(window_start == last_window_start + 1);
        SubVector<double> frame_to_remove(input, last_window_start);
        cur_sum.AddVec(-1.0, frame_to_remove);
        if (opts.normalize_variance)
          cur_sumsq.AddVec2(-1.0, frame_to_remove);
      }
      if (window_end > last_window_end) {
        KALDI_ASSERT(window_end == last_window_end + 1);
        SubVector<double> frame_to_add(input, last_window_end);
        cur_sum.AddVec(1.0, frame_to_add);
        if (opts.normalize_variance)
          cur_sumsq.AddVec2(1.0, frame_to_add);
      }
    }
    int32 window_frames = window_end - window_start;
    last_window_start = window_start;
    last_window_end = window_end;

    KALDI_ASSERT(window_frames > 0);
    SubVector<double> input_frame(input, t),
        output_frame(*output, t);
    output_frame.CopyFromVec(input_frame);
    output_frame.AddVec(-1.0 / window_frames, cur_sum);

    if (opts.normalize_variance) {
      if (window_frames == 1) {
        output_frame.Set(0.0);
      } else {
        Vector<double> variance(cur_sumsq);
        variance.Scale(1.0 / window_frames);
        variance.AddVec2(-1.0 / (window_frames * window_frames), cur_sum);
        // now "variance" is the variance of the features in the window,
        // around their own mean.
        int32 num_floored = variance.ApplyFloor(1.0e-10);
        if (num_floored > 0 && num_frames > 1) {
          KALDI_WARN << "Flooring variance When normalizing variance, floored " << num_floored
                     << " elements; num-frames was " << window_frames;
        }
        variance.ApplyPow(-0.5); // get inverse standard deviation.
        output_frame.MulElements(variance);
      }
    }
  }
}

void SlidingWindowCmn(const SlidingWindowCmnOptions &opts,
                      const MatrixBase<BaseFloat> &input,
                      MatrixBase<BaseFloat> *output) {
  KALDI_ASSERT(SameDim(input, *output) && input.NumRows() > 0);
  Matrix<double> input_dbl(input), output_dbl(input.NumRows(), input.NumCols());
  // calll double-precision version
  SlidingWindowCmnInternal(opts, input_dbl, &output_dbl);
  output->CopyFromMat(output_dbl);
}

}  // namespace kaldi


text:
                 PlayBook

                    v1.0

                    <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
                        <input type="text" name="q" placeholder="Search chapters" />
                        <input type="hidden" name="check_keywords" value="yes" />
                        <input type="hidden" name="area" value="default" />
                    </form>

            <chapters-list></chapters-list>

            Read The Docs

        <router-outlet></router-outlet>

       PlayBook


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HFEA.Connector.Contracts.Api
{
    public class ContentTag
    {
        public int Id { get; set; }
        public string Description { get; set; }
    }
}


text:
import asyncio

from hotikeys import Hotkey, Key
from hotikeys.hotkey import EventArgs

MAX_RUN_TIME = 10

def automated_test(loop):
    def key_handler(args: EventArgs):
        print(args.vkey, Key[args.vkey], args.event, args.flags)

    def stop_loop():
        print('stopping')
        loop.stop()

    Hotkey(key_handler, events=())
    Hotkey(stop_loop, Key.C, Key.LControl)

    loop.create_task(heartbeat(loop, 0))
    loop.run_forever()

async def heartbeat(loop, count):
    if count >= MAX_RUN_TIME:
        return loop.stop()
    await asyncio.sleep(1)
    loop.create_task(heartbeat(loop, count + 1))

# Super automated test. Just eh... hit a few keys and observe console.
# Ctrl-C to stop, if it works.
if __name__ == '__main__':
    automated_test(asyncio.get_event_loop())


text:
package be.vdab.services;

import java.util.Optional;

import be.vdab.entities.Wijn;
import be.vdab.repositories.WijnRepository;

public class WijnService {
	private final WijnRepository wijnRepository = new WijnRepository();

	public Optional<Wijn> read(long id) {
		return wijnRepository.read(id);
	}
}


text:
package org.sablecc.sablecc.semantics;

import org.sablecc.sablecc.syntax3.node.*;

public class AlternativeReference {

    private Grammar grammar;

    private Alternative alternative;

    private Token location;

    private AlternativeReference(
            Grammar grammar,
            Alternative alternative) {

        this.grammar = grammar;
        this.alternative = alternative;
    }

    public Alternative getAlternative() {

        return this.alternative;
    }

    public Token getLocation() {

        return this.location;
    }

    static AlternativeReference createDeclaredAlternativeReference(
            Grammar grammar,
            Alternative alternative,
            Token location) {

        AlternativeReference alternativeReference = new AlternativeReference(
                grammar, alternative);
        alternativeReference.location = location;
        return alternativeReference;
    }
}


text:
require 'rubygems'
require 'simplecov'
require 'pry'

SimpleCov.start { add_filter "/spec/" }

require 'webmock/rspec'
#require 'timecop'
require 'time'
require 'transparencia_brasil'

WebMock.disable_net_connect!

Dir["spec/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
  config.order = 'random'
end

TransparenciaBrasil.configure do |c|
  c.token = "aaa"
end

[:get, :post, :delete, :put].each do |operation|
  Kernel.send(:define_method, "a_#{operation}") do |path|
    a_request(operation, TransparenciaBrasil.configuration.endpoint + path)
  end

  Kernel.send(:define_method, "stub_#{operation}") do |path|
    stub_request(operation, TransparenciaBrasil.configuration.endpoint + path).with(headers: {"App-Token" => TransparenciaBrasil.configuration.token})
  end
end

def fixture_path
  File.expand_path("../fixtures", __FILE__)
end

def fixture(file)
  File.new("#{fixture_path}/#{file}")
end

def stringify_values(hash)
  hash.inject({}) { |memo,(k,v)| memo.merge(k => v.to_s) }
end


text:
title: Ten Little Fingers and Ten Little Toes
written_by: 'Mem Fox, Helen Oxenbury (Illustrator)'
available: 'August 23rd, 2010'
isbn: '9780547366203'
binding: Board Books
link_to_buy_page:
image_path: 'https://images.booksense.com/images/books/203/366/FC9780547366203.JPG'
link:
---