text:
{-# LANGUAGE TupleSections #-}
module PolyPaver.Simplify.Substitution
--(
--    simplifyUsingSubstitutions
--)
where

import PolyPaver.Form
import PolyPaver.Subterms
import PolyPaver.Vars (getFormFreeVars)

import qualified Data.Set as Set

simplifyUsingSubstitutions ::
    Form TermHash -> [(Form TermHash, String)]
simplifyUsingSubstitutions form =
    {-
        1. Identify all hypotheses that are inclusions or inequalities.

        2. Extract possible substitutions (term pairs with monotonicity types).

        3. Try to apply each substitution to the conclusion.

        4. Ignore substitutions that do not reduce the conclusion arity.

        5. Remove all hypotheses that feature a removed variable.

        6. Assemble the simplified conjectures, regenerating hashes.
    -}
    strongerForms
    where
    strongerForms =
        maybeFormWithoutNonConclusionVars ++
        (concat $ map buildFormFromConclusion conclusionsWithDescriptions)
        where
        maybeFormWithoutNonConclusionVars
            | length hypotheses == length hypothesesWithOnlyConclusionVars = []
            | otherwise = [(addHashesInForm reducedForm, description)]
            where
            description =
                "removed hypotheses that contain variables not in the conclusion"
                ++ "\n\n original formula:\n"
                ++ showForm 1000000 const form
                ++ "\n"
                ++ "\n simplified formula:\n"
                ++ showForm 1000000 const reducedForm
                ++ "\n"
            reducedForm =
                joinHypothesesAndConclusion (hypothesesWithOnlyConclusionVars, conclusion)
            hypothesesWithOnlyConclusionVars =
                filter (hasOnlyVars conclusionVars) hypotheses
        buildFormFromConclusion (c, reducedVars, description)
            | length hypothesesWithoutReducedVars == length hypothesesWithOnlyConclusionVars =
                [(addHashesInForm reducedForm1, description1)]
            | otherwise =
                [(addHashesInForm reducedForm1, description1),
                 (addHashesInForm reducedForm2, description2)]
            where
            description1 =
                description ++ "; removed hypotheses that contain a reduced variable"
                ++ "\n simplified formula:\n"
                ++ showForm 1000000 const reducedForm1
                ++ "\n"
            description2 =
                description ++ "; removed hypotheses that contain variables not in the conclusion"
                ++ "\n simplified formula:\n"
                ++ showForm 1000000 const reducedForm2
                ++ "\n"
            reducedForm1 =
                joinHypothesesAndConclusion (hypothesesWithoutReducedVars, c)
            reducedForm2 =
                joinHypothesesAndConclusion (hypothesesWithOnlyConclusionVars, c)
            hypothesesWithOnlyConclusionVars =
                filter (hasOnlyVars $ getFormFreeVars c) hypotheses
            hypothesesWithoutReducedVars =
                filter hasNoReducedVar hypotheses -- remove hypotheses that feature a removed variable
            hasNoReducedVar h =
                Set.null $ reducedVars `Set.intersection` (getFormFreeVars h)
    hasOnlyVars vars h =
        getFormFreeVars h `Set.isSubsetOf` vars
    conclusionsWithDescriptions =
        map addDescription $
            filter hasReducedTheArity $ -- ignoring substitutions that do not reduce arity
                map addReducedVariables strongerConclusionsAndSubstitutions
        where
        addDescription ((c,s), reducedVars) =
            (c, reducedVars, description)
            where
            description =
                "substitution:\n" ++ showSubstitution s -- ++ "; reducedVars = " ++ show reducedVars
                ++ "\n\n original formula:\n"
                ++ showForm 1000000 const form
                ++ "\n"
        hasReducedTheArity (_, reducedVars) = not $ Set.null reducedVars
        addReducedVariables (c,s) = ((c,s), conclusionVars `Set.difference` getFormFreeVars c)
    strongerConclusionsAndSubstitutions =
        concat $ map (\(s, cs) -> map (,s) cs) $ zip substitutions strongerConclusionsLists
    strongerConclusionsLists =
        -- apply each substitution onto the conclusion, ignoring those that have no effect:
        map (makeStrengtheningSubstitution conclusion) substitutions
    -- identify substitutions from hypotheses:
    substitutions = concat $ map extractSubstitutionsFromHypothesis hypotheses
    conclusionVars = getFormFreeVars conclusion
    (hypotheses, conclusion) = getHypothesesAndConclusion form

-- Old code that tested for elimination only at the substitution level and removed only the hypothesis that
-- gave birth to the substitution:
--    strongerConclusions = concat $ map (makeStrengtheningSubstitution conclusion) substitutionsAndGaps2
--    substitutionsAndGaps2 = filter (eliminatesVar . fst) substitutionsAndGaps
--    substitutionsAndGaps = concat $ zipWith addToAll hypothesesGaps (map extractSubstitutionsFromHypothesis hypotheses)
--    addToAll e2 l = [(e1,e2) | e1 <- l]
--    hypothesesGaps = f hypotheses []
--        where
--        f [] _ = []
--        f (h:t) p = ((reverse p) ++ t) : f t (h:p)
--    eliminatesVar subst =
--        not $ Set.null $
--        (getTermFreeVars $ subst_source subst) `Set.difference` (getTermFreeVars $ subst_target subst)

data Substitution =
    Substitution
    {
        subst_source :: Term TermHash,
        subst_target :: Term TermHash,
        subst_monotonicityType :: MonotonicityType
    }

showSubstitution :: Substitution -> String
showSubstitution substitution =
    "[" ++ sourceS ++ " -> " ++ targetS ++ "]"
    where
    sourceS = showTerm const source
    targetS = showTerm const target
    source = subst_source substitution
    target = subst_target substitution

data MonotonicityType =
    Equal | Increasing | Decreasing | Expanding
    deriving (Eq)

monoTypeMatches :: MonotonicityType -> MonotonicityType -> Bool
monoTypeMatches Equal _ = True
monoTypeMatches Expanding Equal = False
monoTypeMatches Expanding _ = True
monoTypeMatches mt1 mt2 = mt1 == mt2

monoTypeNegate :: MonotonicityType -> MonotonicityType
monoTypeNegate Increasing = Decreasing
monoTypeNegate Decreasing = Increasing
monoTypeNegate t = t

monoTypeBothSigns :: MonotonicityType -> MonotonicityType
monoTypeBothSigns Increasing = Equal
monoTypeBothSigns Decreasing = Equal
monoTypeBothSigns t = t

extractSubstitutionsFromHypothesis ::
    Form TermHash -> [Substitution]
extractSubstitutionsFromHypothesis form =
    case form of
        Le _ l r -> substFromLess l r
        Leq _ l r -> substFromLess l r
        Ge _ l r -> substFromLess r l
        Geq _ l r -> substFromLess r l
        Eq _ l r -> substFromEq l r
        ContainedIn _ l r -> substFromContained l r
        _ -> []
    where
    substFromLess l r =
        [Substitution l r Increasing,
         Substitution r l Decreasing]
    substFromEq l r =
        [Substitution l r Equal,
         Substitution r l Equal]
    substFromContained l r =
        [Substitution l r Expanding]

makeStrengtheningSubstitution :: Form TermHash -> Substitution -> [Form TermHash]
makeStrengtheningSubstitution form substitution
    | formHasChanged = [addHashesInForm formS]
    | otherwise = []
    where
    Term (_, sourceHash) = subst_source substitution
    target = subst_target substitution
    availableMonoType = subst_monotonicityType substitution
    (formS, formHasChanged) = subF True form
    subF shouldStrengthen form2 =
        case form2 of
            Not arg ->
                (Not argS, ch)
                where
                (argS, ch) = subF (not shouldStrengthen) arg
            Or left right ->
                (Or leftS rightS, chL || chR)
                where
                (leftS, chL) = subF shouldStrengthen left
                (rightS, chR) = subF shouldStrengthen right
            And left right ->
                (And leftS rightS, chL || chR)
                where
                (leftS, chL) = subF shouldStrengthen left
                (rightS, chR) = subF shouldStrengthen right
            Implies left right ->
                (Implies leftS rightS, chL || chR)
                where
                (leftS, chL) = subF (not shouldStrengthen) left
                (rightS, chR) = subF shouldStrengthen right
            Le lab left right ->
                (Le lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Increasing left
                (rightS, chR) = subT Decreasing right
            Leq lab left right ->
                (Leq lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Increasing left
                (rightS, chR) = subT Decreasing right
            Ge lab left right ->
                (Ge lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Decreasing left
                (rightS, chR) = subT Increasing right
            Geq lab left right ->
                (Geq lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Decreasing left
                (rightS, chR) = subT Increasing right
            Eq lab left right ->
                (Eq lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Equal left
                (rightS, chR) = subT Equal right
            Neq lab left right ->
                (Neq lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Equal left
                (rightS, chR) = subT Equal right
            ContainedIn lab left right ->
                (ContainedIn lab leftS rightS, chL || chR)
                where
                (leftS, chL) = subT Expanding left
                (rightS, chR) = subT Equal right
            IsRange lab arg1 arg2 arg3 ->
                (IsRange lab arg1S arg2S arg3S, ch1 || ch2 || ch3)
                where
                (arg1S, ch1) = subT Expanding arg1
                (arg2S, ch2) = subT Increasing arg2
                (arg3S, ch3) = subT Decreasing arg3
            IsIntRange lab arg1 arg2 arg3 ->
                (IsIntRange lab arg1S arg2S arg3S, ch1 || ch2 || ch3)
                where
                (arg1S, ch1) = subT Equal arg1
                (arg2S, ch2) = subT Increasing arg2
                (arg3S, ch3) = subT Decreasing arg3
            IsInt lab arg ->
                (IsInt lab argS, ch)
                where
                (argS, ch) = subT Equal arg
    subT requiredMonoType term@(Term (term', hash))
        {-
            Need to also perform a range analysis to identify some expressions
            that are always positive or always negative.
        -}
        | hash == sourceHash && availableMonoType `monoTypeMatches` requiredMonoType =
            (target, True)
        | otherwise =
            case term' of
                Hull left right -> subT2 requiredMonoType requiredMonoType Hull left right
                Plus left right -> subT2 requiredMonoType requiredMonoType Plus left right
                Minus left right ->
                    subT2 requiredMonoType (monoTypeNegate requiredMonoType) Minus left right
                Neg arg -> subT1 (monoTypeNegate requiredMonoType) Neg arg
                Times left right ->
                    subT2 (monoTypeBothSigns requiredMonoType) (monoTypeBothSigns requiredMonoType) Times left right
                Square arg -> subT1 (monoTypeBothSigns requiredMonoType) Square arg
                IntPower left right ->
                    subT2 (monoTypeBothSigns requiredMonoType) Equal IntPower left right
                Recip arg -> subT1 (monoTypeBothSigns requiredMonoType) Recip arg
                Over left right ->
                    subT2 (monoTypeBothSigns requiredMonoType) (monoTypeBothSigns requiredMonoType) Over left right
                Abs arg -> subT1 (monoTypeBothSigns requiredMonoType) Abs arg
                Min left right -> subT2 requiredMonoType requiredMonoType Min left right
                Max left right -> subT2 requiredMonoType requiredMonoType Max left right
                Sqrt arg -> subT1 requiredMonoType Sqrt arg
                Exp arg -> subT1 requiredMonoType Exp arg
                Sin arg -> subT1 (monoTypeBothSigns requiredMonoType) Sin arg
                Cos arg -> subT1 (monoTypeBothSigns requiredMonoType) Cos arg
                Atan arg -> subT1 requiredMonoType Atan arg
                Integral ivarId ivarName lower upper integrand ->
                    subT3 (monoTypeBothSigns requiredMonoType) (monoTypeBothSigns requiredMonoType) requiredMonoType
                        (Integral ivarId ivarName) lower upper integrand
                FRound rel abse arg ->
                    subT1 requiredMonoType (FRound rel abse) arg
                FPlus rel abse left right ->
                    subT2 requiredMonoType requiredMonoType (FPlus rel abse) left right
                FMinus rel abse left right ->
                    subT2 requiredMonoType (monoTypeNegate requiredMonoType)
                        (FMinus rel abse) left right
                FTimes rel abse left right ->
                    subT2 (monoTypeBothSigns requiredMonoType) (monoTypeBothSigns requiredMonoType)
                        (FTimes rel abse) left right
                FSquare rel abse arg ->
                    subT1 (monoTypeBothSigns requiredMonoType) (FSquare rel abse) arg
                FSqrt rel abse arg ->
                    subT1 requiredMonoType (FSqrt rel abse) arg
                FSin rel abse arg ->
                    subT1 (monoTypeBothSigns requiredMonoType) (FSin rel abse) arg
                FCos rel abse arg ->
                    subT1 (monoTypeBothSigns requiredMonoType) (FCos rel abse) arg
                FOver rel abse left right ->
                    subT2 (monoTypeBothSigns requiredMonoType) (monoTypeBothSigns requiredMonoType)
                        (FOver rel abse) left right
                FExp rel abse arg ->
                    subT1 requiredMonoType (FExp rel abse) arg
                _ -> (term, False)
        where
        subT1 mt1 constr arg1 =
            (Term (constr arg1S, 0), ch1)
            where
            (arg1S, ch1) = subT mt1 arg1
        subT2 mt1 mt2 constr arg1 arg2 =
            (Term (constr arg1S arg2S, 0), ch1 || ch2)
            where
            (arg1S, ch1) = subT mt1 arg1
            (arg2S, ch2) = subT mt2 arg2
        subT3 mt1 mt2 mt3 constr arg1 arg2 arg3 =
            (Term (constr arg1S arg2S arg3S, 0), ch1 || ch2 || ch3)
            where
            (arg1S, ch1) = subT mt1 arg1
            (arg2S, ch2) = subT mt2 arg2
            (arg3S, ch3) = subT mt3 arg3

--test1 :: [(Form TermHash, Set.Set Int)]
--test1 =
--    simplifyUsingSubstitutions $
--        addHashesInForm formEx1
--
--formEx1 :: Form ()
--formEx1 =
--    x |>=| 1 ---> x |>=| 0
--    where
--    x = termVar 0 "x"
--
--test2 :: [(Form TermHash, Set.Set Int)]
--test2 =
--    simplifyUsingSubstitutions $
--        addHashesInForm formEx2
--
--formEx2 :: Form ()
--formEx2 =
--    y |<=| 1 ---> x |<-| (hull 1 y) ---> x |<-| (hull 0 (y + 1))
--    where
--    x = termVar 0 "x"
--    y = termVar 1 "y"
--


text:
package foundation

import "C"

/*
* Public and private key deserialization from an interchangeable format.
 */
type KeyDeserializer interface {
	context

	/*
	 * Deserialize given public key as an interchangeable format to the object.
	 */
	DeserializePublicKey(publicKeyData []byte) (*RawPublicKey, error)

	/*
	 * Deserialize given private key as an interchangeable format to the object.
	 */
	DeserializePrivateKey(privateKeyData []byte) (*RawPrivateKey, error)

	/*
	 * Release underlying C context.
	 */
	Delete()
}

redpajama_set_name: RedPajamaGithub


text:
package org.drools.planner.core.localsearch.decider.deciderscorecomparator;

import java.util.Comparator;

import org.drools.planner.core.localsearch.scope.LocalSearchSolverPhaseScope;
import org.drools.planner.core.localsearch.scope.LocalSearchStepScope;
import org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScore;
import org.drools.planner.core.score.Score;
import org.drools.planner.core.score.comparator.FlatteningHardAndSoftScoreComparator;
import org.drools.planner.core.score.comparator.NaturalScoreComparator;

/**
 * @see DeciderScoreComparatorFactory
 */
public class ShiftingHardPenaltyDeciderScoreComparatorFactory extends AbstractDeciderScoreComparatorFactory {

    private int hardScoreActivationThreshold = 0;
    private int successiveNoHardChangeMinimum = 2;
    private int successiveNoHardChangeMaximum = 20;
    private double successiveNoHardChangeRepetitionMultiplicand = 20.0;
    private double hardWeightSurvivalRatio = 0.8;

    private int startingHardWeight = 1000; // TODO determine dynamically

    private int successiveNoHardScoreChange;
    private boolean shiftingPenaltyActive;
    private int hardWeight;

    private Comparator<Score> naturalDeciderScoreComparator = new NaturalScoreComparator();

    public void setHardScoreActivationThreshold(int hardScoreActivationThreshold) {
        this.hardScoreActivationThreshold = hardScoreActivationThreshold;
    }

    public void setSuccessiveNoHardChangeMinimum(int successiveNoHardChangeMinimum) {
        this.successiveNoHardChangeMinimum = successiveNoHardChangeMinimum;
    }

    public void setSuccessiveNoHardChangeMaximum(int successiveNoHardChangeMaximum) {
        this.successiveNoHardChangeMaximum = successiveNoHardChangeMaximum;
    }

    public void setSuccessiveNoHardChangeRepetitionMultiplicand(double successiveNoHardChangeRepetitionMultiplicand) {
        this.successiveNoHardChangeRepetitionMultiplicand = successiveNoHardChangeRepetitionMultiplicand;
    }

    public void setHardWeightSurvivalRatio(double hardWeightSurvivalRatio) {
        this.hardWeightSurvivalRatio = hardWeightSurvivalRatio;
    }

    public void setStartingHardWeight(int startingHardWeight) {
        this.startingHardWeight = startingHardWeight;
    }

    // ************************************************************************
    // Worker methods
    // ************************************************************************

    @Override
    public void phaseStarted(LocalSearchSolverPhaseScope localSearchSolverPhaseScope) {
        successiveNoHardScoreChange = 0;
        shiftingPenaltyActive = false;
    }

    @Override
    public void stepEnded(LocalSearchStepScope localSearchStepScope) {
        if (localSearchStepScope.getStepIndex() == localSearchStepScope.getPhaseScope().getBestSolutionStepIndex()) {
            successiveNoHardScoreChange = 0;
            shiftingPenaltyActive = false;
        } else {
            HardAndSoftScore lastStepScore = (HardAndSoftScore) localSearchStepScope.getPhaseScope()
                    .getLastCompletedStepScope().getScore();
            HardAndSoftScore stepScore = (HardAndSoftScore) localSearchStepScope.getScore();
            if (stepScore.getHardScore() >= hardScoreActivationThreshold
                    && lastStepScore.getHardScore() == stepScore.getHardScore()) {
                successiveNoHardScoreChange++;
            } else {
                successiveNoHardScoreChange--;
                if (successiveNoHardScoreChange < 0) {
                    successiveNoHardScoreChange = 0;
                }
            }
            int min = successiveNoHardChangeMinimum;
            int max = successiveNoHardChangeMaximum;
            while (true) {
                if (successiveNoHardScoreChange < min) {
                    shiftingPenaltyActive = false;
                    break;
                } else if (successiveNoHardScoreChange <= max) {
                    shiftingPenaltyActive = true;
                    if (successiveNoHardScoreChange == min) {
                        hardWeight = startingHardWeight;
                    } else {
                        hardWeight = (int) Math.round(((double) hardWeight) * hardWeightSurvivalRatio);
                    }
                    break;
                }
                min = (int) Math.round(((double) min) * successiveNoHardChangeRepetitionMultiplicand);
                max = (int) Math.round(((double) max) * successiveNoHardChangeRepetitionMultiplicand);
            }
        }
    }

    public Comparator<Score> createDeciderScoreComparator() {
        if (shiftingPenaltyActive) {
            return new FlatteningHardAndSoftScoreComparator(hardWeight);
        } else {
            return naturalDeciderScoreComparator;
        }
    }

}


text:
module CatarseCampaignmonitor
  VERSION = "0.0.1"
end


text:
# CFAR - Controller for Aura Router

[![Latest Version on Packagist](https://img.shields.io/packagist/v/adelowo/cfar.svg?style=flat-square)](https://packagist.org/packages/adelowo/cfar)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/adelowo/cfar/master.svg?style=flat-square)](https://travis-ci.org/adelowo/cfar)
[![Scrutinizer Coverage](https://img.shields.io/scrutinizer/coverage/g/adelowo/cfar.svg?maxAge=2592000&style=flat-square)](https://scrutinizer-ci.com/g/adelowo/cfar/?branch=master)
[![Quality Score](https://img.shields.io/scrutinizer/g/adelowo/cfar.svg?style=flat-square)](https://scrutinizer-ci.com/g/adelowo/cfar)
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/09ff34ee-feb3-49c0-acbc-52781179deb9.svg?style=flat-square)](https://insight.sensiolabs.com/projects/09ff34ee-feb3-49c0-acbc-52781179deb9)
[![Total Downloads](https://img.shields.io/packagist/dt/adelowo/cfar.svg?style=flat-square)](https://packagist.org/packages/adelowo/cfar)

This library was written to enable users of Aura.Router make use of symfony/laravel "type" controllers.

#### Already using CFAR , Migrate to: [1.2](migration-to-1.2.md)

### Installation

You are recommended to make use of the latest available PHP version, but CFAR should run on >=5.5.

CFAR has a dependency, which is Aura.Router. >=1.0 releases require Aura.Router 3.x while <=0.2.1 requires Aura.Router 2.x .

Install CFAR via one of the following methods :

- [Composer](https://getcomposer.org) :

```bash
    composer require "adelowo/cfar" : "~1.0"
```

> If you are still using Aura.Router 2.x, please install 0.x

```bash
    composer require "adelowo/cfar" : "~0.2"
```

- Repo Cloning :

```bash
    git clone https://github.com/adelowo/cfar.git
```

- [Download a release](https://github.com/adelowo/cfar/releases)

> If downloading the library without composer or cloning directly from the repository, you'd have to write an autoloader yourself

### Usage

Cfar doesn't require any special config - other than specifying the class that acts as your controller (namespaced) and method to invoke - you'd still write your routes as specified in Aura.Router's (3.x) doc.

Aura.Router 3 is a big improvement to the much loved router with it being broken into many parts such as a Mapper, Matcher, Route (that contains the matched route).

> Internally, Cfar uses PHP's Reflection Api.

> By default, Cfar would search and invoke a method called `indexAction`

Below is a little snippet that shows Aura.Router and Cfar ***fully integrated***, an `index.php` file and controllers for the routes would be written.

```php
<?php

//filename : index.php

use Aura\Router\RouterContainer;

require_once "vendor/autoload.php";

$routeContainer = new RouterContainer();

$routeMapper = $routeContainer->getMap();

$routeMapper->get('blog.read', '/blog/{ide}')
    ->handler('\Http\controller\BlogController@show');

$routeMapper->get(null, "/")
    ->handler('\Http\controller\BlogController');

$routeMapper->get('dev', '/dev');

$routeMapper->get(null,'/error')
    ->handler('\Http\controller\ErrorController'); //`indexAction` would be the invoked method

$routeMatcher = $routeContainer->getMatcher();

$request = Zend\Diactoros\ServerRequestFactory::fromGlobals(
	$_SERVER,
	$_GET,
	$_POST,
	$_COOKIE,
	$_FILES
);

$matched = $routeMatcher->match($request);

if (!$matched) {
	throw new \Aura\Router\Exception("Route does not exists");
}

foreach ($matched->attributes as $key => $val) {
	$request = $request->withAttribute($key, $val);
}

/**
 * This is totally optional. But you could use some "Control Inverting", than have `new` wrap all lines of your code
*`SomeContainer` implement `Interop\Container\ContainerInterface`.;
* A neat way to do this is to extend your choosen container and have the `get` method exposed by the interface retrieve the service from the container.
* @see https://github.com/slimphp/slim/
*/
$container = new SomeContainer();

//Add an ORM, Doctrine in this case.
$container['db'] = function ($container) {

    $paths = array("/src/Entities");

    $isDevMode = false;

    $dbParams = [
        'driver' => 'pdo_mysql',
        'user' => 'root',
        'password' => 'xx-xxx-xx-xx',
        'dbname' => 'foo',
    ];

    $config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);

    return \Doctrine\ORM\EntityManager::create($dbParams, $config);
};

//You def' need a logger
$container['logger'] = function ($container) {

    $logger = new \Monolog\Logger("Your App Name");

    $handler = new \Monolog\Handler\SyslogHandler('Owambe');
    $handler->setFormatter(new \Monolog\Formatter\LineFormatter());

    $logger->pushHandler($handler);

    return $logger;
};

//register X,Y,Z services

try {

    $cfar = new \Adelowo\Cfar\Cfar($matched , $container);

    $cfar->dispatch();

} catch (\Adelowo\Cfar\CfarException $exception) {
    echo $exception->getMessage();
}
```
> The constructor of the controller would always receive a container. Might be null or a valid one. Your call.

> Parameters would be passed to the invoked method in the same order defined in the route.. A method for `/users/{id}/{name}` should have two parameters, where the first one would be passed the value captured by the router for `{id}` and vice-versa

```php

<?php

namespace Adelowo\Controller;

class BlogController
{

    protected $container;

    public function __construct(ContainerInterface $container = null)
    {
        $this->container = $container;
    }
    public function showUser($id , $param)
    {
        $db = $this->container->get('db');

        $data = $db->find("User" , $id);

        var_dump($data);
    }

    public function showPdf($name)
    {

            echo $name;
    }

    public function indexAction($id ,$name)
    {
        echo $id. PHP_EOL;
        echo $name;
    }
}

```

### License
MIT


text:
/*
 * TransposeSpec.h
 *
 *  Created on: Jan 30, 2017
 *      Author: arjun
 */

#ifndef TRANSPOSESPEC_H_
#define TRANSPOSESPEC_H_

#include "ourproj.h"

class TransposeSpec {
	int ndim;
	 int* sizes;
	 int* permutation;
	TensorType dataType;
	 double beta = 0.0;
	 double alpha = 1.0;

public:
	int* getSizes() {
		return sizes;
	}
	void setSizes(int* sizes) {
		this->sizes = sizes;
	}
	unsigned long int getVolume()
	{
		unsigned long vol = 1;
		for(int i = 0; i < ndim; i++)
		{
			vol *= sizes[i];
		}
		return vol;
	}

	int* getPermutation() {
		return permutation;
	}
	void setPermutation(int* permutation) {
		this->permutation = permutation;
	}
	TensorType getDataType() {
		return dataType;
	}
	void setDataType(TensorType dataType) {
		this->dataType = dataType;
	}
	double getBeta() {
		return beta;
	}
	void setBeta(double beta) {
		this->beta = beta;
	}
	TransposeSpec(int ndim, int *sizes, int *perm, TensorType dataType)
	{
		this->ndim = ndim;
		this->sizes = new int[ndim];
		this->permutation = new int[ndim];
		for(int i = 0; i < ndim; i++)
		{
			this->sizes[i] = sizes[i];
			this->permutation[i] = perm[i];
		}
		this->dataType = dataType;
	}
TransposeSpec() {
		// TODO Auto-generated constructor stub

	}

	//virtual
~TransposeSpec(){};

	int getNdim() const {
		return ndim;
	}

	void setNdim(int ndim) {
		this->ndim = ndim;
	}
double getAlpha() const
{
    return alpha;
}

void setAlpha(double alpha = 1.0)
{
    this->alpha = alpha;
}
}
;

#endif /* TRANSPOSESPEC_H_ */


text:
package io.fabric8.maven;

import java.util.Dictionary;

import io.fabric8.maven.url.internal.AetherBasedResolver;
import io.fabric8.maven.util.MavenConfigurationImpl;
import org.apache.maven.settings.Mirror;
import org.eclipse.aether.RepositorySystem;
import org.ops4j.util.property.DictionaryPropertyResolver;
import org.ops4j.util.property.PropertiesPropertyResolver;

public final class MavenResolvers {

    public static MavenResolver createMavenResolver(Dictionary<String, String> properties, String pid) {
        return createMavenResolver(null, properties, pid);
    }

    public static MavenResolver createMavenResolver(Mirror mirror, Dictionary<String, String> properties, String pid) {
        return createMavenResolver(mirror, properties, pid, null);
    }

    public static MavenResolver createMavenResolver(Mirror mirror, Dictionary<String, String> properties, String pid, RepositorySystem repositorySystem) {
        PropertiesPropertyResolver syspropsResolver = new PropertiesPropertyResolver(System.getProperties());
        DictionaryPropertyResolver propertyResolver = new DictionaryPropertyResolver(properties, syspropsResolver);
        MavenConfigurationImpl config = new MavenConfigurationImpl(propertyResolver, pid);
        return new AetherBasedResolver(config, mirror, repositorySystem);
    }

    private MavenResolvers() { }
}


text:
package org.lorislab.appky.process.config;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.lorislab.appky.application.model.UserConfigParam;

/**
 * User configuration mapping class.
 *
 * @author Andrej Petras <andrej@ajka-andrej.com>
 */
public class UserProfileConfiguration {

    /**
     * The news notification parameter.
     */
    public static final String PARAM_NOTIFI_NEWS = "notification.news";
    /**
     * The news notification parameter default value.
     */
    public static final String PARAM_NOTIFI_NEWS_DEFAULT = "true";
    /**
     * The new application notification parameter.
     */
    public static final String PARAM_NOTIFI_NEW_APP = "notification.newApp";
    /**
     * The new application notification parameter default value.
     */
    public static final String PARAM_NOTIFI_NEW_APP_DEFAULT = "true";
    /**
     * The update application notification parameter.
     */
    public static final String PARAM_NOTIFI_UPDATE_APP = "notification.updateApp";
    /**
     * The update application notification parameter default value.
     */
    public static final String PARAM_NOTIFI_UPDATE_APP_DEFAULT = "true";
    /**
     * The map of the user parameters.
     */
    private Map<String, String> tmp;

    /**
     * The default constructor.
     *
     * @param properties the profile properties.
     */
    public UserProfileConfiguration(List<UserConfigParam> properties) {
        tmp = new HashMap<>();
        if (properties != null) {
            for (UserConfigParam p : properties) {
                tmp.put(p.getName(), p.getValue());
            }
        }
    }

    /**
     * Returns
     * true if notification news is enabled.
     *
     * @return true if notification news is enabled.
     */
    public boolean isNotificationNews() {
        return getBooleanValue(PARAM_NOTIFI_NEWS, PARAM_NOTIFI_NEWS_DEFAULT);
    }

    /**
     * Returns
     * true if notification about new application is enabled.
     *
     * @return true if notification about new application is
     * enabled.
     */
    public boolean isNotificationNewApplication() {
        return getBooleanValue(PARAM_NOTIFI_NEW_APP, PARAM_NOTIFI_NEW_APP_DEFAULT);
    }

    /**
     * Returns
     * true if notification about update application is enabled.
     *
     * @return true if notification about update application is
     * enabled.
     */
    public boolean isNotificationUpdateApplication() {
        return getBooleanValue(PARAM_NOTIFI_UPDATE_APP, PARAM_NOTIFI_UPDATE_APP_DEFAULT);
    }

    /**
     * Gets the boolean value from the key.
     *
     * @param key the key.
     * @param defaultValue the default value.
     * @return the boolean value corresponding to the key.
     */
    private boolean getBooleanValue(String key, String defaultValue) {
        String value = tmp.get(key);
        if (value == null) {
            value = defaultValue;
        }
        return Boolean.parseBoolean(value);
    }
}


text:
package org.jbpm.datamodeler.core.impl;

import org.jbpm.datamodeler.core.Annotation;
import org.jbpm.datamodeler.core.HasAnnotations;

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

public abstract class AbstractHasAnnotations implements HasAnnotations {

    private List<Annotation> annotations = new ArrayList<Annotation>();

    @Override
    public List<Annotation> getAnnotations() {
        return annotations;
    }

    @Override
    public Annotation getAnnotation(String annotationName) {
        if (annotationName != null) {
            for (Annotation annotation : annotations) {
                if (annotationName.equals(annotation.getName())) return annotation;
            }
        }
        return null;
    }

    @Override
    public void addAnnotation(Annotation annotation) {
        annotations.add(annotation);
    }

    @Override
    public Annotation removeAnnotation(String annotationName) {
        Annotation result = null;
        if (annotationName != null) {
            for (Annotation annotation : annotations) {
                if (annotationName.equals(annotation.getName())) {
                    result = annotation;
                    annotations.remove(annotation);
                    break;
                }
            }
        }
        return result;
    }
}


text:
package com.vmware.upgrade.task;

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

import com.vmware.upgrade.Task;
import com.vmware.upgrade.progress.ExecutionState;
import com.vmware.upgrade.progress.impl.SimpleAggregatingProgressReporter;

/**
 * An {@link AbstractAggregateTask} encapsulates the core functionality of a {@link Task} which
 * aggregates other {@link Task}s
 *
 * @see AbstractSimpleTask
 *
 * @author Zach Shepherd <shepherdz@vmware.com>
 * @version 1.0
 * @since 1.0
 */
public abstract class AbstractAggregateTask extends AbstractTask<SimpleAggregatingProgressReporter> {

    private final List<Task> children;

    /**
     * Constructs a named task aggregating the supplied children
     *
     * @param name
     *          see {@link Task#getName()}
     * @param children
     *          the children to execute
     * @throws IllegalArgumentException
     *          if {@code children} is {@code null}
     */
    public AbstractAggregateTask(final String name, final List<Task> children) {
        super(name);

        if (children == null) {
            throw new IllegalArgumentException("children");
        }

        if (children.contains(null)) {
            throw new IllegalArgumentException("children");
        }

        this.children = new ArrayList<Task>(children.size());
        for (final Task child : children) {
            this.children.add(child);
        }

        createAndSetReporter();
    }

    private void createAndSetReporter() {
        SimpleAggregatingProgressReporter reporter =
            new SimpleAggregatingProgressReporter();

        if (!children.isEmpty()) {
            reporter.setChildren(children);
        }

        setReporter(reporter);
    }

    /**
     * Returns all tasks
     *
     * @return an unmodifiable list of {@link Task}s
     */
    protected final List<Task> getChildren() {
        return Collections.unmodifiableList(children);
    }

    /**
     * Delegate to {@link SimpleAggregatingProgressReporter#getState()}
     */
    protected final ExecutionState getState() {
        return getReporter().getState();
    }
}


text:
echo "StackOps Openstack Distribution `cat /etc/nova/STACKOPSVERSION` \v" > /etc/issue
echo "" >> /etc/issue
echo "To configure this node, connect to http://`LC_ALL=C ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`:8888 " >> /etc/issue
echo "" >> /etc/issue
ln -sf /etc/nova/motd.stackops /etc/motd


text:
package com.yuyakaido.android.cardstackview.internal;

import android.content.Context;

public final class DisplayUtil {

    private DisplayUtil() {}

    public static int dpToPx(Context context, float dp) {
        float density = context.getResources().getDisplayMetrics().density;
        return (int) (dp * density + 0.5f);
    }

}


text:
package com.google.cloud.tools.eclipse.login.ui;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.internal.ui.viewsupport.ImageDisposer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Label;

@VisibleForTesting
public class LabelImageLoader {

  @VisibleForTesting
  final static ConcurrentHashMap<String, ImageData> cache = new ConcurrentHashMap<>();

  @VisibleForTesting
  Job loadJob;

  /**
   * Loads an image to a {@link Label}. The image will be fetched from {@code imageUrl}
   * asynchronously if not previously cached.
   *
   * Must be called in the UI context.
   */
  @VisibleForTesting
  public void loadImage(String imageUrl, Label label) throws MalformedURLException {
    Preconditions.checkNotNull(imageUrl);

    ImageData imageData = cache.get(imageUrl);
    if (imageData != null) {
      Image image = new Image(label.getDisplay(), imageData);
      label.addDisposeListener(new ImageDisposer(image));
      label.setImage(image);
    } else {
      loadJob = new LabelImageLoadJob(new URL(imageUrl), label);
      loadJob.schedule();
    }
  }

  static void storeInCache(String imageUrl, ImageData imageData) {
    cache.put(imageUrl, imageData);
  }
}


text:
The main reason is becuase https usage runs into mixed-content restrictions.

Web scanner allows barcode scanning directly from any android web browser.

Web developers can utilize a simple javascript API to include scanning functionality within their website, complete with a camera preview.

The android applet provides a HTTP API that runs on localhost.
On request it captures from the camera and returns a json object with the following:

1. A base 64 preview image
2. Any decoded barcode

The javascript API is used for these things:

1. Setting a default callback for each barcode found.
2. Setting a fire-once callback (optional)
3. Checking that the HTTP API is online (That the android applet is open)
4. Shutting down the android applet when the user navigates away from the page
5. Redirecting to applet (if installed) or to the Google Play listing if applet isn't online.

## Example & Usage
https://wallaceit.com.au/androidwebscanner/example.html
(View source for usage)

## Supported Barcodes

| 1D product | 1D industrial | 2D
| ---------- | ------------- | --------------
| UPC-A      | Code 39       | QR Code
| UPC-E      | Code 93       | Data Matrix
| EAN-8      | Code 128      | Aztec (beta)
| EAN-13     | Codabar       | PDF 417 (beta)
|            | ITF           |
|            | RSS-14        |
|            | RSS-Expanded  |

This project uses the xzing library for barcode decoding, for more info about xzing see:

https://github.com/zxing/zxing/


text:
using namespace BGE;

Assignment::Assignment(void)
{
	physicsFactory = NULL;
	dynamicsWorld = NULL;
	broadphase = NULL;
	dispatcher = NULL;
	solver = NULL;
	fullscreen = false;

}

Assignment::~Assignment(void)
{
}

bool Assignment::Initialise()
{
	cameraLock = true;
	fireRate= 5.0f;
	riftEnabled = false;

	// Set up the collision configuration and dispatcher
    collisionConfiguration = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfiguration);
	soundSystem->PlaySoundW("sound",glm::vec3(0,0,0));

    // The world.
	btVector3 worldMin(-1000,-1000,-1000);
	btVector3 worldMax(1000,1000,1000);
	broadphase = new btAxisSweep3(worldMin,worldMax);
	solver = new btSequentialImpulseConstraintSolver();
	dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
    dynamicsWorld->setGravity(btVector3(0,-9,0));

		for(int i = 0; i < 20; i++)
		{
			for(int j = 0; j < 10; j++)
			{
				shared_ptr<FountainEffect> fountain = make_shared<FountainEffect>(500);
				fountain->diffuse = glm::vec3(1,0,0);
				fountain->position.x = 100 - (10 * i);
				fountain->position.z = 485 + (1000 * j);
				fountain->position.y =100;
				Attach(fountain);
			}
		}

	physicsFactory = make_shared<PhysicsFactory>(dynamicsWorld);

	physicsFactory->CreateGroundPhysics();
	physicsFactory->CreateCameraPhysics();

	shared_ptr<PhysicsController> wallL = physicsFactory->CreateContainerWall(100, 300, 10000, glm::vec3(100,0,5500), glm::quat());
	shared_ptr<PhysicsController> wallR = physicsFactory->CreateContainerWall(100, 300, 10000, glm::vec3(-100,0,5500), glm::quat());
	shared_ptr<PhysicsController> roof  = physicsFactory->CreateContainerWall(50, 20, 10000, glm::vec3(0,150,5500), glm::quat());

	for(int i = 0; i < 10;i++)
	{
		if( i % 2 == 0)
		{
			shared_ptr<PhysicsController> obstacle  = physicsFactory->CreateContainerWall(100, 20, 20, glm::vec3(0,60,(i * 1000)), glm::quat());
		}
		else
		{
			shared_ptr<PhysicsController> obstacle  = physicsFactory->CreateContainerWall(100, 20, 20, glm::vec3(0,20,(1000 * i)), glm::quat());
		}
	}
	USSEnterprise = physicsFactory->CreateFromModel("USSEnterprise",glm::vec3(0,50,0),glm::quat(),2,glm::vec3(5,2.5,5));

	mass = 1.0f;
	dforce = 1000;
	t =0.0f;

	body = physicsFactory->CreateRagDoll(1,1,4,glm::vec3(0,0,0));
	body->position = glm::vec3(USSEnterprise->PhysicsController::position.x,USSEnterprise->PhysicsController::position.y - 3,USSEnterprise->PhysicsController::position.z);
	if (!Game::Initialise()) {
		return false;
	}
	camera->GetController()->position = USSEnterprise->position;
	camera->look = -USSEnterprise->look;
	USSEnterprise->Attach(camera);

	return true;
}

void BGE::Assignment::Update(float timeDelta)
{
	float newtons = 10.0f;
	float epsilon = glm::epsilon<float>();
	float theta;
	glm::vec3 axis;
	glm::vec3 toShip2;

	camera->GetController()->look = -USSEnterprise->look;
	camera->GetController()->up = USSEnterprise->PhysicsController::up;
	camera->GetController()->right = USSEnterprise->PhysicsController::right;

	if (USSEnterprise->position.y < 5)
	{
		USSEnterprise->PhysicsController::rigidBody->applyCentralForce(GLToBtVector(USSEnterprise->PhysicsController::up * dforce));
	}

	if (USSEnterprise->position.y > 1000)
	{
		USSEnterprise->PhysicsController::rigidBody->applyCentralForce(GLToBtVector(-USSEnterprise->PhysicsController::up * dforce));
	}

	if (keyState[SDL_SCANCODE_LEFT])
	{
		USSEnterprise->PhysicsController::rigidBody->setAngularVelocity(btVector3(0,1,0));
		USSEnterprise->PhysicsController::rigidBody->applyCentralForce(GLToBtVector(USSEnterprise->PhysicsController::right * (dforce * 2 )));
	}
	if (keyState[SDL_SCANCODE_RIGHT])
	{
		 USSEnterprise->PhysicsController::rigidBody->setAngularVelocity(btVector3(0,-1,0));
		 USSEnterprise->PhysicsController::rigidBody->applyCentralForce(GLToBtVector(-USSEnterprise->PhysicsController::right * (dforce * 2 )));
	}

	if(keyState[SDL_SCANCODE_DOWN])
    {
       USSEnterprise->PhysicsController::rigidBody->setAngularVelocity(btVector3(1,0,0));
    }
	if(keyState[SDL_SCANCODE_UP])
    {
      USSEnterprise->PhysicsController::rigidBody->setAngularVelocity(btVector3(-1,0,0));
    }

	if(keyState[SDL_SCANCODE_S])
    {
		dforce = 3000;
    }
	else
	{
		dforce = 1000;
	}

	float moveSpeed = speed;
	float timeToPass = 1.0f / fireRate;

	if ((keyState[SDL_SCANCODE_SPACE]) && (elapsed > timeToPass))
	{
		glm::vec3 pos = glm::vec3(USSEnterprise->PhysicsController::position.x,USSEnterprise->PhysicsController::position.y - 10, USSEnterprise->PhysicsController::position.z + 10)  + (-USSEnterprise->PhysicsController::look * 5.0f);
		glm::quat q(RandomFloat(), RandomFloat(), RandomFloat(), RandomFloat());
		glm::normalize(q);
		shared_ptr<PhysicsController> physicsComponent = physicsFactory->CreateBox(1,1,1, pos, q);

		float force = 5000.0f;
		physicsComponent->rigidBody->applyCentralForce(GLToBtVector(-USSEnterprise->look * force));
		elapsed = 0.0f;
	}
		else
	{
		elapsed += timeDelta;
	}

	camera->GetController()->position = USSEnterprise->PhysicsController::position;
	camera->orientation = USSEnterprise->PhysicsController::orientation * camera->GetController()->orientation;
	camera->RecalculateVectors();
	camera->view = glm::lookAt(camera->position, camera->position + camera->look, camera->up);

	camera->GetController()->position.z = camera->GetController()->position.z - 40;
    camera->GetController()->position.y = camera->GetController()->position.y + 10;

	USSEnterprise->PhysicsController::rigidBody->applyCentralForce(GLToBtVector(-USSEnterprise->PhysicsController::look * dforce));

	USSEnterprise->PhysicsController::rigidBody->setDamping(0.99,0.99);

	dynamicsWorld->stepSimulation(timeDelta,300);
	Game::Update(timeDelta);
}

void BGE::Assignment::Cleanup()
{
	Game::Cleanup();
}


text:
select c_last_name
       ,c_first_name
       ,c_salutation
       ,c_preferred_cust_flag
       ,ss_ticket_number
       ,cnt from
   (select ss_ticket_number
          ,ss_customer_sk
          ,count(*) cnt
    from store_sales,date_dim,store,household_demographics
    where store_sales.ss_sold_date_sk = date_dim.d_date_sk
    and store_sales.ss_store_sk = store.s_store_sk
    and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
    and date_dim.d_dom between 1 and 2
    and (household_demographics.hd_buy_potential = '>10000' or
         household_demographics.hd_buy_potential = '5001-10000')
    and household_demographics.hd_vehicle_count > 0
    and case when household_demographics.hd_vehicle_count > 0 then
             household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1
    and date_dim.d_year in (1998,1998+1,1998+2)
    and store.s_county in ('Kittitas County','Levy County','Oglethorpe County','Raleigh County')
    group by ss_ticket_number,ss_customer_sk) dj,customer
    where ss_customer_sk = c_customer_sk
      and cnt between 1 and 5
    order by cnt desc, c_last_name asc;


text:
<rss version="2.0">
<channel>
<item>

</item>
</channel>
</rss>


text:
package cs437.som.visualization;

import cs437.som.SelfOrganizingMap;

import javax.swing.*;
import java.awt.*;

/**
 * Visualization for SOM with a 2-dimensional input.
 */
public class SOM2dPlotter extends JFrame {
    private static final long serialVersionUID = 0L;

    /**
     * The frame width.
     */
    public static final int WIDTH = 400;

    /**
     * The frame height.
     */
    public static final int HEIGHT = 400;

    private SelfOrganizingMap som = null;
    private int neuronCount = 0;

    /**
     * Create and setup a dot plot for a 2D input SOM.
     * @param map The SOM to plot.
     */
    public SOM2dPlotter(SelfOrganizingMap map) {
        super("SOM Plot");
        if (map.getInputLength() != 2) {
            throw new IllegalArgumentException("\"map\" must accept 2-tuple input.");
        }

        this.som = map;
        neuronCount = map.getNeuronCount();
        setSize(WIDTH, HEIGHT);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        createBufferStrategy(2);
    }

    /**
     * Draw the current "locations" of the SOM's neurons.
     */
    public void draw() {
        Graphics g = getBufferStrategy().getDrawGraphics();
        g.setColor(Color.white);
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(Color.black);

        double[][] points = new double[neuronCount][2];

        // find the x- and y-axis spread
        double xmin = Double.MAX_VALUE, xmax = Double.MIN_VALUE;
        double ymin = Double.MAX_VALUE, ymax = Double.MIN_VALUE;
        for (int i = 0; i < neuronCount; i++) {
            points[i][0] = som.getWeight(i, 0);
            points[i][1] = som.getWeight(i, 1);
            xmin = Math.min(xmin, points[i][0]);
            ymin = Math.min(ymin, points[i][1]);
            xmax = Math.max(xmax, points[i][0]);
            ymax = Math.max(ymax, points[i][1]);
        }

        // compute the scaling factor
        double dx = getWidth() / (xmax - xmin);
        double dy = getHeight() / (ymax - ymin);

        for (double[] pt : points) {
            // zero-base the coordinates and scale them to window size
            int x = (int) Math.round((pt[0] - xmin) * dx);
            int y = (int) Math.round((pt[1] - ymin) * dy);
            g.drawOval(x - 2, y - 2, 4, 4);
        }

        getBufferStrategy().show();
    }

    @Override
    public String toString() {
        return "SOM2dPlotter{som=" + som + '}';
    }
}


text:
Tab Nav Bar

<button md-button (click)="tabLinks.shift()">Remove tab</button>
<button md-button (click)="swapTabLinks()">Swap first two</button>
<button md-button (click)="addToLabel()">Add to labels</button>

      {{tabLink.label}}

    Disabled Link

  <router-outlet></router-outlet>

Tab Group Demo - Dynamic Tabs

  Selected tab index:
  <md-input-container>
    <input mdInput type="number" [(ngModel)]="activeTabIndex">
  </md-input-container>

  <md-card>
    <md-card-title>Add New Tab</md-card-title>
    <md-card-content>
      <md-checkbox [(ngModel)]="createWithLongContent">
        Include extra content
      </md-checkbox>
      <md-checkbox [(ngModel)]="gotoNewTabAfterAdding">
        Select after adding
      </md-checkbox>

        Position:
        <md-input-container>
          <input mdInput type="number" [(ngModel)]="addTabPosition">
        </md-input-container>

      <button md-raised-button color="primary"
              (click)="addTab(createWithLongContent)">
        Add
      </button>
    </md-card-content>
  </md-card>

  <md-tab-group class="demo-tab-group" dynamicHeight [(selectedIndex)]="activeTabIndex">
    <md-tab *ngFor="let tab of dynamicTabs" [disabled]="tab.disabled">
      <ng-template md-tab-label>{{tab.label}}</ng-template>

        {{tab.content}}

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
          Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus.
          In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec,
          feugiat ultricies mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor,
          orci enim rutrum enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius
          gravida. Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat
          diam, a facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod
          ac lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim
          venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit.
          Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec
          orci posuere, nec luctus mauris semper.

          Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec
          magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis.
          Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel.
          Cras ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit
          tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed
          nisl consectetur, rhoncus sapien sit amet, tempus sapien.

          Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere
          molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit erat,
          at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac est.
          Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.

        <md-input-container>
          <input mdInput placeholder="Tab Label" [(ngModel)]="tab.label">
        </md-input-container>

        <button md-raised-button
                [disabled]="dynamicTabs.length == 1"
                (click)="deleteTab(tab)">
          Delete Tab
        </button>

    </md-tab>
  </md-tab-group>

Tab Group Demo - Dynamic Height

<md-tab-group class="demo-tab-group" dynamicHeight>
  <md-tab *ngFor="let tab of tabs" [disabled]="tab.disabled">
    <ng-template md-tab-label>{{tab.label}}</ng-template>

      {{tab.content}}

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
        Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus.
        In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec,
        feugiat ultricies mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor,
        orci enim rutrum enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius
        gravida. Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat
        diam, a facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod
        ac lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim
        venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit.
        Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec
        orci posuere, nec luctus mauris semper.

        Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec
        magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis.
        Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel.
        Cras ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit
        tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed
        nisl consectetur, rhoncus sapien sit amet, tempus sapien.

        Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere
        molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit erat,
        at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac est.
        Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.

      <md-input-container>
        <input mdInput placeholder="Tab Label" [(ngModel)]="tab.label">
      </md-input-container>

  </md-tab>
</md-tab-group>

Tab Group Demo - Fixed Height

<md-tab-group class="demo-tab-group" style="height: 220px">
  <md-tab *ngFor="let tab of tabs" [disabled]="tab.disabled">
    <ng-template md-tab-label>{{tab.label}}</ng-template>

      {{tab.content}}

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla venenatis ante augue.
        Phasellus volutpat neque ac dui mattis vulputate. Etiam consequat aliquam cursus.
        In sodales pretium ultrices. Maecenas lectus est, sollicitudin consectetur felis nec,
        feugiat ultricies mi. Aliquam erat volutpat. Nam placerat, tortor in ultrices porttitor,
        orci enim rutrum enim, vel tempor sapien arcu a tellus. Vivamus convallis sodales ante varius
        gravida. Curabitur a purus vel augue ultrices ultricies id a nisl. Nullam malesuada consequat
        diam, a facilisis tortor volutpat et. Sed urna dolor, aliquet vitae posuere vulputate, euismod
        ac lorem. Sed felis risus, pulvinar at interdum quis, vehicula sed odio. Phasellus in enim
        venenatis, iaculis tortor eu, bibendum ante. Donec ac tellus dictum neque volutpat blandit.
        Praesent efficitur faucibus risus, ac auctor purus porttitor vitae. Phasellus ornare dui nec
        orci posuere, nec luctus mauris semper.

        Morbi viverra, ante vel aliquet tincidunt, leo dolor pharetra quam, at semper massa orci nec
        magna. Donec posuere nec sapien sed laoreet. Etiam cursus nunc in condimentum facilisis.
        Etiam in tempor tortor. Vivamus faucibus egestas enim, at convallis diam pulvinar vel.
        Cras ac orci eget nisi maximus cursus. Nunc urna libero, viverra sit amet nisl at, hendrerit
        tempor turpis. Maecenas facilisis convallis mi vel tempor. Nullam vitae nunc leo. Cras sed
        nisl consectetur, rhoncus sapien sit amet, tempus sapien.

        Integer turpis erat, porttitor vitae mi faucibus, laoreet interdum tellus. Curabitur posuere
        molestie dictum. Morbi eget congue risus, quis rhoncus quam. Suspendisse vitae hendrerit erat,
        at posuere mi. Cras eu fermentum nunc. Sed id ante eu orci commodo volutpat non ac est.
        Praesent ligula diam, congue eu enim scelerisque, finibus commodo lectus.

      <md-input-container>
        <input mdInput placeholder="Tab Label" [(ngModel)]="tab.label">
      </md-input-container>

  </md-tab>
</md-tab-group>

Stretched Tabs

<md-tab-group class="demo-tab-group" style="height: 200px" md-stretch-tabs>
  <md-tab *ngFor="let tab of tabs" [disabled]="tab.disabled">
    <ng-template md-tab-label>{{tab.label}}</ng-template>

      {{tab.content}}

  </md-tab>
</md-tab-group>

Async Tabs

<md-tab-group class="demo-tab-group">
  <md-tab *ngFor="let tab of asyncTabs | async; let i = index" [disabled]="i == 1">
    <ng-template md-tab-label>{{tab.label}}</ng-template>

      {{tab.content}}

      <md-input-container>
        <input mdInput placeholder="Tab Label" [(ngModel)]="tab.label">
      </md-input-container>

  </md-tab>
</md-tab-group>

Tabs with simplified api

<md-tab-group class="demo-tab-group">
  <md-tab label="Earth">

      This tab is about the Earth!

  </md-tab>
  <md-tab label="Fire">
    This tab is about combustion!
  </md-tab>
</md-tab-group>

Inverted tabs

<md-tab-group class="demo-tab-group" headerPosition="below">
  <md-tab label="Earth">

      This tab is about the Earth!

  </md-tab>
  <md-tab label="Fire">

      This tab is about combustion!

  </md-tab>
</md-tab-group>


text:
#include "img-precomp.h"  // Precompiled headers
//
#include <mrpt/config.h>
#include <mrpt/img/CEnhancedMetaFile.h>
#include <mrpt/img/CImage.h>
#include <mrpt/system/os.h>

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

using namespace mrpt;
using namespace mrpt::img;
using namespace mrpt::system;

static int LINUX_IMG_WIDTH_value = 800;
static int LINUX_IMG_HEIGHT_value = 600;

void CEnhancedMetaFile::LINUX_IMG_WIDTH(int value)
{
	LINUX_IMG_WIDTH_value = value;
}
int CEnhancedMetaFile::LINUX_IMG_WIDTH() { return LINUX_IMG_WIDTH_value; }
void CEnhancedMetaFile::LINUX_IMG_HEIGHT(int value)
{
	LINUX_IMG_HEIGHT_value = value;
}
int CEnhancedMetaFile::LINUX_IMG_HEIGHT() { return LINUX_IMG_HEIGHT_value; }
/*---------------------------------------------------------------
						Constructor
---------------------------------------------------------------*/
CEnhancedMetaFile::CEnhancedMetaFile(
	const std::string& targetFileName, int scaleFactor)
	: m_scale(scaleFactor), m_targetFile(targetFileName)
{
#ifdef _WIN32
	m_hdc =
		CreateEnhMetaFileA(nullptr, targetFileName.c_str(), nullptr, nullptr);
	if (!m_hdc.get()) THROW_EXCEPTION("Can't create EMF file!!!");
#else
	m_hdc = (void*)new CImage(LINUX_IMG_WIDTH_value, LINUX_IMG_HEIGHT_value);
	((CImage*)m_hdc.get())
		->filledRectangle(
			0, 0, LINUX_IMG_WIDTH_value - 1, LINUX_IMG_HEIGHT_value - 1,
			TColor(0, 0, 0));
#endif
}

/*---------------------------------------------------------------
						Destructor
---------------------------------------------------------------*/
CEnhancedMetaFile::~CEnhancedMetaFile()
{
#ifdef _WIN32
	// Free objects:
	if (m_hFont.get())
	{
		DeleteObject(m_hFont.get());
		m_hFont = nullptr;
	}

	// Finish EMF:
	DeleteEnhMetaFile(CloseEnhMetaFile((HDC)m_hdc.get()));
#else
	((CImage*)m_hdc.get())->saveToFile(m_targetFile + ".png");

	// Free objects:
	delete ((CImage*)m_hdc.get());
#endif
}

/*---------------------------------------------------------------
						drawImage
---------------------------------------------------------------*/
void CEnhancedMetaFile::drawImage(int x, int y, const mrpt::img::CImage& img)
{
#ifdef _WIN32
	try
	{
		LPBITMAPINFO pBmpInfo = (LPBITMAPINFO) new unsigned char
			[sizeof(BITMAPINFOHEADER) + (256 * sizeof(RGBQUAD))];
		//		LPBITMAPINFO		pBmpInfo = (LPBITMAPINFO) new unsigned
		// char[sizeof(BITMAPINFOHEADER) ];

		unsigned int imgWidth = (unsigned int)img.getWidth();
		unsigned int imgHeight = (unsigned int)img.getHeight();

		pBmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
		pBmpInfo->bmiHeader.biWidth = imgWidth;
		pBmpInfo->bmiHeader.biHeight = imgHeight;
		pBmpInfo->bmiHeader.biPlanes = 1;
		//		pBmpInfo->bmiHeader.biBitCount		= 24;
		pBmpInfo->bmiHeader.biBitCount = 8;
		pBmpInfo->bmiHeader.biCompression = BI_RGB;
		pBmpInfo->bmiHeader.biSizeImage = 0;
		pBmpInfo->bmiHeader.biXPelsPerMeter =
			pBmpInfo->bmiHeader.biYPelsPerMeter = 0;
		pBmpInfo->bmiHeader.biClrUsed = 0;
		pBmpInfo->bmiHeader.biClrImportant = 0;

		// Palette
		for (unsigned char i = 0; i < 255; i++)
		{
			pBmpInfo->bmiColors[i].rgbRed = i;
			pBmpInfo->bmiColors[i].rgbGreen = i;
			pBmpInfo->bmiColors[i].rgbBlue = i;
			pBmpInfo->bmiColors[i].rgbReserved = 0;
		}

		//		unsigned int	lineBytes = 3*bmp.Width;
		unsigned int lineBytes = imgWidth;
		if (lineBytes % 2) lineBytes++;
		if (lineBytes % 4) lineBytes += 2;

		BYTE* ptrBits = new BYTE[lineBytes * imgHeight];

		for (unsigned int py = 0; py < imgHeight; py++)
			for (unsigned int px = 0; px < imgWidth; px++)
				ptrBits[(py * lineBytes + px) + 0] = *img(px, py);

		HBITMAP hBitmap = CreateDIBitmap(
			(HDC)m_hdc.get(), &pBmpInfo->bmiHeader, CBM_INIT, ptrBits, pBmpInfo,
			DIB_RGB_COLORS);

		ASSERT_(hBitmap != nullptr);

		BITMAP bm;
		GetObject(hBitmap, sizeof(bm), &bm);

		HDC hdcMem = CreateCompatibleDC((HDC)m_hdc.get());
		HBITMAP hbmT = (HBITMAP)SelectObject(hdcMem, hBitmap);

		BitBlt(
			(HDC)m_hdc.get(), x, y, (int)(m_scale * imgWidth),
			(int)(m_scale * imgHeight), hdcMem, 0, 0, SRCCOPY);

		SelectObject(hdcMem, hbmT);
		DeleteDC(hdcMem);

		// Free mem:
		// ---------------------------------------
		DeleteObject(hBitmap);
		delete[] pBmpInfo;
		delete[] ptrBits;
	}
	catch (...)
	{
		THROW_EXCEPTION("Unexpected runtime error!!");
	}
#else
	((CImage*)m_hdc.get())->drawImage(x, y, img);
#endif
}

/*---------------------------------------------------------------
						drawBitmap
---------------------------------------------------------------*/
void CEnhancedMetaFile::line(
	int x0, int y0, int x1, int y1, const mrpt::img::TColor color,
	unsigned int width, TPenStyle penStyle)
{
#ifdef _WIN32
	x0 *= m_scale;
	y0 *= m_scale;
	x1 *= m_scale;
	y1 *= m_scale;

	HPEN hPen = CreatePen(penStyle, width, (unsigned int)color);

	HPEN hOldPen = (HPEN)SelectObject((HDC)m_hdc.get(), hPen);

	MoveToEx((HDC)m_hdc.get(), x0, y0, nullptr);
	LineTo((HDC)m_hdc.get(), x1, y1);

	SelectObject((HDC)m_hdc.get(), hOldPen);
	DeleteObject(hPen);
#else
	((CImage*)m_hdc.get())->line(x0, y0, x1, y1, color, width, penStyle);
#endif
}

/*---------------------------------------------------------------
						drawBitmap
---------------------------------------------------------------*/
void CEnhancedMetaFile::textOut(
	int x0, int y0, const std::string& str, const mrpt::img::TColor color)
{
#ifdef _WIN32
	x0 *= m_scale;
	y0 *= m_scale;

	::SetBkMode((HDC)m_hdc.get(), TRANSPARENT);
	::SetTextColor((HDC)m_hdc.get(), (unsigned int)color);

	::TextOutA((HDC)m_hdc.get(), x0, y0, str.c_str(), (int)str.size());
#else
	((CImage*)m_hdc.get())->textOut(x0, y0, str, color);
#endif
}

/*---------------------------------------------------------------
					selectVectorTextFont
---------------------------------------------------------------*/
void CEnhancedMetaFile::selectVectorTextFont(
	[[maybe_unused]] const std::string& fontName, [[maybe_unused]] int fontSize,
	[[maybe_unused]] bool bold, [[maybe_unused]] bool italic)
{
#ifdef _WIN32
	HFONT hFont, oldFont;
	LOGFONTA lpf;

	lpf.lfHeight = fontSize;
	lpf.lfWidth = 0;
	lpf.lfEscapement = 0;
	lpf.lfOrientation = 0;
	lpf.lfWeight = bold ? 700 : 400;
	lpf.lfItalic = italic ? 1 : 0;
	lpf.lfUnderline = 0;
	lpf.lfStrikeOut = 0;
	lpf.lfCharSet = DEFAULT_CHARSET;
	lpf.lfOutPrecision = OUT_DEFAULT_PRECIS;
	lpf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
	lpf.lfQuality = DEFAULT_QUALITY;
	lpf.lfPitchAndFamily = DEFAULT_PITCH;
	os::strcpy(lpf.lfFaceName, LF_FACESIZE, fontName.c_str());

	hFont = ::CreateFontIndirectA(&lpf);

	oldFont = (HFONT)::SelectObject((HDC)m_hdc.get(), hFont);

	if (oldFont) ::DeleteObject(oldFont);
#else
	MRPT_TRY_START;

	((CImage*)m_hdc.get())->selectTextFont(fontName);

	MRPT_TRY_END;
#endif
}

/*---------------------------------------------------------------
					setPixel
---------------------------------------------------------------*/
void CEnhancedMetaFile::setPixel(int x, int y, size_t color)
{
#ifdef _WIN32
	::SetPixel((HDC)m_hdc.get(), x * m_scale, y * m_scale, color);
#else
	((CImage*)m_hdc.get())->setPixel(x, y, color);
#endif
}

/*---------------------------------------------------------------
						rectangle
---------------------------------------------------------------*/
void CEnhancedMetaFile::rectangle(
	int x0, int y0, int x1, int y1, TColor color, unsigned int width)
{
	line(x0, y0, x1, y0, color, width);
	line(x1, y0, x1, y1, color, width);
	line(x1, y1, x0, y1, color, width);
	line(x0, y1, x0, y0, color, width);
}


text:
'use strict';

/* Controllers */
var key = "com.jinshanlife.cart";

var getTimestamp = function () {
    return Math.round(new Date().getTime() / 1000);
};

var CartController = ['$scope', 'Cart', function ($scope, Cart) {
    $scope.cart = Cart;
    $scope.cart.init();
    $scope.cart.sum();
    $scope.currentDate = '';
    $scope.updateDate = function (date) {
        $scope.cart.recdate = date + "T00:00:00+08:00";
    };
}];

var FilterController = ['$scope', 'Filter', 'Area', function ($scope, Filter, Area) {
    $scope.town = Area.town();
    $scope.doFilter = Filter;

    $scope.addFilterCategory = function (filter) {
        var i;
        if ($scope.doFilter.filterDetail.category === undefined) {
            $scope.doFilter.filterDetail.category = [];
        }
        if ($scope.doFilter.filters === undefined) {
            $scope.doFilter.filters = [];
        }
        i = $scope.doFilter.filterDetail.category.indexOf(filter);
        if (i === -1) {
            $scope.doFilter.filterDetail.category.push(filter);
            $scope.doFilter.filters.push({"key": "category", "value": filter});
        }
    };

    $scope.addFilterTown = function (filter) {
        var i;
        if ($scope.doFilter.filterDetail.town === undefined) {
            $scope.doFilter.filterDetail.town = [];
        }
        if ($scope.doFilter.filters === undefined) {
            $scope.doFilter.filters = [];
        }
        i = $scope.doFilter.filterDetail.town.indexOf(filter);
        if (i === -1) {
            $scope.doFilter.filterDetail.town.push(filter);
            $scope.doFilter.filters.push({"key": "town", "value": filter});
        }
    };

    $scope.removeFilter = function (filterObject) {
        var i = -1;
        i = $scope.doFilter.filters.indexOf(filterObject);
        if (i !== -1) {
            $scope.doFilter.filters.splice(i, 1);
        }
        if ($scope.doFilter.filterDetail.town !== undefined) {
            i = $scope.doFilter.filterDetail.town.indexOf(filterObject.value);
            if (i !== -1) {
                $scope.doFilter.filterDetail.town.splice(i, 1);
            }
        }
        if ($scope.doFilter.filterDetail.category !== undefined) {
            i = $scope.doFilter.filterDetail.category.indexOf(filterObject.value);
            if (i !== -1) {
                $scope.doFilter.filterDetail.category.splice(i, 1);
            }
        }
    };

    $scope.resetFilter = function () {
       Filter.clear();
    }

}];

var MainController = ['$scope', '$location', 'Cate', 'Help', 'Training', 'Fresh', function ($scope, $location, Cate, Help, Training, Fresh) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    $scope.catestores = Cate.top();
    $scope.helpstores = Help.top();
    $scope.trainingtores = Training.top();
    $scope.freshstores = Fresh.top();
}];

var CateController = ['$scope', '$routeParams', '$location', 'Cate', 'Filter', 'Category', function ($scope, $routeParams, $location, Cate, Filter, Category) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    $scope.stores = Cate.query();
    if ($routeParams.Id !== undefined) {
        $scope.store = Cate.get({Id: $routeParams.Id});
    }
    $scope.orderProp = "idx";
    var storeId = $routeParams.storeId;

    $scope.category = Category.cate();

}];

var CateDetailController = ['$scope', '$routeParams', '$location', 'Cate', 'Filter', 'Cart', function ($scope, $routeParams, $location, Cate, Filter, Cart) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    $scope.cart = Cart;
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    if ($routeParams.Id !== undefined) {
        $scope.store = Cate.get({Id: $routeParams.Id});
    }
    var storeId = $routeParams.Id;
    $scope.orderProp = "idx";

    $scope.cart.init();
    $scope.cart.sum();

}];

var FreshController = ['$scope', '$routeParams', '$location', 'Fresh', 'Filter', 'Category', function ($scope, $routeParams, $location, Fresh, Filter, Category) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    $scope.stores = Fresh.query();
    if ($routeParams.Id !== undefined) {
        $scope.store = Fresh.get({Id: $routeParams.Id});
    }
    $scope.orderProp = "idx";
    var storeId = $routeParams.storeId;

    $scope.category = Category.fresh();

}];

var FreshDetailController = ['$scope', '$routeParams', '$location', 'Fresh', 'Filter', 'Cart', function ($scope, $routeParams, $location, Fresh, Filter, Cart) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    $scope.cart = Cart;
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    if ($routeParams.Id !== undefined) {
        $scope.store = Fresh.get({Id: $routeParams.Id});
    }
    var storeId = $routeParams.storeId;
    $scope.orderProp = "idx";
    $scope.cart.init();
    $scope.cart.sum();

}];

var HelpController = ['$scope', '$routeParams', '$location', 'Help', 'Filter', 'Category', function ($scope, $routeParams, $location, Help, Filter, Category) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    $scope.stores = Help.query();
    if ($routeParams.Id !== undefined) {
        $scope.store = Help.get({Id: $routeParams.Id});
    }
    $scope.orderProp = "idx";
    var storeId = $routeParams.storeId;

    $scope.category = Category.help();

}];

var HelpDetailController = ['$scope', '$routeParams', '$location', 'Help', 'Filter', 'Cart', function ($scope, $routeParams, $location, Help, Filter, Cart) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    $scope.cart = Cart;
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    if ($routeParams.Id !== undefined) {
        $scope.store = Help.get({Id: $routeParams.Id});
    }
    var storeId = $routeParams.storeId;
    $scope.orderProp = "idx";
    $scope.cart.init();
    $scope.cart.sum();

}];

var StoreKindController = ['$scope', 'StoreKind', function ($scope, StoreKind) {
    $scope.storekind = StoreKind.query();
}];

var TrainingController = ['$scope', '$routeParams', '$location', 'Training', 'Filter', 'Category', function ($scope, $routeParams, $location, Training, Filter, Category) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    $scope.stores = Training.query();
    if ($routeParams.Id !== undefined) {
        $scope.store = Training.get({Id: $routeParams.Id});
    }
    $scope.orderProp = "idx";
    var storeId = $routeParams.storeId;

    $scope.category = Category.training();

}];

var TrainingDetailController = ['$scope', '$routeParams', '$location', 'Training', 'Filter', 'Cart', function ($scope, $routeParams, $location, Training, Filter, Cart) {

    $scope.goto = function (path) {
        $location.path(path);
    };
    $scope.cart = Cart;
    Filter.clear();
    $scope.doFilter = Filter;
    $scope.store;
    if ($routeParams.Id !== undefined) {
        $scope.store = Training.get({Id: $routeParams.Id});
    }
    var storeId = $routeParams.Id;
    $scope.orderProp = "idx";

    $scope.cart.init();
    $scope.cart.sum();

}];

var WebLinksController = ['$scope', 'WebLinks', function ($scope, WebLinks) {
    $scope.weblinks = WebLinks.links();
    $scope.webshortcuts = WebLinks.shortcuts();
}];


text:
package de.learnlib.alex.data.events;

import de.learnlib.alex.data.entities.SymbolGroup;
import de.learnlib.alex.webhooks.entities.Event;
import de.learnlib.alex.webhooks.entities.EventType;
import java.util.List;

/** Symbol group events. */
public class SymbolGroupEvent {

    /** Event for when a symbol group is created. */
    public static class Created extends Event<SymbolGroup> {

        /**
         * Constructor.
         *
         * @param symbolGroup
         *         The created symbol group .
         */
        public Created(SymbolGroup symbolGroup) {
            super(symbolGroup, EventType.SYMBOL_GROUP_CREATED);
        }
    }

    /** Event for when a symbol group is created. */
    public static class CreatedMany extends Event<List<SymbolGroup>> {

        /**
         * Constructor.
         *
         * @param symbolGroups
         *         The created symbol group .
         */
        public CreatedMany(List<SymbolGroup> symbolGroups) {
            super(symbolGroups, EventType.SYMBOL_GROUPS_CREATED);
        }
    }

    /** Event for when a symbol group is deleted. */
    public static class Deleted extends Event<Long> {

        /**
         * Constructor.
         *
         * @param id
         *         The id of the deleted symbol group .
         */
        public Deleted(Long id) {
            super(id, EventType.SYMBOL_GROUP_DELETED);
        }
    }

    /** Event for when a symbol group is updated. */
    public static class Updated extends Event<SymbolGroup> {

        /**
         * Constructor.
         *
         * @param symbolGroup
         *         The updated symbol group .
         */
        public Updated(SymbolGroup symbolGroup) {
            super(symbolGroup, EventType.SYMBOL_GROUP_UPDATED);
        }
    }

    /** Event for when a symbol group is moved. */
    public static class Moved extends Event<SymbolGroup> {

        /**
         * Constructor.
         *
         * @param symbolGroup
         *         The moved symbol group .
         */
        public Moved(SymbolGroup symbolGroup) {
            super(symbolGroup, EventType.SYMBOL_GROUP_MOVED);
        }
    }
}


text:
class ExpertSystem
  attr_reader :rules
  attr_accessor :goal

  def initialize(fact_table)
    raise ArgumentError.new("Fact table can't be nil") if fact_table.nil?
    @fact_table = fact_table
    @rules=[]
  end

  def add(*rules)
    rules.flatten!
    rules.each do |r|
      @rules << r
    end
  end

  def result
    start
    @fact_table[@goal]
  end

  def rules_activated
    @rules_activated
  end

  class IncorrectStateException < Exception

  end

  private
  def start
    raise IncorrectStateException.new('Goal property has to be set') if @goal.nil?
    @rules_activated=0
    begin
      new_rules = Array.new(@rules)
      @fact_table.reset_changed
      @rules.each { |rule|
        if rule.check @fact_table
          @rules_activated+=1
          new_rules.delete rule
        end
      }
      @rules = new_rules
    end while @fact_table.changed?
  end

end


text:
Created by `Stephen McDonald <http://twitter.com/stephen_mcd>`_

Drum
====

Drum is a Reddit / Hacker News clone, built using Mezzanine.
It is intended to demonstate some of the non-CMS capabilities
of Mezzanine, such as threaded comments, ratings, and public
user accounts.

Check out the blog post `Building Social Apps with Mezzanine
<http://blog.jupo.org/2013/04/30/building-social-apps-with-mezzanine-drum/>`_,
which contains a detailed walk-through of how Drum was built.

Installation
============

Basic setup::

  $ hg clone ssh://hg@bitbucket.org/stephenmcd/drum
  $ cd drum
  $ pip install -r requirements.txt
  $ cp local_settings.py.template local_settings.py
  $ ./manage.py createdb --noinput
  $ ./manage.py runserver

Sites Using Drum
================

* `Food News <http://food.hypertexthero.com>`_


text:
package io.flow.lint

import io.apibuilder.spec.v0.models._
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers

class ModelsWithOrganizationFieldSpec extends AnyFunSpec with Matchers {

  private[this] val linter = linters.ModelsWithOrganizationField

  def buildService(fields: Seq[String]): Service = {
    Services.Base.copy(
      models = Seq(
        Services.buildSimpleModel("user", fields)
      )
    )
  }

  it("no-op w/out organization field") {
    linter.validate(buildService(Seq("id", "email"))) should be(Nil)
  }

  it("no-op if organization field is optional") {
    linter.validate(
      Services.Base.copy(
        models = Seq(
          Services.buildModel(
            name = "user",
            fields = Seq(
              Services.buildField(name = "foobar"),
              Services.buildField(name = "organization", required = false)
            )
          )
        )
      )
    ) should be(Nil)
  }

  it("w/ organization but no id fields") {
    linter.validate(buildService(Seq("other", "organization"))) should be(Seq(
      "Model user: Field[organization] must be in position[0] and not[1]"
    ))
  }

  it("w/ id and organization fields") {
    linter.validate(buildService(Seq("id", "other", "organization"))) should be(Seq(
      "Model user: Field[organization] must be in position[1] and not[2]"
    ))
  }

  it("w/ id, timestamp, type and organization fields") {
    linter.validate(buildService(Seq("id", "timestamp", "type", "other", "organization"))) should be(Seq(
      "Model user: Field[organization] must be in position[3] and not[4]"
    ))
  }

  it("w/ event_id, timestamp, id fields") {
    linter.validate(buildService(Seq("event_id", "timestamp", "id", "other", "organization"))) should be(Seq(
      "Model user: Field[organization] must be in position[3] and not[4]"
    ))
  }

}


text:
package com.github.avarabyeu.jashing;

import com.github.avarabyeu.jashing.core.Jashing;

/**
 * Created by andrei_varabyeu on 12/23/15.
 */
public class JashingTest {
    public static void main(String[] args) {
        Jashing.builder().withPort(8282).build().bootstrap();
    }
}


text:
_[www.codever.land/bookmarks/t/firefox-webextensions](https://www.codever.land/bookmarks/t/firefox-webextensions)_
---
#### [Example extensions - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples)
_https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples_

To illustrate how to use the WebExtension APIs, we maintain a repository of example extensions at [https://github.com/mdn/webextensions-examples](https://github.com/mdn/webextensions-examples). This a...
* **tags**: [browser-extension](../tagged/browser-extension.md), [example](../tagged/example.md), [firefox-webextensions](../tagged/firefox-webextensions.md), [firefox-addon](../tagged/firefox-addon.md)
* :octocat: **[source code](https://github.com/mdn/webextensions-examples)**
---
#### [Create an appealing listing | Firefox Extension Workshop](https://extensionworkshop.com/documentation/develop/create-an-appealing-listing/)
_https://extensionworkshop.com/documentation/develop/create-an-appealing-listing/_

There are two essential steps to getting people to use your add-on: they need to discover your add-on and open the listing page, then the listing page needs to encourage them to click the Add to Firef...
* **tags**: [firefox-addon](../tagged/firefox-addon.md), [firefox-webextensions](../tagged/firefox-webextensions.md), [marketing](../tagged/marketing.md)
---
#### [Debugging | Firefox Extension Workshop](https://extensionworkshop.com/documentation/develop/debugging/)
_https://extensionworkshop.com/documentation/develop/debugging/_

This article explains how to use the Firefox developer tools to debug extensions.

An extension can consist of several components—background scripts, popups, options pages, content scripts, sidebars, ...
* **tags**: [firefox-webextensions](../tagged/firefox-webextensions.md), [firefox-addon](../tagged/firefox-addon.md), [debugging](../tagged/debugging.md)
---
#### [Test permission requests](https://extensionworkshop.com/documentation/develop/test-permission-requests/)
_https://extensionworkshop.com/documentation/develop/test-permission-requests/_

Your extension may contain two types of permission request: install time and runtime permission requests. This page explains how you can test the way your users will see requests for these permissions...
* **tags**: [firefox-webextensions](../tagged/firefox-webextensions.md), [permissions](../tagged/permissions.md)
---
#### [Browser support for JavaScript APIs - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs)
_https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScrip..._

* **tags**: [browser-extension](../tagged/browser-extension.md), [firefox-webextensions](../tagged/firefox-webextensions.md)
---
#### [mdn/webextensions-examples](https://github.com/mdn/webextensions-examples)
_https://github.com/mdn/webextensions-examples_

The "webextensions-examples" repository is a collection of simple, complete, and installable WebExtensions. The examples show how to use the WebExtensions APIs, and you can use them as a starting poin...
* **tags**: [firefox-addon](../tagged/firefox-addon.md), [firefox-webextensions](../tagged/firefox-webextensions.md), [example](../tagged/example.md), [browser-extension](../tagged/browser-extension.md)
* :octocat: **[source code](https://github.com/mdn/webextensions-examples)**
---
#### [A code, bundle, pack workflow for webextension projects - DEV Community 👩💻👨💻](https://dev.to/ramitmittal/a-code-bundle-pack-workflow-for-webextension-projects-4nhe)
_https://dev.to/ramitmittal/a-code-bundle-pack-workflow-for-webextension-projects-4nhe_

Till now we have been working with a bare-minimum setup for building webextensions. A lot of the tasks we have been doing can be automated. In this post, we will learn how to use bash scripts in our w...
* **tags**: [browser-extension](../tagged/browser-extension.md), [firefox-webextensions](../tagged/firefox-webextensions.md), [bundler](../tagged/bundler.md), [parceljs](../tagged/parceljs.md)
* :octocat: **[source code](https://github.com/ramitmittal/webext-timekeeper-proper)**
---
#### [mozilla/web-ext](https://github.com/mozilla/web-ext)
_https://github.com/mozilla/web-ext_

This is a command line tool to help build, run, and test [WebExtensions](https://wiki.mozilla.org/WebExtensions).
* **tags**: [firefox-webextensions](../tagged/firefox-webextensions.md), [javascript](../tagged/javascript.md), [browser-extension](../tagged/browser-extension.md)
* :octocat: **[source code](https://github.com/mozilla/web-ext)**
---
#### [Extension Compatibility Tester](https://www.extensiontest.com/)
_https://www.extensiontest.com/_

**Extension Compatibility Test for Firefox**

Use this tool to test your extension's compatibility with Firefox! To receive a report, upload your .crx file. We'll also provide you with resources and i...
* **tags**: [google-chrome-extension](../tagged/google-chrome-extension.md), [firefox-webextensions](../tagged/firefox-webextensions.md)
---
#### [GitHub - notlmn/browser-extension-template](https://github.com/notlmn/browser-extension-template)
_https://github.com/notlmn/browser-extension-template_

📕 Barebones boilerplate with webpack, options handler and auto-publishing - notlmn/browser-extension-template
* **tags**: [browser-extension](../tagged/browser-extension.md), [google-chrome-extension](../tagged/google-chrome-extension.md), [firefox-webextensions](../tagged/firefox-webextensions.md)
* :octocat: **[source code](https://github.com/notlmn/browser-extension-template)**
---


text:
#include <mrpt/opengl.h>  // Precompiled header

#include <mrpt/opengl/CFBORender.h>
#include "opengl_internals.h"

using namespace std;
using namespace mrpt;
using namespace mrpt::utils;
using namespace mrpt::opengl;

/*---------------------------------------------------------------
						Constructor
---------------------------------------------------------------*/
CFBORender::CFBORender( unsigned int width, unsigned int height, const bool skip_glut_window ) :
	m_width(width),
	m_height(height),
	m_win_used(!skip_glut_window),
	m_default_bk_color(.6f,.6f,.6f,1)
{
#if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT

	MRPT_START

	if (m_win_used)
	{
		// check a previous initialization of the GLUT
		if(!glutGet(GLUT_INIT_STATE))
		{
			// create the context (a little trick)
			int argc = 1;
			char *argv[1] = { NULL };
			glutInit(&argc, argv);
		}

		// create a hidden window
		m_win = glutCreateWindow("CFBORender");
		glutHideWindow();
	}

	// call after creating the hidden window
	if(!isExtensionSupported("GL_EXT_framebuffer_object"))
		THROW_EXCEPTION("Framebuffer Object extension unsupported");

	// In win32 we have to load the pointers to the functions:
#ifdef MRPT_OS_WINDOWS
	glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress("glGenFramebuffersEXT");
	glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
	glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress("glBindFramebufferEXT");
	glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) wglGetProcAddress("glFramebufferTexture2DEXT");

	ASSERT_(glGenFramebuffersEXT!=NULL)
	ASSERT_(glDeleteFramebuffersEXT!=NULL)
	ASSERT_(glBindFramebufferEXT!=NULL)
	ASSERT_(glFramebufferTexture2DEXT!=NULL)
#endif

	// gen the frambuffer object (FBO), similar manner as a texture
	glGenFramebuffersEXT(1, &m_fbo);

	// bind the framebuffer, fbo, so operations will now occur on it
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

	// change viewport size (in pixels)
	glViewport(0, 0, m_width, m_height);

	// make a texture
	glGenTextures(1, &m_tex);

	// initialize texture that will store the framebuffer image
	const GLenum texTarget =
#	if defined(GL_TEXTURE_RECTANGLE_NV)
		GL_TEXTURE_RECTANGLE_NV;
#	elif defined(GL_TEXTURE_RECTANGLE_ARB)
		GL_TEXTURE_RECTANGLE_ARB;
#	else
		GL_TEXTURE_RECTANGLE_EXT;
#	endif

	glBindTexture(texTarget, m_tex);
	glTexImage2D(texTarget, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

	// bind this texture to the current framebuffer obj. as color_attachement_0
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, texTarget, m_tex, 0);

	//'unbind' the frambuffer object, so subsequent drawing ops are not drawn into the FBO.
	// '0' means "windowing system provided framebuffer
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

	MRPT_END

//#else
//	THROW_EXCEPTION("MRPT compiled without OpenCV and/or OpenGL support!!")
#endif
}

/*---------------------------------------------------------------
						Destructor:
 ---------------------------------------------------------------*/
CFBORender::~CFBORender()
{
#if MRPT_HAS_OPENGL_GLUT

	MRPT_START

	// delete the current texture, the framebuffer object and the GLUT window
	glDeleteTextures(1, &m_tex);
	glDeleteFramebuffersEXT(1, &m_fbo);
	if (m_win_used) glutDestroyWindow(m_win);

	MRPT_END

//#else
//	THROW_EXCEPTION("MRPT compiled without OpenGL support!!")
#endif
}

/*---------------------------------------------------------------
					Set the scene camera
 ---------------------------------------------------------------*/
void  CFBORender::setCamera( const COpenGLScene& scene, const CCamera& camera )
{
	MRPT_START

	scene.getViewport("main")->getCamera() = camera;

	MRPT_END
}

/*---------------------------------------------------------------
					Get the scene camera
 ---------------------------------------------------------------*/
CCamera&  CFBORender::getCamera( const COpenGLScene& scene )
{
	MRPT_START

	return scene.getViewport("main")->getCamera();

	MRPT_END
}

/*---------------------------------------------------------------
		Render the scene and get the rendered rgb image. This
		function resizes the image buffer if it is necessary
 ---------------------------------------------------------------*/
void  CFBORender::getFrame( const COpenGLScene& scene, CImage& buffer )
{
#if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT

	MRPT_START

	// resize the buffer if it is necessary
	if(	buffer.getWidth()        != static_cast<size_t>(m_width) ||
		buffer.getHeight()       != static_cast<size_t>(m_height) ||
		buffer.getChannelCount() != 3 ||
		buffer.isOriginTopLeft() != false )
	{
		buffer.resize(m_width, m_height, 3, false);
	}

	// Go on.
	getFrame2(scene,buffer);;

	MRPT_END
#endif
}

/*---------------------------------------------------------------
		Render the scene and get the rendered rgb image. This
		function does not resize the image buffer.
 ---------------------------------------------------------------*/
void  CFBORender::getFrame2( const COpenGLScene& scene, CImage& buffer )
{
#if MRPT_HAS_OPENGL_GLUT

	MRPT_START

	// check the buffer size
	ASSERT_EQUAL_( buffer.getWidth(), static_cast<size_t>(m_width) )
	ASSERT_EQUAL_( buffer.getHeight(),static_cast<size_t>(m_height) )
	ASSERT_EQUAL_( buffer.getChannelCount(), 3 )
	ASSERT_EQUAL_( buffer.isOriginTopLeft(), false )

	// bind the framebuffer, fbo, so operations will now occur on it
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

	glClearColor(m_default_bk_color.R,m_default_bk_color.G,m_default_bk_color.B,m_default_bk_color.A);

	// Render opengl objects:
	// ---------------------------
	scene.render();

	// If any, draw the 2D text messages:
	// ----------------------------------
	render_text_messages(m_width,m_height);

	// TODO NOTE: This should fail if the image has padding bytes. See glPixelStore() etc.
	glReadPixels(0, 0, m_width, m_height, GL_BGR_EXT, GL_UNSIGNED_BYTE, buffer(0,0) );

	//'unbind' the frambuffer object, so subsequent drawing ops are not drawn into the FBO.
	// '0' means "windowing system provided framebuffer
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

	MRPT_END

#endif
}

/*---------------------------------------------------------------
					Resize the image size
 ---------------------------------------------------------------*/
void CFBORender::resize( unsigned int width, unsigned int height )
{
#if MRPT_HAS_OPENCV && MRPT_HAS_OPENGL_GLUT

	MRPT_START

	// update members
	m_width = width;
	m_height = height;

	// bind the framebuffer, fbo, so operations will now occur on it
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

	// change viewport size (in pixels)
	glViewport(0, 0, m_width, m_height);

	// change texture size
	const GLenum texTarget =
#	if defined(GL_TEXTURE_RECTANGLE_NV)
		GL_TEXTURE_RECTANGLE_NV;
#	elif defined(GL_TEXTURE_RECTANGLE_ARB)
		GL_TEXTURE_RECTANGLE_ARB;
#	else
		GL_TEXTURE_RECTANGLE_EXT;
#	endif

	glBindTexture(texTarget, m_tex);
	glTexImage2D(texTarget, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

	//'unbind' the frambuffer object, so subsequent drawing ops are not drawn into the FBO.
	// '0' means "windowing system provided framebuffer
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

	MRPT_END

//#else
//	THROW_EXCEPTION("MRPT compiled without OpenCV and/or OpenGL support!!")
#endif
}

/*---------------------------------------------------------------
		Provide information on Framebuffer object extension
 ---------------------------------------------------------------*/
int CFBORender::isExtensionSupported( const char* extension )
{
#if MRPT_HAS_OPENGL_GLUT

	MRPT_START

	const GLubyte *extensions = NULL;
	const GLubyte *start;
	GLubyte *where, *terminator;

	/* Extension names should not have spaces. */
	where = (GLubyte *) strchr(extension, ' ');
	if (where || *extension == '\0')
		return 0;
	extensions = glGetString(GL_EXTENSIONS);

	/* It takes a bit of care to be fool-proof about parsing the
	OpenGL extensions string. Don't be fooled by sub-strings,
	etc. */
	start = extensions;
	for (;;) {
		where = (GLubyte *) strstr((const char *) start, extension);
		if (!where)
			break;
		terminator = where + strlen(extension);
		if (where == start || *(where - 1) == ' ')
			if (*terminator == ' ' || *terminator == '\0')
				return 1;
		start = terminator;
	}

	MRPT_END

//#else
//	THROW_EXCEPTION("MRPT compiled without OpenGL support!!")
#endif

	return 0;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <item type="id" name="screen_switcher_tag"/>
</resources>


text:
#ifndef ONGGI_FKEY_H
#define ONGGI_FKEY_H

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

/**
 * SECTION: onggifkey
 * @title: OnggiFKey
 * @short_description: The Infomation about foreign key.
 * @include: onggi.h
 *
 * This structure represents a foreign key association.
 */

#include <glib-object.h>
#include <libgda/libgda.h>

G_BEGIN_DECLS

typedef struct _OnggiTable OnggiTable;
typedef struct _OnggiColumn OnggiColumn;

/**
 * OnggiFKey:
 *
 * The structure contains private fields.
 */

#define ONGGI_TYPE_FKEY (onggi_fkey_get_type())
G_DECLARE_FINAL_TYPE(
    OnggiFKey,
    onggi_fkey,
    ONGGI, FKEY,
    GObject)

/**
 * OnggiFKeyEntry:
 * @column: (transfer full): Column.
 * @ref_column: (transfer full): Referenced column.
 *
 * This is pair of column.
 */
typedef struct _OnggiFKeyEntry OnggiFKeyEntry;

struct _OnggiFKeyEntry {
  OnggiColumn *column;
  OnggiColumn *ref_column;
};

#define ONGGI_TYPE_FKEY_ENTRY (onggi_fkey_entry_get_type())
GType   onggi_fkey_entry_get_type   (void);

//////// Constructor ///////////////////////////////////////////////////////////

OnggiFKey   *onggi_fkey_new (void);

OnggiFKey   *onggi_fkey_new_single (OnggiColumn *column,
                                    OnggiColumn *ref_column);

//////// Property getter / setter //////////////////////////////////////////////

OnggiTable  *onggi_fkey_get_table (OnggiFKey *fkey);

OnggiTable  *onggi_fkey_get_ref_table (OnggiFKey *fkey);

void         onggi_fkey_get_tables (OnggiFKey   *fkey,
                                    OnggiTable **table,
                                    OnggiTable **ref_table);

guint        onggi_fkey_get_n_columns      (OnggiFKey *fkey);

//////// Foreign Key columns ///////////////////////////////////////////////////

void            onggi_fkey_add                 (OnggiFKey *fkey,
                                                OnggiColumn *column,
                                                OnggiColumn *ref_column);

gboolean        onggi_fkey_remove              (OnggiFKey *fkey,
                                                OnggiColumn *column);

gboolean        onggi_fkey_remove_name         (OnggiFKey   *fkey,
                                                const gchar *name);

OnggiColumn    *onggi_fkey_get_ref_column     (OnggiFKey   *fkey,
                                                OnggiColumn *column);

GList          *onggi_fkey_get_columns         (OnggiFKey *fkey);

GList          *onggi_fkey_get_entries         (OnggiFKey *fkey);

//////// Entry Constructor /////////////////////////////////////////////////////

OnggiFKeyEntry *onggi_fkey_entry_new           (OnggiColumn *column,
                                                OnggiColumn *ref_column);

OnggiFKeyEntry *onggi_fkey_entry_dup           (const OnggiFKeyEntry *entry);

void            onggi_fkey_entry_free          (OnggiFKeyEntry *entry);

G_END_DECLS

#endif /* ONGGI_FKEY_H */


text:
<?php

namespace flat\db\driver\pdo\exception;
class bad_param extends \flat\db\driver\pdo\exception {
   public function __construct($param,$details="") {
      if (!empty($details)) $details = ": $details";
      parent::__construct("bad param '$param'$details");
   }
}


text:
[![Version](https://img.shields.io/cocoapods/v/UIPlaceholderTextView.svg?style=flat)](http://cocoapods.org/pods/UIPlaceholderTextView)
[![License](https://img.shields.io/cocoapods/l/UIPlaceholderTextView.svg?style=flat)](http://cocoapods.org/pods/UIPlaceholderTextView)
[![Platform](https://img.shields.io/cocoapods/p/UIPlaceholderTextView.svg?style=flat)](http://cocoapods.org/pods/UIPlaceholderTextView)

## Usage

Use it just like a UITextView but there is a placeholder text property.

## Installation

UIPlaceholderTextView is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "UIPlaceholderTextView"
```

## Author

Daniel Blakemore, DanBlakemore@gmail.com

## License

UIPlaceholderTextView is available under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC BY-SA 3.0) license. See the LICENSE file for more info.